diff --git a/src/shared/components/remote-fetch.tsx b/src/shared/components/remote-fetch.tsx index 457f84df..003c2535 100644 --- a/src/shared/components/remote-fetch.tsx +++ b/src/shared/components/remote-fetch.tsx @@ -41,46 +41,6 @@ function uriToQuery(uri: string) { return match ? `!${match[2]}@${match[1]}` : ""; } -const _test_com_view: CommunityView = { - community: { - id: 2, - name: "test", - title: "Testy", - description: - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", - removed: false, - published: "2023-07-08T03:12:46.323277", - updated: "2023-07-22T00:29:46.425846", - deleted: false, - nsfw: false, - actor_id: "https://localhost/c/test", - local: true, - icon: "http://localhost:1236/pictrs/image/dc71f5e8-fdb2-48ae-8a49-f504e4adaf26.png", - banner: - "http://localhost:1236/pictrs/image/fdf28def-5c4d-49a6-84bc-fd6b5d901cc7.jpeg", - hidden: false, - posting_restricted_to_mods: false, - instance_id: 1, - followers_url: "dwdwdwd", - inbox_url: "dwdwdwdw", - }, - subscribed: "Subscribed", - blocked: false, - counts: { - id: 1, - community_id: 2, - subscribers: 1, - posts: 1, - comments: 30, - published: "2023-07-08T03:12:46.323277", - users_active_day: 1, - users_active_week: 1, - users_active_month: 1, - users_active_half_year: 1, - hot_rank: 0, - }, -}; - async function handleToggleFollow(i: RemoteFetch, follow: boolean) { const { resolveObjectRes } = i.state; if (resolveObjectRes.state === "success" && resolveObjectRes.data.community) { @@ -169,31 +129,32 @@ export class RemoteFetch extends Component { } get content() { - const status = "success" as "success" | "loading" | "empty"; + const res = this.state.resolveObjectRes; const { uri } = getRemoteFetchQueryParams(); const remoteCommunityName = uri ? uriToQuery(uri) : "remote community"; - switch (status) { + switch (res.state) { case "success": { + const communityView = res.data.community as CommunityView; return ( <>

Community Federated!

- {_test_com_view.community.banner && ( - + {communityView.community.banner && ( + )}

- +

- {_test_com_view.community.description && ( + {communityView.community.description && (
- {_test_com_view.community.description} + {communityView.community.description}
)}