Skip to content

Commit f7e10e3

Browse files
committed
Merge remote-tracking branch 'origin/dev' into feature/ms-18
2 parents 8bde5b1 + a433806 commit f7e10e3

File tree

162 files changed

+12873
-3344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+12873
-3344
lines changed

.vscode/settings.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
"source.organizeImports": "always",
1010
"source.fixAll.eslint": "always"
1111
},
12-
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
12+
"eslint.validate": [
13+
"javascript",
14+
"javascriptreact",
15+
"typescript",
16+
"typescriptreact"
17+
],
1318
"jest.runMode": "on-demand",
1419
"git-blame.gitWebUrl": ""
15-
}
20+
}

studio/app/api/models/[model]/data/[file]/route.ts

-18
This file was deleted.
+14-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
import { downloadModelArchive } from "@features/models/queries/downloadModelArchive";
1+
import { getModelArchive } from "@features/models/queries/getModelArchive";
22
import mime from "mime";
33

44
export async function GET(
5-
req: Request,
6-
{ params }: { params: { model: string} }
7-
) {
8-
const fileStream: ReadableStream = await downloadModelArchive(parseInt(params.model));
9-
10-
return new Response(fileStream, {
11-
headers: {
12-
"Content-Type": mime.getType(params.model) ?? "application/octet-stream",
13-
},
14-
});
15-
}
5+
req: Request,
6+
{ params }: { params: { model: string } },
7+
) {
8+
const fileStream: ReadableStream = await getModelArchive(
9+
parseInt(params.model),
10+
);
11+
12+
return new Response(fileStream, {
13+
headers: {
14+
"Content-Type": mime.getType(params.model) ?? "application/octet-stream",
15+
},
16+
});
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import getProjectVersionFile from "@features/projects-versions/queries/getProjectVersionFile";
2+
import mime from "mime";
3+
4+
export async function GET(
5+
req: Request,
6+
{ params }: { params: { version: string } },
7+
) {
8+
const fileStream: ReadableStream = await getProjectVersionFile(
9+
parseInt(params.version),
10+
);
11+
12+
return new Response(fileStream, {
13+
headers: {
14+
"Content-Type":
15+
mime.getType(params.version) ?? "application/octet-stream",
16+
},
17+
});
18+
}
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { createProjectVersion } from "@features/projects-versions/mutations/createProjectVersion";
2+
import { z } from "zod";
3+
import { zfd } from "zod-form-data";
4+
5+
const postSchema = zfd.formData({
6+
file: zfd.file(),
7+
projectId: zfd.numeric(),
8+
});
9+
10+
export async function POST(req: Request) {
11+
try {
12+
const data = postSchema.parse(await req.formData());
13+
const model = await createProjectVersion(data.projectId, data.file);
14+
15+
return Response.json(model, { status: 201 });
16+
} catch (e) {
17+
if (e instanceof z.ZodError) {
18+
return new Response(e.message, { status: 400 });
19+
}
20+
throw e;
21+
}
22+
}

studio/app/page.tsx

+16-12
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
"use client";
22

3-
import { Button, Flex } from "@adobe/react-spectrum";
3+
import { Button, Grid, Heading, View } from "@adobe/react-spectrum";
44
import Link from "next/link";
55

66
export default function Home() {
77
return (
8-
<Flex
9-
direction="column"
8+
<Grid
109
width="100%"
1110
height="100%"
12-
maxWidth="size-6000"
13-
marginX="auto"
1411
gap="size-100"
15-
justifyContent="center"
16-
alignItems="center"
12+
justifyContent="start"
13+
alignItems="start"
1714
>
18-
<h1>Metacity Studio</h1>
19-
<Button href="/projects" variant="accent" elementType={Link}>
20-
Log In
21-
</Button>
22-
</Flex>
15+
<View marginX="size-100">
16+
<Heading level={1}>Metacity Studio</Heading>
17+
<Button
18+
href="/projects"
19+
variant="accent"
20+
style="outline"
21+
elementType={Link}
22+
>
23+
Log In
24+
</Button>
25+
</View>
26+
</Grid>
2327
);
2428
}

studio/app/projects/[projectId].tsx

-20
This file was deleted.
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"use client";
2+
3+
import { Flex, View } from "@adobe/react-spectrum";
4+
import { withPageAuthRequired } from "@auth0/nextjs-auth0/client";
5+
import { withUserEnabled } from "@core/utils/withUserEnabled";
6+
import Editor from "@features/editor/components/Editor";
7+
8+
import EditorHeader from "@features/editor/components/EditorHeader";
9+
import { EditorProvider } from "@features/editor/providers/EditorProvider";
10+
11+
type ProjectPageProps = {
12+
params: {
13+
projectId: string;
14+
};
15+
};
16+
17+
function ProjectPage({ params }: ProjectPageProps) {
18+
const projectId = params.projectId;
19+
const sanitizedId = parseInt(projectId, 10);
20+
21+
return (
22+
<EditorProvider>
23+
<Flex width="100vw" height="100vh" direction="column">
24+
<View gridArea="header" width="100%">
25+
<EditorHeader sanitizedId={sanitizedId} />
26+
</View>
27+
<View gridArea="content" overflow="hidden" width="100%" height="100%">
28+
<Editor projectId={sanitizedId} />
29+
</View>
30+
</Flex>
31+
</EditorProvider>
32+
);
33+
}
34+
35+
export default withPageAuthRequired(withUserEnabled(ProjectPage));

studio/app/projects/page.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,4 @@ function ProjectListPage() {
4848
);
4949
}
5050

51-
<ModelList />;
5251
export default withPageAuthRequired(withUserEnabled(ProjectListPage));

studio/core/components/Empty.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import { Content, Heading, IllustratedMessage } from "@adobe/react-spectrum";
22
import NotFound from "@spectrum-icons/illustrations/NotFound";
33

4-
export const NoData = () => {
4+
type EmptyProps = {
5+
heading?: string;
6+
content?: string;
7+
};
8+
9+
export const NoData = (props: EmptyProps) => {
10+
const { heading = "No Data", content = "Nothing to find here" } = props;
511
return (
612
<IllustratedMessage>
713
<NotFound />
8-
<Heading>No Data</Heading>
9-
<Content>Nothing to find here</Content>
14+
<Heading>{heading}</Heading>
15+
<Content>{content}</Content>
1016
</IllustratedMessage>
1117
);
1218
};

0 commit comments

Comments
 (0)