diff --git a/backend/.gitignore b/backend/.gitignore new file mode 100644 index 0000000..59dcf2a --- /dev/null +++ b/backend/.gitignore @@ -0,0 +1,5 @@ +CHANGELOG.md +LICENSE.md +*.zip +pocketbase +pb_data/ diff --git a/backend/.pbversion b/backend/.pbversion new file mode 100644 index 0000000..58d8f8d --- /dev/null +++ b/backend/.pbversion @@ -0,0 +1 @@ +0.20.5 \ No newline at end of file diff --git a/backend/package.json b/backend/package.json new file mode 100644 index 0000000..28c2424 --- /dev/null +++ b/backend/package.json @@ -0,0 +1,13 @@ +{ + "name": "backend", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "start": "./pocketbase serve", + "clean-migrations": "rm -rf pb_migrations && ./pocketbase migrate collections" + }, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/backend/pb_hooks/main.pb.js b/backend/pb_hooks/main.pb.js new file mode 100644 index 0000000..f7bcc29 --- /dev/null +++ b/backend/pb_hooks/main.pb.js @@ -0,0 +1,11 @@ +/* eslint-disable */ +/// + +// artwork view hook +onRecordViewRequest((e) => { + const { record } = e; + if (record) { + record.set("views", record.getInt("views") + 1); + $app.dao().saveRecord(record); + } +}, "artworks"); diff --git a/backend/pb_migrations/1704899482_collections_snapshot.js b/backend/pb_migrations/1704899482_collections_snapshot.js new file mode 100644 index 0000000..a23e680 --- /dev/null +++ b/backend/pb_migrations/1704899482_collections_snapshot.js @@ -0,0 +1,161 @@ +/// +migrate((db) => { + const snapshot = [ + { + "id": "_pb_users_auth_", + "created": "2024-01-10 09:29:21.510Z", + "updated": "2024-01-10 09:29:21.511Z", + "name": "users", + "type": "auth", + "system": false, + "schema": [ + { + "system": false, + "id": "users_name", + "name": "name", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "users_avatar", + "name": "avatar", + "type": "file", + "required": false, + "presentable": false, + "unique": false, + "options": { + "mimeTypes": [ + "image/jpeg", + "image/png", + "image/svg+xml", + "image/gif", + "image/webp" + ], + "thumbs": null, + "maxSelect": 1, + "maxSize": 5242880, + "protected": false + } + } + ], + "indexes": [], + "listRule": "id = @request.auth.id", + "viewRule": "id = @request.auth.id", + "createRule": "", + "updateRule": "id = @request.auth.id", + "deleteRule": "id = @request.auth.id", + "options": { + "allowEmailAuth": true, + "allowOAuth2Auth": true, + "allowUsernameAuth": true, + "exceptEmailDomains": null, + "manageRule": null, + "minPasswordLength": 8, + "onlyEmailDomains": null, + "onlyVerified": false, + "requireEmail": false + } + }, + { + "id": "eo6iaxf4pkeqynf", + "created": "2024-01-10 09:34:57.731Z", + "updated": "2024-01-10 15:08:00.292Z", + "name": "artworks", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "p6dor6eo", + "name": "image", + "type": "file", + "required": true, + "presentable": false, + "unique": false, + "options": { + "mimeTypes": [ + "image/png", + "image/jpeg", + "image/gif", + "image/webp", + "image/tiff", + "image/bmp", + "image/svg+xml" + ], + "thumbs": [ + "256x192", + "256x384", + "32x48" + ], + "maxSelect": 1, + "maxSize": 5242880, + "protected": false + } + }, + { + "system": false, + "id": "9w1tjysa", + "name": "artistName", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "lkiiiwrt", + "name": "srcUrl", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "sfh7xwdb", + "name": "views", + "type": "number", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "noDecimal": true + } + } + ], + "indexes": [], + "listRule": "", + "viewRule": "", + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": {} + } + ]; + + const collections = snapshot.map((item) => new Collection(item)); + + return Dao(db).importCollections(collections, true, null); +}, (db) => { + return null; +}) diff --git a/package.json b/package.json index f94e67d..b740948 100644 --- a/package.json +++ b/package.json @@ -17,9 +17,11 @@ "howler": "^2.2.4", "lucide-react": "^0.306.0", "pixi.js": "^7.3.3", + "pocketbase": "^0.20.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-helmet": "^6.1.0", + "react-query": "^3.39.3", "react-router-dom": "^6.21.1", "react-toastify": "^9.1.3", "tailwind-merge": "^2.2.0", diff --git a/src/App.tsx b/src/App.tsx index 802393d..0a38ea8 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,11 +1,17 @@ import { ToastContainer } from "react-toastify"; import Router from "./Router"; import "react-toastify/dist/ReactToastify.css"; +import { QueryClient, QueryClientProvider } from "react-query"; +import { useState } from "react"; const App = () => { + const [queryClient] = useState(new QueryClient()); + return ( <> - + + + > ); diff --git a/src/Router.tsx b/src/Router.tsx index 59e602f..d3958c0 100644 --- a/src/Router.tsx +++ b/src/Router.tsx @@ -5,6 +5,7 @@ import ErrorBoundaryPage from "./pages/errors/error-boundary/page"; const HomePage = lazy(() => import("./pages/home/page")); const MyFurinaPage = lazy(() => import("./pages/my-furina/page")); +const ArtworksPage = lazy(() => import("./pages/artworks/page")); const router = createBrowserRouter([ { @@ -12,6 +13,10 @@ const router = createBrowserRouter([ children: [ { index: true, Component: HomePage }, { path: "/toodle", Component: MyFurinaPage }, + { + path: "/treasures", + children: [{ index: true, Component: ArtworksPage }], + }, ], ErrorBoundary: () => ( diff --git a/src/assets/audio/VO_JA_Furina_Elemental_Burst_03.ogg b/src/assets/audio/VO_JA_Furina_Elemental_Burst_03.ogg new file mode 100644 index 0000000..c3204f9 Binary files /dev/null and b/src/assets/audio/VO_JA_Furina_Elemental_Burst_03.ogg differ diff --git a/src/assets/audio/VO_JA_Furina_Opening_Treasure_Chest_02.ogg b/src/assets/audio/VO_JA_Furina_Opening_Treasure_Chest_02.ogg new file mode 100644 index 0000000..d24936e Binary files /dev/null and b/src/assets/audio/VO_JA_Furina_Opening_Treasure_Chest_02.ogg differ diff --git a/src/components/containers/AppBar.tsx b/src/components/containers/AppBar.tsx index 30b2485..e419b92 100644 --- a/src/components/containers/AppBar.tsx +++ b/src/components/containers/AppBar.tsx @@ -9,7 +9,7 @@ import { cn } from "@/utility/utils"; const AppBar = () => { return ( - + { + @@ -33,7 +34,7 @@ const AppBar = () => { const Navbar = ({ children }: ComponentProps<"div">) => { return ( - + {children} ); @@ -50,7 +51,10 @@ const NavbarItem = ({ path, title, isExact = true }: NavbarItemProps) => { const isActive = isExact ? pathname === path : pathname.startsWith(path); return ( - + { {title} diff --git a/src/components/layouts/MainLayout.tsx b/src/components/layouts/MainLayout.tsx index b2ff806..57544e1 100644 --- a/src/components/layouts/MainLayout.tsx +++ b/src/components/layouts/MainLayout.tsx @@ -17,11 +17,8 @@ const MainLayout = ({ children }: ComponentProps<"div">) => { )} -
{title} diff --git a/src/components/layouts/MainLayout.tsx b/src/components/layouts/MainLayout.tsx index b2ff806..57544e1 100644 --- a/src/components/layouts/MainLayout.tsx +++ b/src/components/layouts/MainLayout.tsx @@ -17,11 +17,8 @@ const MainLayout = ({ children }: ComponentProps<"div">) => { )} -