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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"fix": "yarn lint --fix",
"test": "jest",
"test:watch": "jest --watch",
"postinstall": "npx prisma generate",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
Warnings:

- Made the column `status` on table `threads` required. This step will fail if there are existing NULL values in that column.

*/
-- AlterTable
ALTER TABLE "threads" ALTER COLUMN "status" SET NOT NULL;

-- CreateTable
CREATE TABLE "work_space" (
"id" TEXT NOT NULL,
"owner_id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"slug" TEXT NOT NULL,
"image" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

CONSTRAINT "work_space_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "work_space_slug_key" ON "work_space"("slug");

-- AddForeignKey
ALTER TABLE "work_space" ADD CONSTRAINT "work_space_owner_id_fkey" FOREIGN KEY ("owner_id") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
18 changes: 18 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ model User {
files File[]
planSubscription PlanSubscription?
llmTokenUsages LLMTokenUsage[]
ownWorkSpaces WorkSpace[]

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Expand Down Expand Up @@ -141,6 +142,23 @@ model Authenticator {
@@id([userId, credentialID])
}

model WorkSpace {
id String @id @default(uuid())

ownerId String @map("owner_id")
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)

name String
slug String @unique

image String?

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

@@map("work_space")
}


model Thread {
id String @id @default(uuid())
Expand Down
24 changes: 24 additions & 0 deletions src/app/(main)/[slug]/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Box } from "@/shared/components/Box";
import type React from "react";

export default async function DashboardLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<Box display="flex" flex={1} minHeight="0">
<Box
display={{ xs: "none", md: "block" }}
width="240px"
borderRight="1px solid"
borderColor="divider"
>
TODO(ここにワークスペースのサイドバー)
</Box>
<Box flex={1} minHeight="0" sx={{ overflowY: "auto" }}>
{children}
</Box>
</Box>
);
}
29 changes: 29 additions & 0 deletions src/app/(main)/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { ThreadList } from "@/features/dashboard/ThreadList";
import { SCROLL_CONTAINER_ID } from "@/shared/consts/domId";
import { urls } from "@/shared/consts/urls";
import { generateMetadataObject } from "@/shared/lib/generateMetadataObject";
import { Metadata } from "next";
import { redirect } from "next/navigation";
import { getCurrentUser } from "../../actions/userActions";

export const metadata: Metadata = generateMetadataObject({
title: "Thread Note - ダッシュボード",
});
export default async function Page() {
const currentUser = await getCurrentUser();
if (!currentUser) redirect(urls.top);

return (
<div className="relative h-full">
{/* メインコンテンツ */}
<main
className="w-full overflow-y-auto border-r md:px-6 px-2 md:pt-6 pt-4 pb-4 h-full"
id={SCROLL_CONTAINER_ID}
>
<div className="w-full max-w-[700px] mx-auto h-full">
<ThreadList />
</div>
</main>
</div>
);
}
File renamed without changes.
25 changes: 25 additions & 0 deletions src/app/(main)/dashboard/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { DashBoardSidebar } from "@/features/dashboard/DashBoardSidebar";
import { Box } from "@/shared/components/Box";
import type React from "react";

export default async function DashboardLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<Box display="flex" flex={1} minHeight="0">
<Box
display={{ xs: "none", md: "block" }}
width="240px"
borderRight="1px solid"
borderColor="divider"
>
<DashBoardSidebar />
</Box>
<Box flex={1} minHeight="0" sx={{ overflowY: "auto" }}>
{children}
</Box>
</Box>
);
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { urls } from "@/shared/consts/urls";
import { generateMetadataObject } from "@/shared/lib/generateMetadataObject";
import { Metadata } from "next";
import { redirect } from "next/navigation";
import { getCurrentUser } from "../actions/userActions";
import { getCurrentUser } from "../../actions/userActions";

export const metadata: Metadata = generateMetadataObject({
title: "Thread Note - ダッシュボード",
Expand Down
16 changes: 16 additions & 0 deletions src/app/(main)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { DashboardNavigation } from "@/features/dashboard/DashboardNavigation";
import { Stack } from "@/shared/components/Stack";
import type React from "react";

export default async function DashboardLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<Stack height="100dvh" sx={{ overflowY: "auto" }}>
<DashboardNavigation />
{children}
</Stack>
);
}
30 changes: 0 additions & 30 deletions src/app/dashboard/layout.tsx

This file was deleted.

File renamed without changes.
5 changes: 4 additions & 1 deletion src/features/threadDetail/PostPaper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ export function PostPaper({ post, isPublicThread }: Props) {
copy(
urlJoin(
window.location.origin,
urls.threadDetails(post.threadId, post.id)
urls.threadDetails({
threadId: post.threadId,
postId: post.id,
})
),
"共有URLをコピーしました"
);
Expand Down
2 changes: 1 addition & 1 deletion src/features/threadDetail/PublicPostPaper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function PublicPostPaper({ post, onClickScrollTarget }: Props) {
copy(
urlJoin(
window.location.origin,
urls.threadDetails(post.threadId, post.id)
urls.threadDetails({ threadId: post.threadId, postId: post.id })
),
"URLをコピーしました"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const ShareInformation = ({
}) => {
const threadDetailUrl = urlJoin(
window.location.origin,
urls.threadDetails(threadId)
urls.threadDetails({ threadId })
);
const { copy } = useClipBoardCopy();

Expand Down
2 changes: 1 addition & 1 deletion src/features/userPage/ThreadList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function PostListItemSkeleton() {

function PostListItem({ thread }: { thread: Thread }) {
return (
<Link href={urls.threadDetails(thread.id)}>
<Link href={urls.threadDetails({ threadId: thread.id })}>
<div className="flex items-center gap-4 p-4 hover:bg-gray-100 cursor-pointer">
<UserIcon userImage={thread.user.image} size={10} />
<div className="flex flex-1 flex-col gap-1 overflow-x-hidden">
Expand Down
9 changes: 7 additions & 2 deletions src/shared/consts/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ export const urls = {
dashboardThreadDetailsExports: (id: string) => `/dashboard/${id}/exports`,
dashboardSettings: (tab: "profile" | "files") =>
`/dashboard/settings?tab=${tab}`,
threadDetails: (id: string, postId?: string) =>
`/${id}${postId ? `#${postId}` : ""}`,
threadDetails: ({
threadId,
postId,
}: {
threadId: string;
postId?: string;
}) => `/users/threads/${threadId}${postId ? `#${postId}` : ""}`,
userDetails: (id: string) => `/users/${id}`,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { z } from 'zod';

export const WorkSpaceScalarFieldEnumSchema = z.enum(['id','ownerId','name','slug','image','createdAt','updatedAt']);

export default WorkSpaceScalarFieldEnumSchema;
1 change: 1 addition & 0 deletions src/types/src/domains/inputTypeSchemas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export { AccountScalarFieldEnumSchema } from './AccountScalarFieldEnumSchema';
export { SessionScalarFieldEnumSchema } from './SessionScalarFieldEnumSchema';
export { VerificationTokenScalarFieldEnumSchema } from './VerificationTokenScalarFieldEnumSchema';
export { AuthenticatorScalarFieldEnumSchema } from './AuthenticatorScalarFieldEnumSchema';
export { WorkSpaceScalarFieldEnumSchema } from './WorkSpaceScalarFieldEnumSchema';
export { ThreadScalarFieldEnumSchema } from './ThreadScalarFieldEnumSchema';
export { PostScalarFieldEnumSchema } from './PostScalarFieldEnumSchema';
export { PlanScalarFieldEnumSchema } from './PlanScalarFieldEnumSchema';
Expand Down
19 changes: 19 additions & 0 deletions src/types/src/domains/modelSchema/WorkSpaceSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { z } from 'zod';

/////////////////////////////////////////
// WORK SPACE SCHEMA
/////////////////////////////////////////

export const WorkSpaceSchema = z.object({
id: z.uuid(),
ownerId: z.string(),
name: z.string(),
slug: z.string(),
image: z.string().nullable(),
createdAt: z.coerce.date(),
updatedAt: z.coerce.date(),
})

export type WorkSpace = z.infer<typeof WorkSpaceSchema>

export default WorkSpaceSchema;
1 change: 1 addition & 0 deletions src/types/src/domains/modelSchema/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export * from './AccountSchema';
export * from './SessionSchema';
export * from './VerificationTokenSchema';
export * from './AuthenticatorSchema';
export * from './WorkSpaceSchema';
export * from './ThreadSchema';
export * from './PostSchema';
export * from './PlanSchema';
Expand Down