atproto blogging
1//! Collaboration invites page.
2
3use crate::Route;
4use crate::auth::AuthState;
5use crate::components::collab::InvitesList;
6use dioxus::prelude::*;
7use jacquard::types::ident::AtIdentifier;
8
9const INVITES_CSS: Asset = asset!("/assets/styling/invites.css");
10
11/// Page showing collaboration invites (sent and received).
12#[component]
13pub fn InvitesPage(ident: ReadSignal<AtIdentifier<'static>>) -> Element {
14 let auth_state = use_context::<Signal<AuthState>>();
15 let navigator = use_navigator();
16
17 // Check ownership - only show to authenticated user viewing their own invites
18 let current_did = auth_state.read().did.clone();
19 let is_owner = match (¤t_did, ident()) {
20 (Some(did), AtIdentifier::Did(ref ident_did)) => *did == *ident_did,
21 _ => false,
22 };
23
24 // Redirect non-owners
25 let ident_for_redirect = ident();
26 use_effect(move || {
27 if !is_owner {
28 navigator.replace(Route::RepositoryIndex {
29 ident: ident_for_redirect.clone(),
30 });
31 }
32 });
33
34 if !is_owner {
35 return rsx! { div { "Redirecting..." } };
36 }
37
38 rsx! {
39 document::Stylesheet { href: INVITES_CSS }
40
41 div { class: "invites-page",
42 header { class: "invites-header",
43 h1 { "Collaboration Invites" }
44 p { class: "invites-description",
45 "Manage your collaboration invitations. Accept invites to collaborate on entries and notebooks."
46 }
47 }
48
49 InvitesList {}
50 }
51 }
52}