Skip to content

Commit 29431bb

Browse files
committed
added page to display shared secrects
1 parent a533d13 commit 29431bb

2 files changed

Lines changed: 23 additions & 5 deletions

File tree

‎frontend/src/model/index.model.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { TextureKey, Pri_set } from "@/hooks/use-background.hook";
44

55
export interface Quote {
66
_id?: string | undefined; // cloud id
7+
user?: string | undefined; // cloud user id
78
id?: number | undefined;
89
text: string;
910
texture?: TextureKey;

‎frontend/src/page/shared-note/shared-note.page.tsx‎

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,34 @@ import { Route } from "@/routes/shared-note/$_id"
22
import { useGetCloudQuote } from "@/feature/user/hook/use-get-cloud-quote.hook";
33
import NoteCardComponent from "@/feature/shared-note/component/NoteCardComponent";
44
import { LoaderFull } from "@/components/ui/loader-full";
5+
import NavigationComponent from "@/feature/user/component/NavigationComponent";
6+
import { useGetUser } from "@/feature/user/hook/use-get-user.hook";
57

68

79
function SharedNotePage() {
810
const { _id } = Route.useParams()
9-
const { data, isPending } = useGetCloudQuote({ _id })
11+
const { data: note, isPending } = useGetCloudQuote({ _id })
12+
const { data: user, } = useGetUser({ _id: note?.user })
1013

1114
return (
12-
<div className="p-4">
13-
{(isPending) && <LoaderFull />}
14-
{(data && data?.shared) && <NoteCardComponent quote={data} />}
15-
{(data && !data?.shared) && (<p>The secrect was not shared...</p>)}
15+
<div className="p-4 flex flex-col gap-4">
16+
<div className="flex gap-2 items-center">
17+
<NavigationComponent />
18+
{user && (
19+
<span >
20+
Shared by:
21+
<span className="font-bolder">
22+
{" "} {user?.name}
23+
</span>
24+
</span>
25+
)
26+
}
27+
</div>
28+
<div >
29+
{(isPending) && <LoaderFull />}
30+
{(note && note?.shared) && <NoteCardComponent quote={note} />}
31+
{(note && !note?.shared) && (<p>The secrect was not shared...</p>)}
32+
</div>
1633
</div>
1734
)
1835
}

0 commit comments

Comments
 (0)