-
-
{project.title}
-
{moment(project.modified_at).fromNow()}
-
-
+const ProjectActions = React.memo(({ project }: { project: ProjectWithoutContent }) => {
+ return (
+
+
+
{project.title}
+
{moment(project.modified_at).fromNow()}
+
+
- )
- },
-)
+
+ )
+})
ProjectActions.displayName = 'ProjectActions'
diff --git a/utopia-remix/app/store.tsx b/utopia-remix/app/store.tsx
new file mode 100644
index 000000000000..1981bd011fb3
--- /dev/null
+++ b/utopia-remix/app/store.tsx
@@ -0,0 +1,22 @@
+import { create } from 'zustand'
+import { devtools, persist } from 'zustand/middleware'
+import { Category } from './routes/projects'
+
+interface Store {
+ selectedCategory: Category
+ setSelectedCategory: (category: Category) => void
+}
+
+export const useStore = create
()(
+ devtools(
+ persist(
+ (set) => ({
+ selectedCategory: 'allProjects',
+ setSelectedCategory: (category: Category) => set(() => ({ selectedCategory: category })),
+ }),
+ {
+ name: 'store',
+ },
+ ),
+ ),
+)
diff --git a/utopia-remix/package.json b/utopia-remix/package.json
index 9988d3eb7fdd..eef05f99e6c7 100644
--- a/utopia-remix/package.json
+++ b/utopia-remix/package.json
@@ -29,7 +29,8 @@
"react-dom": "18.2.0",
"slugify": "1.6.6",
"tiny-invariant": "1.3.1",
- "url-join": "5.0.0"
+ "url-join": "5.0.0",
+ "zustand": "4.5.0"
},
"devDependencies": {
"@babel/core": "7.23.9",
diff --git a/utopia-remix/pnpm-lock.yaml b/utopia-remix/pnpm-lock.yaml
index 850b68497856..70fa5f8b49f7 100644
--- a/utopia-remix/pnpm-lock.yaml
+++ b/utopia-remix/pnpm-lock.yaml
@@ -42,6 +42,7 @@ specifiers:
ts-node: 10.9.2
typescript: 5.1.6
url-join: 5.0.0
+ zustand: 4.5.0
dependencies:
'@prisma/client': 5.9.0_prisma@5.9.0
@@ -60,6 +61,7 @@ dependencies:
slugify: 1.6.6
tiny-invariant: 1.3.1
url-join: 5.0.0
+ zustand: 4.5.0_j3ahe22lw6ac2w6qvqp4kjqnqy
devDependencies:
'@babel/core': 7.23.9
@@ -8979,6 +8981,14 @@ packages:
tslib: 2.6.2
dev: false
+ /use-sync-external-store/1.2.0_react@18.2.0:
+ resolution: {integrity: sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==}
+ peerDependencies:
+ react: ^16.8.0 || ^17.0.0 || ^18.0.0
+ dependencies:
+ react: 18.2.0
+ dev: false
+
/util-deprecate/1.0.2:
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
dev: true
@@ -9291,6 +9301,26 @@ packages:
engines: {node: '>=10'}
dev: true
+ /zustand/4.5.0_j3ahe22lw6ac2w6qvqp4kjqnqy:
+ resolution: {integrity: sha512-zlVFqS5TQ21nwijjhJlx4f9iGrXSL0o/+Dpy4txAP22miJ8Ti6c1Ol1RLNN98BMib83lmDH/2KmLwaNXpjrO1A==}
+ engines: {node: '>=12.7.0'}
+ peerDependencies:
+ '@types/react': '>=16.8'
+ immer: '>=9.0.6'
+ react: '>=16.8'
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ immer:
+ optional: true
+ react:
+ optional: true
+ dependencies:
+ '@types/react': 18.2.20
+ react: 18.2.0
+ use-sync-external-store: 1.2.0_react@18.2.0
+ dev: false
+
/zwitch/2.0.4:
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
dev: true