Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@ pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.alter_table(
Table::alter()
.table(Alias::new("posts"))
.add_column(ColumnDef::new(Alias::new("image_width")).integer().null())
.add_column(ColumnDef::new(Alias::new("image_height")).integer().null())
.to_owned(),
)
.await
let db = manager.get_connection();
db.execute_unprepared(
"ALTER TABLE posts ADD COLUMN IF NOT EXISTS image_width integer, ADD COLUMN IF NOT EXISTS image_height integer"
).await?;
Ok(())
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
Expand Down
6 changes: 5 additions & 1 deletion packages/shared/supabase/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ export function initSupabase(
anonKey: string
): SupabaseClient<Database> {
if (!supabaseClient) {
supabaseClient = createClient<Database>(url, anonKey);
supabaseClient = createClient<Database>(url, anonKey, {
auth: {
detectSessionInUrl: true,
},
});
}
return supabaseClient;
}
Expand Down
4 changes: 4 additions & 0 deletions packages/web/app/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion packages/web/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ export const metadata: Metadata = {
card: "summary_large_image",
images: [`${SITE_URL}/api/og`],
},
icons: {
icon: "/icon.svg",
apple: "/icon.svg",
},
robots: {
index: true,
follow: true,
Expand All @@ -69,7 +73,7 @@ export default function RootLayout({
modal: React.ReactNode;
}) {
return (
<html lang="en" suppressHydrationWarning>
<html lang="ko" suppressHydrationWarning>
<head>
<ThemeScript />
<JsonLdOrganization />
Expand Down
27 changes: 27 additions & 0 deletions packages/web/app/manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { MetadataRoute } from "next";

export default function manifest(): MetadataRoute.Manifest {
return {
name: "decoded",
short_name: "decoded",
description: "Discover and decode fashion items from any image",
theme_color: "#050505",
background_color: "#050505",
display: "standalone",
start_url: "/",
icons: [
{
src: "/icon.svg",
sizes: "any",
type: "image/svg+xml",
purpose: "maskable",
},
{
src: "/icon.svg",
sizes: "any",
type: "image/svg+xml",
purpose: "any",
},
],
};
}
78 changes: 16 additions & 62 deletions packages/web/app/profile/ProfileClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ import {
ProfileDesktopLayout,
ActivityTabs,
ActivityContent,
EmptyState,
ActivityItemCard,
type ActivityTab,
ProfileBio,
FollowStats,
PostsGrid,
SpotsList,
SolutionsList,
SavedGrid,
TriesGrid,
StyleDNACard,
Expand All @@ -32,7 +33,6 @@ import {
useUserStats,
useMyBadges,
useMyRanking,
useUserActivities,
useProfileExtras,
useTryOnCount,
} from "@/lib/hooks/useProfile";
Expand Down Expand Up @@ -200,30 +200,6 @@ export function ProfileClient() {
const { data: profileExtras } = useProfileExtras(userId);
const { data: tryOnCount } = useTryOnCount(userId);

// Activities from API (saved 탭은 미구현) - 반드시 early return 전에 호출
const activitiesTypeMap: Record<
ActivityTab,
"post" | "spot" | "solution" | undefined
> = {
posts: "post",
spots: "spot",
solutions: "solution",
tries: undefined,
saved: undefined,
};
const activitiesType = activitiesTypeMap[activeTab];
const {
data: activitiesData,
isLoading: isActivitiesLoading,
fetchNextPage,
hasNextPage,
isFetchingNextPage,
} = useUserActivities({
type: activitiesType ?? undefined,
perPage: 20,
enabled: activeTab !== "saved" && activeTab !== "tries",
});

// Sync API data to store
const setUserFromApi = useProfileStore((state) => state.setUserFromApi);
const setStatsFromApi = useProfileStore((state) => state.setStatsFromApi);
Expand Down Expand Up @@ -295,43 +271,21 @@ export function ProfileClient() {
return <ProfileError error={error} onRetry={handleRetry} />;
}

const activityItems = activitiesData?.pages.flatMap((p) => p.data) ?? [];
const hasActivityContent = activityItems.length > 0;

const renderTabContent = () => {
if (activeTab === "tries") {
return <TriesGrid />;
}
if (activeTab === "saved") {
return <SavedGrid />;
}
if (isActivitiesLoading && !activitiesData) {
return (
<div className="flex justify-center py-12">
<div className="h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent" />
</div>
);
}
if (!hasActivityContent) {
return <EmptyState tab={activeTab} />;
switch (activeTab) {
case "posts":
return <PostsGrid userId={userId} />;
case "spots":
return <SpotsList userId={userId} />;
case "solutions":
return <SolutionsList userId={userId} />;
case "tries":
return <TriesGrid />;
case "saved":
return <SavedGrid />;
default:
return null;
}

return (
<div className="space-y-4">
{activityItems.map((item) => (
<ActivityItemCard key={item.id} item={item} />
))}
{hasNextPage && (
<button
onClick={() => fetchNextPage()}
disabled={isFetchingNextPage}
className="w-full py-2 text-sm text-muted-foreground hover:text-foreground disabled:opacity-50"
>
{isFetchingNextPage ? "로딩 중..." : "더 보기"}
</button>
)}
</div>
);
};

return (
Expand Down
Loading
Loading