Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 1 addition & 26 deletions client/.next/dev/build-manifest.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,6 @@
{
"pages": {
"/_app": [
"static/chunks/node_modules_next_dist_compiled_8ca6b690._.js",
"static/chunks/node_modules_next_dist_shared_lib_8bac8163._.js",
"static/chunks/node_modules_next_dist_client_5a8a528e._.js",
"static/chunks/node_modules_next_dist_b3fb3b5f._.js",
"static/chunks/node_modules_next_app_72f3d36f.js",
"static/chunks/[next]_entry_page-loader_ts_742e4b53._.js",
"static/chunks/node_modules_react-dom_4411d9bd._.js",
"static/chunks/node_modules_7f09fef0._.js",
"static/chunks/[root-of-the-server]__45f039c3._.js",
"static/chunks/pages__app_2da965e7._.js",
"static/chunks/turbopack-pages__app_0fce199e._.js"
],
"/_error": [
"static/chunks/node_modules_next_dist_compiled_8ca6b690._.js",
"static/chunks/node_modules_next_dist_shared_lib_9a2a7093._.js",
"static/chunks/node_modules_next_dist_client_5a8a528e._.js",
"static/chunks/node_modules_next_dist_a183fb77._.js",
"static/chunks/node_modules_next_error_1cfbb379.js",
"static/chunks/[next]_entry_page-loader_ts_43b523b5._.js",
"static/chunks/node_modules_react-dom_4411d9bd._.js",
"static/chunks/node_modules_7f09fef0._.js",
"static/chunks/[root-of-the-server]__092393de._.js",
"static/chunks/pages__error_2da965e7._.js",
"static/chunks/turbopack-pages__error_af01c4e3._.js"
]
"/_app": []
},
"devFiles": [],
"polyfillFiles": [
Expand Down
Binary file modified client/.next/dev/cache/turbopack/23c464985/CURRENT
Binary file not shown.
1,310 changes: 1,310 additions & 0 deletions client/.next/dev/cache/turbopack/23c464985/LOG

Large diffs are not rendered by default.

27 changes: 1 addition & 26 deletions client/.next/dev/fallback-build-manifest.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,6 @@
{
"pages": {
"/_app": [
"static/chunks/node_modules_next_dist_compiled_8ca6b690._.js",
"static/chunks/node_modules_next_dist_shared_lib_8bac8163._.js",
"static/chunks/node_modules_next_dist_client_5a8a528e._.js",
"static/chunks/node_modules_next_dist_b3fb3b5f._.js",
"static/chunks/node_modules_next_app_72f3d36f.js",
"static/chunks/[next]_entry_page-loader_ts_742e4b53._.js",
"static/chunks/node_modules_react-dom_4411d9bd._.js",
"static/chunks/node_modules_7f09fef0._.js",
"static/chunks/[root-of-the-server]__45f039c3._.js",
"static/chunks/pages__app_2da965e7._.js",
"static/chunks/turbopack-pages__app_0fce199e._.js"
],
"/_error": [
"static/chunks/node_modules_next_dist_compiled_8ca6b690._.js",
"static/chunks/node_modules_next_dist_shared_lib_9a2a7093._.js",
"static/chunks/node_modules_next_dist_client_5a8a528e._.js",
"static/chunks/node_modules_next_dist_a183fb77._.js",
"static/chunks/node_modules_next_error_1cfbb379.js",
"static/chunks/[next]_entry_page-loader_ts_43b523b5._.js",
"static/chunks/node_modules_react-dom_4411d9bd._.js",
"static/chunks/node_modules_7f09fef0._.js",
"static/chunks/[root-of-the-server]__092393de._.js",
"static/chunks/pages__error_2da965e7._.js",
"static/chunks/turbopack-pages__error_af01c4e3._.js"
]
"/_app": []
},
"devFiles": [],
"polyfillFiles": [],
Expand Down
6 changes: 3 additions & 3 deletions client/.next/dev/prerender-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"dynamicRoutes": {},
"notFoundRoutes": [],
"preview": {
"previewModeId": "e3748705c7008bf7ea765847815b8211",
"previewModeSigningKey": "1d7149393555e0b7b6b3e1688acbd898bc37cb8a7282dcc931b622be48e98fed",
"previewModeEncryptionKey": "0f7685959c2497abf2eebdc34cd390003a1ad5280d27b03c9d83650d577b44bd"
"previewModeId": "63265b7023e73084c7986d4c1640c1e0",
"previewModeSigningKey": "f0a90e39a2c18e197481ff72d7c2d4d88448d7a89729d07084e7556b301dd5d6",
"previewModeEncryptionKey": "edb7ecd092ee0ba70d1b8e3a740536e709c54cb2a211b9895ac2202e9edc7de5"
}
}
3 changes: 3 additions & 0 deletions client/.next/dev/server/app-paths-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"/(auth)/login/page": "app/(auth)/login/page.js",
"/(auth)/signup/page": "app/(auth)/signup/page.js",
"/(root)/page": "app/(root)/page.js",
"/(root)/user/[id]/page": "app/(root)/user/[id]/page.js"
}

Large diffs are not rendered by default.

27 changes: 1 addition & 26 deletions client/.next/dev/server/middleware-build-manifest.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,6 @@
globalThis.__BUILD_MANIFEST = {
"pages": {
"/_app": [
"static/chunks/node_modules_next_dist_compiled_8ca6b690._.js",
"static/chunks/node_modules_next_dist_shared_lib_8bac8163._.js",
"static/chunks/node_modules_next_dist_client_5a8a528e._.js",
"static/chunks/node_modules_next_dist_b3fb3b5f._.js",
"static/chunks/node_modules_next_app_72f3d36f.js",
"static/chunks/[next]_entry_page-loader_ts_742e4b53._.js",
"static/chunks/node_modules_react-dom_4411d9bd._.js",
"static/chunks/node_modules_7f09fef0._.js",
"static/chunks/[root-of-the-server]__45f039c3._.js",
"static/chunks/pages__app_2da965e7._.js",
"static/chunks/turbopack-pages__app_0fce199e._.js"
],
"/_error": [
"static/chunks/node_modules_next_dist_compiled_8ca6b690._.js",
"static/chunks/node_modules_next_dist_shared_lib_9a2a7093._.js",
"static/chunks/node_modules_next_dist_client_5a8a528e._.js",
"static/chunks/node_modules_next_dist_a183fb77._.js",
"static/chunks/node_modules_next_error_1cfbb379.js",
"static/chunks/[next]_entry_page-loader_ts_43b523b5._.js",
"static/chunks/node_modules_react-dom_4411d9bd._.js",
"static/chunks/node_modules_7f09fef0._.js",
"static/chunks/[root-of-the-server]__092393de._.js",
"static/chunks/pages__error_2da965e7._.js",
"static/chunks/turbopack-pages__error_af01c4e3._.js"
]
"/_app": []
},
"devFiles": [],
"polyfillFiles": [
Expand Down
6 changes: 3 additions & 3 deletions client/.next/dev/server/middleware-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"env": {
"__NEXT_BUILD_ID": "development",
"NEXT_SERVER_ACTIONS_ENCRYPTION_KEY": "I0Qg42JCxNsx6VeH92IO65zBI4YyVKtFxt37oRvPc0g=",
"__NEXT_PREVIEW_MODE_ID": "e3748705c7008bf7ea765847815b8211",
"__NEXT_PREVIEW_MODE_ENCRYPTION_KEY": "0f7685959c2497abf2eebdc34cd390003a1ad5280d27b03c9d83650d577b44bd",
"__NEXT_PREVIEW_MODE_SIGNING_KEY": "1d7149393555e0b7b6b3e1688acbd898bc37cb8a7282dcc931b622be48e98fed"
"__NEXT_PREVIEW_MODE_ID": "63265b7023e73084c7986d4c1640c1e0",
"__NEXT_PREVIEW_MODE_ENCRYPTION_KEY": "edb7ecd092ee0ba70d1b8e3a740536e709c54cb2a211b9895ac2202e9edc7de5",
"__NEXT_PREVIEW_MODE_SIGNING_KEY": "f0a90e39a2c18e197481ff72d7c2d4d88448d7a89729d07084e7556b301dd5d6"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion client/.next/dev/server/next-font-manifest.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions client/.next/dev/server/next-font-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
{
"app": {
"[project]/app/(auth)/login/page": [
"static/media/caa3a2e1cccd8315-s.p.853070df.woff2",
"static/media/797e433ab948586e-s.p.dbea232f.woff2"
],
"[project]/app/(auth)/signup/page": [
"static/media/caa3a2e1cccd8315-s.p.853070df.woff2",
"static/media/797e433ab948586e-s.p.dbea232f.woff2"
],
"[project]/app/(root)/page": [
"static/media/caa3a2e1cccd8315-s.p.853070df.woff2",
"static/media/797e433ab948586e-s.p.dbea232f.woff2"
],
"[project]/app/(root)/user/[id]/page": [
"static/media/caa3a2e1cccd8315-s.p.853070df.woff2",
"static/media/797e433ab948586e-s.p.dbea232f.woff2"
Expand Down
6 changes: 1 addition & 5 deletions client/.next/dev/server/pages-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
"/_app": "pages/_app.js",
"/_document": "pages/_document.js",
"/_error": "pages/_error.js"
}
{}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions client/.next/dev/static/development/_buildManifest.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
self.__BUILD_MANIFEST = {
"/_error": [
"static/chunks/pages/_error.js"
],
"__rewrites": {
"afterFiles": [],
"beforeFiles": [],
Expand Down
19 changes: 19 additions & 0 deletions client/.next/dev/trace

Large diffs are not rendered by default.

21 changes: 13 additions & 8 deletions client/actions/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export function logout() {
redirect("/login");
}

export async function editProfile(
export async function updateProfile(
state: ProfileEditStateType | unknown,
formData: FormData,
): Promise<ProfileEditStateType> {
Expand All @@ -130,6 +130,7 @@ export async function editProfile(
firstName:
typeof data.firstName === "string" ? data.firstName : undefined,
lastName: typeof data.lastName === "string" ? data.lastName : undefined,
username: typeof data.username === "string" ? data.username : undefined,
email: typeof data.email === "string" ? data.email : undefined,
gender: typeof data.gender === "string" ? data.gender : undefined,
dob: typeof data.dob === "string" ? new Date(data.dob) : undefined,
Expand All @@ -140,22 +141,26 @@ export async function editProfile(
const res = await fetcher({
method: "PATCH",
payload: {
firstName: validatedData.data.firstName,
lastName: validatedData.data.lastName,
// email: validatedData.data.email,
gender: validatedData.data.gender,
dob: validatedData.data.dob,
bio: validatedData.data.bio,
profile: {
firstName: validatedData.data.firstName,
lastName: validatedData.data.lastName,
gender: validatedData.data.gender,
dob: validatedData.data.dob,
bio: validatedData.data.bio,
},
email: validatedData.data.email,
username: validatedData.data.username,
},
});

if (!res.success || !res.data) {
return {
status: StatusType.ERROR,
message: res?.message as unknown as string,
firstName:
typeof data.firstName === "string" ? data.firstName : undefined,
lastName: typeof data.lastName === "string" ? data.lastName : undefined,
username: typeof data.username === "string" ? data.username : undefined,
email: typeof data.email === "string" ? data.email : undefined,
gender: typeof data.gender === "string" ? data.gender : undefined,
dob: typeof data.dob === "string" ? new Date(data.dob) : undefined,
Expand Down
11 changes: 7 additions & 4 deletions client/app/(root)/user/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import PostPlaceholder from "@/components/placeholder/post-placeholder";
import PostItem from "@/components/post/post-item";
import { Button } from "@/components/ui/button";
import { UserDialog } from "@/components/user/user-dialog";
import { formatDateToLocale } from "@/lib/format-date";
import { authStore } from "@/stores/auth-store";
import { postStore } from "@/stores/post-store";
import { userStore } from "@/stores/user-store";
import { PencilIcon } from "lucide-react";
Expand All @@ -17,13 +19,14 @@ export default function UserPage() {
const [open, setOpen] = useState(false);
const fetchUser = userStore((state) => state.fetchUser);
const currentUser = userStore((state) => state.user);
const authUser = authStore((state) => state.user);
const posts = postStore((state) => state.posts);
const isLoading = postStore((state) => state.isLoading);
const fetchPosts = postStore((state) => state.fetchPosts);

useEffect(() => {
fetchUser(id as string);
// fetchPosts(id as string);
fetchPosts(id as string);
}, [id]);

return (
Expand All @@ -40,23 +43,23 @@ export default function UserPage() {
)}
<h3 className="text-sm">@{currentUser?.username}</h3>
</div>
<div className="flex md:flex-col md:gap-0 justify-between md:justify-start">
<div className="flex md:flex-col md:gap-0 justify-between md:justify-start capitalize">
<p>
<span className="font-semibold">Gender:</span>{" "}
{currentUser?.profile.gender || "Not specified"}
</p>
<p>
<span className="font-semibold">Date of Birth:</span>{" "}
{currentUser?.profile.dob
? new Date(currentUser.profile.dob).toLocaleDateString()
? formatDateToLocale(currentUser.profile.dob)
: "Not specified"}
</p>
</div>
<p className="w-full">
<span className="font-semibold">Bio:</span>{" "}
{currentUser?.profile.bio || "Not specified"}
</p>
{id === "me" && (
{id === authUser?.sub && (
<div className="absolute right-0">
<Button
variant="outline"
Expand Down
2 changes: 1 addition & 1 deletion client/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function Header() {
<DropdownMenuContent>
<DropdownMenuGroup>
<DropdownMenuItem>
<Link href="/user/me">Profile</Link>
<Link href={`/user/${user?.sub}`}>Profile</Link>
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setEditUser(true)}>
Settings
Expand Down
3 changes: 2 additions & 1 deletion client/components/ui/date-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
import { formatDateToLocale } from "@/lib/format-date";

interface DatePickerInputProps {
date: Date | undefined;
Expand All @@ -34,7 +35,7 @@ export function DatePickerInput({
id="date"
className="justify-start font-normal"
>
{date ? date.toLocaleDateString() : "Select date"}
{date ? formatDateToLocale(date) : "Select date"}
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto overflow-hidden p-0" align="start">
Expand Down
4 changes: 2 additions & 2 deletions client/components/user/user-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function UserDialog({ open, onOpenChange }: UserDialogProps) {
done.
</DialogDescription>
</DialogHeader>
<UserEdit />
<UserEdit onOpenChange={onOpenChange} />
</DialogContent>
</Dialog>
);
Expand All @@ -51,7 +51,7 @@ export function UserDialog({ open, onOpenChange }: UserDialogProps) {
<DrawerTitle>Edit profile</DrawerTitle>
</DrawerHeader>
<div className="px-4 overflow-y-auto">
<UserEdit />
<UserEdit onOpenChange={onOpenChange} />
</div>
<DrawerFooter className="pt-2">
<DrawerClose asChild>
Expand Down
20 changes: 12 additions & 8 deletions client/components/user/user-edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ import {
} from "../ui/select";
import { Textarea } from "../ui/textarea";
import { userStore } from "@/stores/user-store";
import { editProfile } from "@/actions/auth";
import { updateProfile } from "@/actions/auth";
import { DatePickerInput } from "../ui/date-picker";
import { useShowToast } from "@/hooks/use-show-toast";
import { Spinner } from "../ui/spinner";
import { formatDate } from "@/lib/format-date";
import { useRouter } from "next/router";

export default function UserEdit() {
const router = useRouter();
export default function UserEdit({
onOpenChange,
}: {
onOpenChange: (open: boolean) => void;
}) {
const user = userStore((state) => state.user);
const [state, action, isPending] = useActionState(editProfile, undefined);
const fetchUser = userStore((state) => state.fetchUser);
const [state, action, isPending] = useActionState(updateProfile, undefined);
const [date, setDate] = useState<Date | undefined>(
user?.profile.dob || state?.dob || undefined,
);
Expand All @@ -33,11 +36,12 @@ export default function UserEdit() {
if (state?.message) {
useShowToast(state.status, state.message);
}
if(state?.status === "success") {
// router.refresh();
if (state?.status === "success") {
onOpenChange(false);
if (user?.id) fetchUser(user.id);
}
}, [state]);
// Hey! I'm new here. Nice to meet you.

return (
<form action={action}>
<FieldGroup>
Expand Down
Loading
Loading