diff --git a/.env.example b/.env.example index 672842d3c..3f576f728 100644 --- a/.env.example +++ b/.env.example @@ -1,11 +1,9 @@ -# WebApp (`apps/web`) +# Supabase (`apps/backend`) -PUBLIC_GOOGLE_ANALYTICS_ID= - -# Nhost (`apps/nhost`) +SUPABASE_DIRECT_URL=postgresql://postgres:postgres@127.0.0.1:54322/postgres -PUBLIC_NHOST_SUBDOMAIN=local -PUBLIC_NHOST_REGION= +# SvelteKit (`apps/web`) -PUBLIC_GRAPHQL_ENDPOINT=http://localhost:8080/v1/graphql -HASURA_ADMIN_SECRET=nhost-admin-secret +PUBLIC_GOOGLE_ANALYTICS_ID= +PUBLIC_SUPABASE_URL=http://127.0.0.1:54321 +PUBLIC_SUPABASE_ANON_KEY= diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 03ee7431b..000000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - root: true, - extends: ['custom'], -}; diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4ab54b817..a70be8c11 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,9 +41,9 @@ jobs: uses: actions/checkout@v3 - name: Setup pnpm 📦 - uses: pnpm/action-setup@v2.2.4 + uses: pnpm/action-setup@v3 with: - version: 8 + version: 9.0.4 - name: Setup node 🏗 uses: actions/setup-node@v3 @@ -57,10 +57,9 @@ jobs: - name: Run build 🐣 run: pnpm build env: - PUBLIC_NHOST_SUBDOMAIN: ${{ secrets.PUBLIC_NHOST_SUBDOMAIN }} - PUBLIC_NHOST_REGION: ${{ secrets.PUBLIC_NHOST_REGION }} - PUBLIC_GRAPHQL_ENDPOINT: ${{ secrets.PUBLIC_GRAPHQL_ENDPOINT }} - HASURA_ADMIN_SECRET: ${{ secrets.HASURA_ADMIN_SECRET }} + PUBLIC_GOOGLE_ANALYTICS_ID: ${{ secrets.PUBLIC_GOOGLE_ANALYTICS_ID }} + PUBLIC_SUPABASE_URL: ${{ secrets.PUBLIC_SUPABASE_URL }} + PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.PUBLIC_SUPABASE_ANON_KEY }} - name: Run lint 👀 run: pnpm lint diff --git a/.husky/pre-commit b/.husky/pre-commit old mode 100755 new mode 100644 index a01d4e3db..bb76f8424 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,5 +1,2 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -npx lint-staged --concurrent false -npm test +pnpm lint-staged +pnpm test diff --git a/.lintstagedrc.js b/.lintstagedrc.js index 5d8890f27..7a0eef6e4 100644 --- a/.lintstagedrc.js +++ b/.lintstagedrc.js @@ -1,6 +1,7 @@ export default { - '*': ['cspell --no-must-find-files', 'prettier --ignore-unknown --write'], - '*.{js,cjs,mjs,jsx,ts,tsx}': ['eslint --fix'], - '*.svelte': ['markuplint', 'eslint --fix'], - '*.html': ['markuplint'], + '*': ['cspell --no-must-find-files', 'prettier --write --ignore-unknown'], + '*.html': ['markuplint', 'prettier --write'], + '*.css': ['prettier --write'], + '*.{js,cjs,mjs,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'], + '*.svelte': ['markuplint', 'eslint --fix', 'prettier --write'], }; diff --git a/.markuplintrc.cjs b/.markuplintrc.cjs index fee0aea33..750b4a7e0 100644 --- a/.markuplintrc.cjs +++ b/.markuplintrc.cjs @@ -7,7 +7,8 @@ module.exports = { // TODO: Once the overrides option is fixed, remove these lines // ref. https://github.com/markuplint/markuplint/issues/1119 './apps/web/src/app.html', - './apps/web/src/routes/CommentForm.svelte', + // TODO: for Svelte 5 (preview) + './apps/web/**/*.svelte', ], rules: { 'character-reference': false, diff --git a/.npmrc b/.npmrc new file mode 100644 index 000000000..e941d13c2 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-manager-strict=false diff --git a/.prettierignore b/.prettierignore index 8fa73cbf6..bec00dda4 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,24 +1,17 @@ .DS_Store node_modules -/build -/.svelte-kit -/package .env .env.* !.env.example -# Ignore files for PNPM, NPM and YARN +# Ignore files for PNPM pnpm-lock.yaml pnpm-workspace.yaml -package-lock.json -yarn.lock # custom /apps/mockup/public/styles.css -/apps/nhost/.nhost/ -/apps/nhost/nhost/* -!/apps/nhost/nhost/emails/ -/apps/story/storybook-static/ /apps/web/.svelte-kit -/apps/web/$houdini/ -/apps/web/schema.graphql +/apps/web/src/lib/$generated + +# prettier-plugin-svelte (waiting for Svelte 5 support) +*.svelte diff --git a/.prettierignore.root b/.prettierignore.root index 4a781ecf2..5978539d8 100644 --- a/.prettierignore.root +++ b/.prettierignore.root @@ -1,17 +1,12 @@ .DS_Store node_modules -/build -/.svelte-kit -/package .env .env.* !.env.example -# Ignore files for PNPM, NPM and YARN +# Ignore files for PNPM pnpm-lock.yaml pnpm-workspace.yaml -package-lock.json -yarn.lock # custom /apps/ diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index c11e9ff07..000000000 --- a/.prettierrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "singleQuote": true, - "printWidth": 100, - "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], - "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] -} diff --git a/.vscode/settings.json b/.vscode/settings.json index 2107c3cbf..bc911b008 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,15 +2,12 @@ "editor.formatOnSave": true, "prettier.requireConfig": true, "editor.defaultFormatter": "esbenp.prettier-vscode", - "[svelte]": { - "editor.defaultFormatter": "svelte.svelte-vscode" - }, "editor.quickSuggestions": { "strings": true }, "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "eslint.workingDirectories": [{ "mode": "auto" }], - "eslint.validate": ["svelte"] + "eslint.useFlatConfig": true } diff --git a/LICENSE b/LICENSE index 7c0d2cb33..9660662c2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 usagizmo +Copyright (c) 2024 usagizmo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 281fc86e4..c55522a27 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Monorepo template for creating a web application. - [Turborepo](https://turborepo.org/) x [pnpm](https://pnpm.io/) - [Prettier](https://prettier.io/) (w/ [prettier-plugin-svelte](https://github.com/sveltejs/prettier-plugin-svelte) + [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss)) -- [ESLint](https://eslint.org/) (w/ [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import)) / [CSpell](https://cspell.org/) +- [ESLint](https://eslint.org/) / [CSpell](https://cspell.org/) - [lint-staged](https://github.com/okonet/lint-staged) / [husky](https://github.com/typicode/husky) - GitHub Actions (Linting + Testing (Validate `href` and `src` paths)) - Execute `eslint --fix` and `prettier` when saving with VS Code @@ -17,27 +17,21 @@ Monorepo template for creating a web application. #### `apps/` -- [`nhost`](./apps/nhost/) - Local environment test server and production [Nhost](https://nhost.io/) migration. +- [`backend`](./apps/backend/) + A [Supabase](https://supabase.io/) [Local Dev / CLI](https://supabase.com/docs/guides/cli). - [`mockup`](./apps/mockup/) [[Demo](https://webapp-template-mockup.usagizmo.com/)] A starting point for building a static site. [Tailwind CSS](https://tailwindcss.com/) + Vanilla JS + [Vitest](https://vitest.dev/) (Check links + file names) -- [`story`](./apps/story/) - Stories for the Svelte Components. - [Storybook](https://storybook.js.org/) (w/ [Svelte](https://svelte.jp/) + [Tailwind CSS](https://tailwindcss.com/)) - [`web`](./apps/web/) [[Demo](https://webapp-template.usagizmo.com/)] A starting point for building Svelte application. [SvelteKit](https://kit.svelte.dev/) (w/ [Tailwind CSS](https://tailwindcss.com/)) - [Nhost](https://nhost.io/) (w/ [Houdini](https://www.houdinigraphql.com/)) / [Vitest](https://vitest.dev/) + [Supabase](https://supabase.io/) / [Vitest](https://vitest.dev/) #### `packages/` -- `ui` - A stub Svelte component library. -- `tailwind-preset-base` - A preset for use with `tailwind.config.js` and `global.css`. -- `eslint-config-custom` - `eslint` configurations. (w/ [prettier-plugin-svelte](https://github.com/sveltejs/prettier-plugin-svelte) + eslint-config-[[prettier](https://github.com/prettier/eslint-config-prettier)|[turbo](https://www.npmjs.com/package/eslint-config-turbo)]) +- `eslint-config` + ESLint 9 (flat) configuration for JavaScript and TypeScript. + [eslint-plugin-svelte](https://github.com/sveltejs/eslint-plugin-svelte) + [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) ### VS Code Extensions (Recommend) @@ -49,18 +43,39 @@ Monorepo template for creating a web application. ## Breaking changes +### v2.0.0 + +- **Update Framework/Library Versions:** + - Switch to Svelte 5 (integrated with TypeScript and using the Rune compiler) + - Update to Tailwind CSS 4 +- **Backend Change:** + - Replace [Next.js](https://nextjs.org/) with [Supabase](https://supabase.com/) for backend services + +### v1.9.0 + +- **Language and Compiler Changes:** + - Migrated codebase from JavaScript to TypeScript + - Upgraded from Svelte 4 to Svelte 5 (Rune) +- **Package Naming and Structure:** + - Custom package names now prefixed with `@repo/` + - Merged `eslint-config-custom-typescript` into `eslint-config-custom` + ### v1.6.0 -- Change from TypeScript to JavaScript + JSDoc +- **Language Reversion and Documentation:** + - Reverted codebase from TypeScript back to JavaScript, supplementing with JSDoc for documentation ### v1.0.0 -- Change frontend framework (`apps/web`): [Next.js](https://nextjs.org/) → [SvelteKit](https://kit.svelte.jp/) -- Change repository name: `nextjs-template` → `webapp-template` +- **Frontend Framework Change:** + - Switched from [Next.js](https://nextjs.org/) to [SvelteKit](https://kit.svelte.jp/) for the frontend framework in `apps/web` +- **Repository Rebranding:** + - Renamed `nextjs-template` repository to `webapp-template` ### v0.23.0 -- Replace [Firebase](https://firebase.google.com/) (`apps/firebase`) and [Hasura](https://hasura.io/) (`apps/hasura`) apps with [Nhost](https://nhost.io/) (`apps/nhost`) +- **Backend Services Integration:** + - Replaced individual [Firebase](https://firebase.google.com/) and [Hasura](https://hasura.io/) applications with a unified [Nhost](https://nhost.io/) application in `apps/nhost` ## Commands @@ -70,23 +85,23 @@ pnpm i # Resolve dependency packages and prepare .env files pnpm build # Build all apps and packages pnpm dev # Set up file monitoring builds and local servers for development -pnpm lint # eslint + markuplint | prettier --check +pnpm lint # markuplint + eslint + prettier --check pnpm test # Testing pnpm format # eslint --fix + prettier --write + format project-words.txt ``` ## List of listening port numbers -- `1337`: `apps/nhost/` - Hasura - - `3030`: Nhost Dashboard - - `5432`: Postgres - - `8080`: GraphQL Endpoint - - `8025`: MailHog - - `9695`: Hasura Console -- `5173`: `apps/web/` - SvelteKit application -- `6006`: `apps/story/` - Storybook -- `8000`: `apps/mockup/` - Static site -- `49160`: `apps/mockup/` - Express server +- `apps/backend/` - Supabase Local Dev / CLI + - `54321`: API / GraphQL / S3 Storage + - `54322`: DB (Postgres) + - `54323`: Studio + - `54324`: Inbucket +- `apps/web/` - SvelteKit application + - `5173`: Development server +- `apps/mockup/` - Static site + - `8000`: BrowserSync server + - `49160`: Express server ## Registering environment variables for GitHub / Vercel diff --git a/apps/backend/#vscode/extensions.json b/apps/backend/#vscode/extensions.json new file mode 100644 index 000000000..74baffcc4 --- /dev/null +++ b/apps/backend/#vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["denoland.vscode-deno"] +} diff --git a/apps/backend/#vscode/settings.json b/apps/backend/#vscode/settings.json new file mode 100644 index 000000000..85851fc44 --- /dev/null +++ b/apps/backend/#vscode/settings.json @@ -0,0 +1,8 @@ +{ + "deno.enablePaths": ["supabase/functions"], + "deno.lint": true, + "deno.unstable": true, + "[typescript]": { + "editor.defaultFormatter": "denoland.vscode-deno" + } +} diff --git a/apps/backend/README.md b/apps/backend/README.md new file mode 100644 index 000000000..c12b55713 --- /dev/null +++ b/apps/backend/README.md @@ -0,0 +1,11 @@ +# `backend` app + +This app is a [Supabase](https://supabase.io/) [Local Dev / CLI](https://supabase.com/docs/guides/cli). + +## Commands + +```bash +pnpm pull # Pull the latest changes from the supabase server +pnpm start # Start the supabase server +pnpm stop # Stop the supabase server +``` diff --git a/apps/backend/package.json b/apps/backend/package.json new file mode 100644 index 000000000..91d356a80 --- /dev/null +++ b/apps/backend/package.json @@ -0,0 +1,13 @@ +{ + "name": "backend", + "version": "0.0.0", + "type": "module", + "scripts": { + "pull": "supabase db pull --local --schema auth --schema storage", + "start": "supabase start", + "stop": "supabase stop" + }, + "devDependencies": { + "supabase": "^1.163.6" + } +} diff --git a/apps/backend/supabase/.gitignore b/apps/backend/supabase/.gitignore new file mode 100644 index 000000000..a3ad88055 --- /dev/null +++ b/apps/backend/supabase/.gitignore @@ -0,0 +1,4 @@ +# Supabase +.branches +.temp +.env diff --git a/apps/backend/supabase/config.toml b/apps/backend/supabase/config.toml new file mode 100644 index 000000000..797c7a18b --- /dev/null +++ b/apps/backend/supabase/config.toml @@ -0,0 +1,171 @@ +# A string used to distinguish different Supabase projects on the same host. Defaults to the +# working directory name when running `supabase init`. +project_id = "backend" + +[api] +enabled = true +# Port to use for the API URL. +port = 54321 +# Schemas to expose in your API. Tables, views and stored procedures in this schema will get API +# endpoints. `public` is always included. +schemas = ["public", "graphql_public"] +# Extra schemas to add to the search_path of every request. `public` is always included. +extra_search_path = ["public", "extensions"] +# The maximum number of rows returns from a view, table, or stored procedure. Limits payload size +# for accidental or malicious requests. +max_rows = 1000 + +[db] +# Port to use for the local database URL. +port = 54322 +# Port used by db diff command to initialize the shadow database. +shadow_port = 54320 +# The database major version to use. This has to be the same as your remote database's. Run `SHOW +# server_version;` on the remote database to check. +major_version = 15 + +[db.pooler] +enabled = false +# Port to use for the local connection pooler. +port = 54329 +# Specifies when a server connection can be reused by other clients. +# Configure one of the supported pooler modes: `transaction`, `session`. +pool_mode = "transaction" +# How many server connections to allow per user/database pair. +default_pool_size = 20 +# Maximum number of client connections allowed. +max_client_conn = 100 + +[realtime] +enabled = true +# Bind realtime via either IPv4 or IPv6. (default: IPv4) +# ip_version = "IPv6" +# The maximum length in bytes of HTTP request headers. (default: 4096) +# max_header_length = 4096 + +[studio] +enabled = true +# Port to use for Supabase Studio. +port = 54323 +# External URL of the API server that frontend connects to. +api_url = "http://127.0.0.1" +# OpenAI API Key to use for Supabase AI in the Supabase Studio. +openai_api_key = "env(OPENAI_API_KEY)" + +# Email testing server. Emails sent with the local dev setup are not actually sent - rather, they +# are monitored, and you can view the emails that would have been sent from the web interface. +[inbucket] +enabled = true +# Port to use for the email testing server web interface. +port = 54324 +# Uncomment to expose additional ports for testing user applications that send emails. +# smtp_port = 54325 +# pop3_port = 54326 + +[storage] +enabled = true +# The maximum file size allowed (e.g. "5MB", "500KB"). +file_size_limit = "50MiB" + +[storage.image_transformation] +enabled = true + +[auth] +enabled = true +# The base URL of your website. Used as an allow-list for redirects and for constructing URLs used +# in emails. +site_url = "http://127.0.0.1:3000" +# A list of *exact* URLs that auth providers are permitted to redirect to post authentication. +additional_redirect_urls = ["https://127.0.0.1:3000"] +# How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 (1 week). +jwt_expiry = 3600 +# If disabled, the refresh token will never expire. +enable_refresh_token_rotation = true +# Allows refresh tokens to be reused after expiry, up to the specified interval in seconds. +# Requires enable_refresh_token_rotation = true. +refresh_token_reuse_interval = 10 +# Allow/disallow new user signups to your project. +enable_signup = true +# Allow/disallow anonymous sign-ins to your project. +enable_anonymous_sign_ins = false +# Allow/disallow testing manual linking of accounts +enable_manual_linking = false + +[auth.email] +# Allow/disallow new user signups via email to your project. +enable_signup = true +# If enabled, a user will be required to confirm any email change on both the old, and new email +# addresses. If disabled, only the new email is required to confirm. +double_confirm_changes = true +# If enabled, users need to confirm their email address before signing in. +enable_confirmations = false +# Controls the minimum amount of time that must pass before sending another signup confirmation or password reset email. +max_frequency = "1s" + +# Uncomment to customize email template +# [auth.email.template.invite] +# subject = "You have been invited" +# content_path = "./supabase/templates/invite.html" + +[auth.sms] +# Allow/disallow new user signups via SMS to your project. +enable_signup = true +# If enabled, users need to confirm their phone number before signing in. +enable_confirmations = false +# Template for sending OTP to users +template = "Your code is {{ .Code }} ." +# Controls the minimum amount of time that must pass before sending another sms otp. +max_frequency = "5s" + +# Use pre-defined map of phone number to OTP for testing. +# [auth.sms.test_otp] +# 4152127777 = "123456" + +# This hook runs before a token is issued and allows you to add additional claims based on the authentication method used. +# [auth.hook.custom_access_token] +# enabled = true +# uri = "pg-functions:////" + +# Configure one of the supported SMS providers: `twilio`, `twilio_verify`, `messagebird`, `textlocal`, `vonage`. +[auth.sms.twilio] +enabled = false +account_sid = "" +message_service_sid = "" +# DO NOT commit your Twilio auth token to git. Use environment variable substitution instead: +auth_token = "env(SUPABASE_AUTH_SMS_TWILIO_AUTH_TOKEN)" + +# Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`, +# `discord`, `facebook`, `github`, `gitlab`, `google`, `keycloak`, `linkedin_oidc`, `notion`, `twitch`, +# `twitter`, `slack`, `spotify`, `workos`, `zoom`. +[auth.external.apple] +enabled = false +client_id = "" +# DO NOT commit your OAuth provider secret to git. Use environment variable substitution instead: +secret = "env(SUPABASE_AUTH_EXTERNAL_APPLE_SECRET)" +# Overrides the default auth redirectUrl. +redirect_uri = "" +# Overrides the default auth provider URL. Used to support self-hosted gitlab, single-tenant Azure, +# or any other third-party OIDC providers. +url = "" +# If enabled, the nonce check will be skipped. Required for local sign in with Google auth. +skip_nonce_check = false + +[analytics] +enabled = false +port = 54327 +vector_port = 54328 +# Configure one of the supported backends: `postgres`, `bigquery`. +backend = "postgres" + +# Experimental features may be deprecated any time +[experimental] +# Configures Postgres storage engine to use OrioleDB (S3) +orioledb_version = "" +# Configures S3 bucket URL, eg. .s3-.amazonaws.com +s3_host = "env(S3_HOST)" +# Configures S3 bucket region, eg. us-east-1 +s3_region = "env(S3_REGION)" +# Configures AWS_ACCESS_KEY_ID for S3 bucket +s3_access_key = "env(S3_ACCESS_KEY)" +# Configures AWS_SECRET_ACCESS_KEY for S3 bucket +s3_secret_key = "env(S3_SECRET_KEY)" diff --git a/apps/backend/supabase/migrations/20240426100620_remote_schema.sql b/apps/backend/supabase/migrations/20240426100620_remote_schema.sql new file mode 100644 index 000000000..62c40f133 --- /dev/null +++ b/apps/backend/supabase/migrations/20240426100620_remote_schema.sql @@ -0,0 +1,143 @@ + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +CREATE EXTENSION IF NOT EXISTS "pg_net" WITH SCHEMA "extensions"; + +CREATE EXTENSION IF NOT EXISTS "pgsodium" WITH SCHEMA "pgsodium"; + +COMMENT ON SCHEMA "public" IS 'standard public schema'; + +CREATE EXTENSION IF NOT EXISTS "pg_graphql" WITH SCHEMA "graphql"; + +CREATE EXTENSION IF NOT EXISTS "pg_stat_statements" WITH SCHEMA "extensions"; + +CREATE EXTENSION IF NOT EXISTS "pgcrypto" WITH SCHEMA "extensions"; + +CREATE EXTENSION IF NOT EXISTS "pgjwt" WITH SCHEMA "extensions"; + +CREATE EXTENSION IF NOT EXISTS "supabase_vault" WITH SCHEMA "vault"; + +CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA "extensions"; + +CREATE OR REPLACE FUNCTION "public"."handle_new_user"() RETURNS "trigger" + LANGUAGE "plpgsql" SECURITY DEFINER + AS $$BEGIN + INSERT INTO public.profiles (id, email, bio, display_name) + VALUES (NEW.id, NEW.email, '', NEW.raw_user_meta_data->>'display_name'); + RETURN NEW; +END;$$; + +ALTER FUNCTION "public"."handle_new_user"() OWNER TO "postgres"; + +SET default_tablespace = ''; + +SET default_table_access_method = "heap"; + +CREATE TABLE IF NOT EXISTS "public"."comments" ( + "id" bigint NOT NULL, + "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, + "text" "text" DEFAULT ''::"text" NOT NULL, + "user_id" "uuid" NOT NULL, + "file_path" "text" +); + +ALTER TABLE "public"."comments" OWNER TO "postgres"; + +ALTER TABLE "public"."comments" ALTER COLUMN "id" ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME "public"."comments_id_seq" + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + +CREATE TABLE IF NOT EXISTS "public"."profiles" ( + "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, + "bio" "text" DEFAULT ''::"text" NOT NULL, + "display_name" "text" DEFAULT ''::"text" NOT NULL, + "email" character varying NOT NULL, + "id" "uuid" NOT NULL +); + +ALTER TABLE "public"."profiles" OWNER TO "postgres"; + +ALTER TABLE ONLY "public"."comments" + ADD CONSTRAINT "comments_pkey" PRIMARY KEY ("id"); + +ALTER TABLE ONLY "public"."profiles" + ADD CONSTRAINT "profiles_email_key" UNIQUE ("email"); + +ALTER TABLE ONLY "public"."profiles" + ADD CONSTRAINT "profiles_pkey" PRIMARY KEY ("id"); + +ALTER TABLE ONLY "public"."comments" + ADD CONSTRAINT "public_comments_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "public"."profiles"("id") ON UPDATE CASCADE ON DELETE CASCADE; + +ALTER TABLE ONLY "public"."profiles" + ADD CONSTRAINT "public_profiles_user_id_fkey" FOREIGN KEY ("id") REFERENCES "auth"."users"("id") ON UPDATE CASCADE ON DELETE CASCADE; + +CREATE POLICY "Enable delete for users based on user_id" ON "public"."comments" FOR DELETE USING (("auth"."uid"() = "user_id")); + +CREATE POLICY "Enable insert for users based on user_id" ON "public"."comments" FOR INSERT WITH CHECK (("auth"."uid"() = "user_id")); + +CREATE POLICY "Enable read access for all users" ON "public"."comments" FOR SELECT USING (true); + +CREATE POLICY "Enable read access for all users" ON "public"."profiles" FOR SELECT USING (true); + +CREATE POLICY "Enable update for users based on id" ON "public"."profiles" FOR UPDATE USING (("auth"."uid"() = "id")) WITH CHECK (("auth"."uid"() = "id")); + +CREATE POLICY "Enable update for users based on user_id" ON "public"."comments" FOR UPDATE USING (("auth"."uid"() = "user_id")) WITH CHECK (("auth"."uid"() = "user_id")); + +ALTER TABLE "public"."comments" ENABLE ROW LEVEL SECURITY; + +ALTER TABLE "public"."profiles" ENABLE ROW LEVEL SECURITY; + +ALTER PUBLICATION "supabase_realtime" OWNER TO "postgres"; + +GRANT USAGE ON SCHEMA "public" TO "postgres"; +GRANT USAGE ON SCHEMA "public" TO "anon"; +GRANT USAGE ON SCHEMA "public" TO "authenticated"; +GRANT USAGE ON SCHEMA "public" TO "service_role"; + +GRANT ALL ON FUNCTION "public"."handle_new_user"() TO "anon"; +GRANT ALL ON FUNCTION "public"."handle_new_user"() TO "authenticated"; +GRANT ALL ON FUNCTION "public"."handle_new_user"() TO "service_role"; + +GRANT ALL ON TABLE "public"."comments" TO "anon"; +GRANT ALL ON TABLE "public"."comments" TO "authenticated"; +GRANT ALL ON TABLE "public"."comments" TO "service_role"; + +GRANT ALL ON SEQUENCE "public"."comments_id_seq" TO "anon"; +GRANT ALL ON SEQUENCE "public"."comments_id_seq" TO "authenticated"; +GRANT ALL ON SEQUENCE "public"."comments_id_seq" TO "service_role"; + +GRANT ALL ON TABLE "public"."profiles" TO "anon"; +GRANT ALL ON TABLE "public"."profiles" TO "authenticated"; +GRANT ALL ON TABLE "public"."profiles" TO "service_role"; + +ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "postgres"; +ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "anon"; +ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "authenticated"; +ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "service_role"; + +ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "postgres"; +ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "anon"; +ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "authenticated"; +ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "service_role"; + +ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "postgres"; +ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "anon"; +ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "authenticated"; +ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "service_role"; + +RESET ALL; diff --git a/apps/backend/supabase/migrations/20240426100623_remote_schema.sql b/apps/backend/supabase/migrations/20240426100623_remote_schema.sql new file mode 100644 index 000000000..1abc00816 --- /dev/null +++ b/apps/backend/supabase/migrations/20240426100623_remote_schema.sql @@ -0,0 +1,28 @@ +CREATE TRIGGER on_auth_user_created AFTER INSERT ON auth.users FOR EACH ROW EXECUTE FUNCTION handle_new_user(); + + +create policy "Give all users access" +on "storage"."objects" +as permissive +for select +to public +using ((bucket_id = 'comments'::text)); + + +create policy "Give users access to own folder (DELETE)" +on "storage"."objects" +as permissive +for delete +to public +using (((bucket_id = 'comments'::text) AND ((auth.uid())::text = (storage.foldername(name))[1]))); + + +create policy "Give users access to own folder" +on "storage"."objects" +as permissive +for insert +to public +with check (((bucket_id = 'comments'::text) AND ((auth.uid())::text = (storage.foldername(name))[1]))); + + + diff --git a/apps/nhost/.env.development b/apps/backend/supabase/seed.sql similarity index 100% rename from apps/nhost/.env.development rename to apps/backend/supabase/seed.sql diff --git a/apps/mockup/.eslintrc.cjs b/apps/mockup/.eslintrc.cjs deleted file mode 100644 index 03ee7431b..000000000 --- a/apps/mockup/.eslintrc.cjs +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - root: true, - extends: ['custom'], -}; diff --git a/apps/mockup/README.md b/apps/mockup/README.md index faed0aa7c..7609db400 100644 --- a/apps/mockup/README.md +++ b/apps/mockup/README.md @@ -8,7 +8,7 @@ A starting point for building a static site. ```bash pnpm build # Output `public/styles.css` -pnpm dev # Watch input.css and launch browser-sync server on port 8000 +pnpm dev # Watch app.css and launch browser-sync server on port 8000 pnpm lint # markuplint + cspell pnpm test # Check links (href/src) + image file names pnpm format # Format with `prettier` diff --git a/apps/mockup/app.css b/apps/mockup/app.css new file mode 100644 index 000000000..f36b290c6 --- /dev/null +++ b/apps/mockup/app.css @@ -0,0 +1,14 @@ +/* ref. https://tailwindcss.com/blog/tailwindcss-v4-alpha */ +@import 'tailwindcss'; + +@theme { + /* --font-family-sans: YakuHanJP, Noto Sans JP, sans-serif; + --font-family-sans: -apple-system, blinkMacSystemFont, Helvetica, 'Yu Gothic', YuGothic, + 'BIZ UDPGothic', Meiryo, sans-serif; + --font-family-sans: -apple-system, blinkMacSystemFont, Helvetica, 'Hiragino Sans', + 'Hiragino Kaku Gothic ProN', 'BIZ UDPGothic', Meiryo, sans-serif; + --font-family-serif: 'Yu Mincho', YuMincho, 'Hiragino Mincho ProN', serif; */ + --font-family-sans: Inter, YakuHanJP, Noto Sans JP, sans-serif; + --font-family-mono: Source Code Pro, monospace; + --font-family-keycode: Lucida Grande; +} diff --git a/apps/mockup/eslint.config.js b/apps/mockup/eslint.config.js new file mode 100644 index 000000000..470363221 --- /dev/null +++ b/apps/mockup/eslint.config.js @@ -0,0 +1,3 @@ +import config from '@repo/eslint-config'; + +export default [...config]; diff --git a/apps/mockup/package.json b/apps/mockup/package.json index a50b2d347..df43eee1a 100644 --- a/apps/mockup/package.json +++ b/apps/mockup/package.json @@ -3,30 +3,30 @@ "version": "0.0.0", "type": "module", "scripts": { - "build": "tailwindcss -i ../../packages/tailwind-preset-base/global.css -o ./public/styles.css --minify", - "dev:tailwind": "tailwindcss ../../packages/tailwind-preset-base/global.css -o ./public/styles.css --watch", - "dev:server": "browser-sync ./public/ -w --port 8000", + "build": "tailwindcss -i ./app.css -o ./public/styles.css --minify", + "dev:tailwind": "tailwindcss -i ./app.css -o ./public/styles.css --watch", + "dev:server": "browser-sync start --server './public/' --files './public/' --startPath '/' --port 8000", "dev": "concurrently pnpm:dev:*", "lint:markup": "markuplint --config ../../.markuplintrc.cjs \"**\"", "lint:js": "eslint .", "lint:cspell": "cspell \"**\"", - "lint:prettier": "prettier --check --ignore-path=../../.prettierignore .", + "lint:prettier": "prettier . --check --ignore-path=../../.prettierignore", "lint": "concurrently pnpm:lint:*", "test:watch": "vitest", "test": "vitest run", "format:js": "eslint --fix .", - "format:prettier": "prettier --write --ignore-path=../../.prettierignore .", + "format:prettier": "prettier . --write --ignore-path=../../.prettierignore", "format": "concurrently pnpm:format:*", "add-size-to-img": "node ./commands/add-size-to-img.js", "clean-image": "./commands/clean-image.sh", "deploy": "./commands/deploy.sh" }, "devDependencies": { + "@repo/eslint-config": "workspace:*", + "@tailwindcss/cli": "4.0.0-alpha.14", "browser-sync": "^3.0.2", - "eslint-config-custom": "workspace:*", - "image-size": "^1.1.0", - "tailwind-preset-base": "workspace:*", - "tailwindcss": "^3.4.0", - "vitest": "^1.1.0" + "image-size": "^1.1.1", + "tailwindcss": "4.0.0-alpha.14", + "vitest": "^1.5.2" } } diff --git a/apps/mockup/public/apple-touch-icon.png b/apps/mockup/public/apple-touch-icon.png index 8552622a6..b3ce78f8a 100644 Binary files a/apps/mockup/public/apple-touch-icon.png and b/apps/mockup/public/apple-touch-icon.png differ diff --git a/apps/mockup/public/images/ogp.png b/apps/mockup/public/images/ogp.png index ce6526c97..8a2c3a70c 100644 Binary files a/apps/mockup/public/images/ogp.png and b/apps/mockup/public/images/ogp.png differ diff --git a/apps/mockup/public/index.html b/apps/mockup/public/index.html index f226a9da0..d1e552535 100644 --- a/apps/mockup/public/index.html +++ b/apps/mockup/public/index.html @@ -1,8 +1,8 @@ - + - + WebApp Template (mockup) @@ -27,7 +27,7 @@ - +
WebApp Template (mockup) -

+

A starting point for building a static site.

@@ -52,7 +52,7 @@

GitHub @@ -60,17 +60,17 @@

+
- +

What's inside?

-
+

Uses

>
  • Uses )
  • Uses class="font-semibold text-blue-500" >ESLint - (w/ - - ) / + / Uses >
  • Uses >
  • GitHub Actions (
      @@ -186,7 +174,7 @@

      Uses

      )
    • Execute `eslint --fix` and `prettier` when saving with VS @@ -203,27 +191,33 @@

      Apps and Packages

      apps/

    • - story
      - Stories for the Svelte Components.
      - Storybook - (w/ - - ) -
    • -
    • web
      A starting point for building Svelte application.
      @@ -324,23 +283,11 @@

      apps/

      NhostSupabase - (w/ - - ) / + / apps/

      packages/

      @@ -426,7 +350,7 @@

      Commands

      pnpm build # Build all apps and packages pnpm dev # Set up file monitoring builds and local servers for development -pnpm lint # eslint + markuplint | prettier --check +pnpm lint # markuplint + eslint + prettier --check pnpm test # Testing pnpm format # eslint --fix + prettier --write + format project-words.txt @@ -436,7 +360,7 @@

      Commands

      href="https://github.com/usagizmo/webapp-template" target="_blank" rel="noopener noreferrer" - class="flex rounded-md bg-zinc-900 px-5 py-2 text-sm text-white hover:bg-opacity-80" + class="hover:bg-opacity-80 flex rounded-md bg-zinc-900 py-2 px-5 text-sm text-white" > GitHub diff --git a/apps/mockup/tailwind.config.js b/apps/mockup/tailwind.config.js deleted file mode 100644 index 82e7b6cce..000000000 --- a/apps/mockup/tailwind.config.js +++ /dev/null @@ -1,7 +0,0 @@ -import base from 'tailwind-preset-base'; - -/** @type {import('tailwindcss').Config} */ -export default { - presets: [base], - content: ['./public/**/*.{html,js}'], -}; diff --git a/apps/mockup/tests/external-links.txt b/apps/mockup/tests/external-links.txt index a0199e482..0b71e1fa9 100644 --- a/apps/mockup/tests/external-links.txt +++ b/apps/mockup/tests/external-links.txt @@ -2,26 +2,23 @@ https://cdn.jsdelivr.net/npm/yakuhanjp@4.0.0/dist/css/yakuhanjp.css https://cspell.org/ https://eslint.org https://fonts.googleapis.com -https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+JP:wght@400;500;700&family=Source+Code+Pro:wght@400;500;600;700&display=swap +https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+JP:wght@400;500;700&family=Source+Code+Pro:wght@400;500;600;700&display=swap https://fonts.gstatic.com -https://github.com/import-js/eslint-plugin-import https://github.com/okonet/lint-staged https://github.com/prettier/eslint-config-prettier +https://github.com/sveltejs/eslint-plugin-svelte https://github.com/sveltejs/prettier-plugin-svelte https://github.com/tailwindlabs/prettier-plugin-tailwindcss https://github.com/typicode/husky https://github.com/usagizmo/webapp-template https://kit.svelte.dev/ -https://nhost.io/ https://pnpm.io/ https://prettier.io/ -https://storybook.js.org/ -https://svelte.jp/ +https://supabase.com/docs/guides/cli +https://supabase.io/ https://tailwindcss.com https://tailwindcss.com/ https://turborepo.org/ https://usagizmo.com https://vitest.dev/ -https://webapp-template-mockup.usagizmo.com -https://www.houdinigraphql.com/ -https://www.npmjs.com/package/eslint-config-turbo \ No newline at end of file +https://webapp-template-mockup.usagizmo.com \ No newline at end of file diff --git a/apps/nhost/.gitignore b/apps/nhost/.gitignore deleted file mode 100644 index 7737d1667..000000000 --- a/apps/nhost/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.nhost -web/node_modules -node_modules -functions/node_modules diff --git a/apps/nhost/README.md b/apps/nhost/README.md deleted file mode 100644 index d495167c7..000000000 --- a/apps/nhost/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# `nhost` app - -> The Open Source Firebase Alternative with GraphQL -> Make backend easy. Never manage infrastructure -> Database / GraphQL API / Authentication / Storage / Serverless Functions - -ref: https://nhost.io/ - -## Commands - -```bash -pnpm dev # Launch Nhost dev server -pnpm lint # markuplint the contents of email -pnpm format # Format with `prettier` -``` - -## Local **sign up** process - -Once you have signed up, check your email to MailHog. -http://localhost:8025/ - -## Reset local database - -Delete `apps/nhost/.nhost` and start the dev server again with `pnpm dev`. - -## (Nhost) Production settings - -- Deployment Branch: `main` -- Base Directory: `./apps/nhost/` diff --git a/apps/nhost/nhost/config.yaml b/apps/nhost/nhost/config.yaml deleted file mode 100644 index 8c7d27128..000000000 --- a/apps/nhost/nhost/config.yaml +++ /dev/null @@ -1,137 +0,0 @@ -metadata_directory: metadata -services: - hasura: - environment: - hasura_graphql_enable_remote_schema_permissions: false - minio: - environment: - minio_root_password: minioaccesskey123123 - minio_root_user: minioaccesskey123123 - postgres: - environment: - postgres_password: postgres - postgres_user: postgres -auth: - access_control: - email: - allowed_email_domains: "" - allowed_emails: "" - blocked_email_domains: "" - blocked_emails: "" - url: - allowed_redirect_urls: "" - anonymous_users_enabled: false - client_url: http://localhost:3000 - disable_new_users: false - email: - enabled: false - passwordless: - enabled: false - signin_email_verified_required: true - template_fetch_url: "" - gravatar: - default: "" - enabled: true - rating: "" - locale: - allowed: en - default: en - password: - hibp_enabled: false - min_length: 3 - provider: - apple: - client_id: "" - enabled: false - key_id: "" - private_key: "" - scope: name,email - team_id: "" - bitbucket: - client_id: "" - client_secret: "" - enabled: false - facebook: - client_id: "" - client_secret: "" - enabled: false - scope: email,photos,displayName - github: - client_id: "" - client_secret: "" - enabled: false - scope: user:email - token_url: "" - user_profile_url: "" - gitlab: - base_url: "" - client_id: "" - client_secret: "" - enabled: false - scope: read_user - google: - client_id: "" - client_secret: "" - enabled: false - scope: email,profile - linkedin: - client_id: "" - client_secret: "" - enabled: false - scope: r_emailaddress,r_liteprofile - spotify: - client_id: "" - client_secret: "" - enabled: false - scope: user-read-email,user-read-private - strava: - client_id: "" - client_secret: "" - enabled: false - twilio: - account_sid: "" - auth_token: "" - enabled: false - messaging_service_id: "" - twitter: - consumer_key: "" - consumer_secret: "" - enabled: false - windows_live: - client_id: "" - client_secret: "" - enabled: false - scope: wl.basic,wl.emails,wl.contacts_emails - sms: - enabled: false - passwordless: - enabled: false - provider: - twilio: - account_sid: "" - auth_token: "" - from: "" - messaging_service_id: "" - smtp: - host: mailhog - method: "" - pass: password - port: 1025 - secure: false - sender: hasura-auth@example.com - user: user - token: - access: - expires_in: 900 - refresh: - expires_in: 43200 - user: - allowed_roles: user,me - default_allowed_roles: user,me - default_role: user - mfa: - enabled: false - issuer: nhost -storage: - force_download_for_content_types: text/html,application/javascript -version: 3 diff --git a/apps/nhost/nhost/emails/en/email-confirm-change/body.html b/apps/nhost/nhost/emails/en/email-confirm-change/body.html deleted file mode 100644 index eb98d2119..000000000 --- a/apps/nhost/nhost/emails/en/email-confirm-change/body.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Confirm Email Change - - - -

      Confirm Email Change

      -

      Use this link to confirm changing email:

      -

      - Change email -

      - - diff --git a/apps/nhost/nhost/emails/en/email-confirm-change/subject.txt b/apps/nhost/nhost/emails/en/email-confirm-change/subject.txt deleted file mode 100644 index 1711dad88..000000000 --- a/apps/nhost/nhost/emails/en/email-confirm-change/subject.txt +++ /dev/null @@ -1 +0,0 @@ -Change your email address \ No newline at end of file diff --git a/apps/nhost/nhost/emails/en/email-verify/body.html b/apps/nhost/nhost/emails/en/email-verify/body.html deleted file mode 100644 index 0f22ed75f..000000000 --- a/apps/nhost/nhost/emails/en/email-verify/body.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Verify Email - - - -

      Verify Email

      -

      Use this link to verify your email:

      -

      - Verify Email -

      - - diff --git a/apps/nhost/nhost/emails/en/email-verify/subject.txt b/apps/nhost/nhost/emails/en/email-verify/subject.txt deleted file mode 100644 index ef490a8bc..000000000 --- a/apps/nhost/nhost/emails/en/email-verify/subject.txt +++ /dev/null @@ -1 +0,0 @@ -Verify your email \ No newline at end of file diff --git a/apps/nhost/nhost/emails/en/password-reset/body.html b/apps/nhost/nhost/emails/en/password-reset/body.html deleted file mode 100644 index 612e56dcf..000000000 --- a/apps/nhost/nhost/emails/en/password-reset/body.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Reset Password - - - -

      Reset Password

      -

      Use this link to reset your password:

      -

      - Reset password -

      - - diff --git a/apps/nhost/nhost/emails/en/password-reset/subject.txt b/apps/nhost/nhost/emails/en/password-reset/subject.txt deleted file mode 100644 index e21496754..000000000 --- a/apps/nhost/nhost/emails/en/password-reset/subject.txt +++ /dev/null @@ -1 +0,0 @@ -Reset your password \ No newline at end of file diff --git a/apps/nhost/nhost/emails/en/signin-passwordless-sms/body.txt b/apps/nhost/nhost/emails/en/signin-passwordless-sms/body.txt deleted file mode 100644 index f03ec5b88..000000000 --- a/apps/nhost/nhost/emails/en/signin-passwordless-sms/body.txt +++ /dev/null @@ -1 +0,0 @@ -Your code is ${code}. \ No newline at end of file diff --git a/apps/nhost/nhost/emails/en/signin-passwordless/body.html b/apps/nhost/nhost/emails/en/signin-passwordless/body.html deleted file mode 100644 index ecda70ea8..000000000 --- a/apps/nhost/nhost/emails/en/signin-passwordless/body.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Magic Link - - - -

      Magic Link

      -

      Use this link to securely sign in:

      -

      - Sign In -

      - - diff --git a/apps/nhost/nhost/emails/en/signin-passwordless/subject.txt b/apps/nhost/nhost/emails/en/signin-passwordless/subject.txt deleted file mode 100644 index 8d0ee0119..000000000 --- a/apps/nhost/nhost/emails/en/signin-passwordless/subject.txt +++ /dev/null @@ -1 +0,0 @@ -Secure sign-in link \ No newline at end of file diff --git a/apps/nhost/nhost/emails/fr/email-confirm-change/body.html b/apps/nhost/nhost/emails/fr/email-confirm-change/body.html deleted file mode 100644 index 4592018c8..000000000 --- a/apps/nhost/nhost/emails/fr/email-confirm-change/body.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Confirmer changement de courriel - - - -

      Confirmer changement de courriel

      -

      Utilisez ce lien pour confirmer le changement de courriel:

      -

      - Changer courriel -

      - - diff --git a/apps/nhost/nhost/emails/fr/email-confirm-change/subject.txt b/apps/nhost/nhost/emails/fr/email-confirm-change/subject.txt deleted file mode 100644 index 1e12b4b4d..000000000 --- a/apps/nhost/nhost/emails/fr/email-confirm-change/subject.txt +++ /dev/null @@ -1 +0,0 @@ -Changez votre adresse courriel diff --git a/apps/nhost/nhost/emails/fr/email-verify/body.html b/apps/nhost/nhost/emails/fr/email-verify/body.html deleted file mode 100644 index e2b0d870c..000000000 --- a/apps/nhost/nhost/emails/fr/email-verify/body.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Vérifiez votre courriel - - - -

      Vérifiez votre courriel

      -

      Utilisez ce lien pour vérifier votre courriel:

      -

      - Vérifier courriel -

      - - diff --git a/apps/nhost/nhost/emails/fr/email-verify/subject.txt b/apps/nhost/nhost/emails/fr/email-verify/subject.txt deleted file mode 100644 index 540cc1800..000000000 --- a/apps/nhost/nhost/emails/fr/email-verify/subject.txt +++ /dev/null @@ -1 +0,0 @@ -Vérifier votre courriel diff --git a/apps/nhost/nhost/emails/fr/password-reset/body.html b/apps/nhost/nhost/emails/fr/password-reset/body.html deleted file mode 100644 index a1f3fe82c..000000000 --- a/apps/nhost/nhost/emails/fr/password-reset/body.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Réinitializer votre mot de passe - - - -

      Réinitializer votre mot de passe

      -

      Utilisez ce lien pour réinitializer votre mot de passe:

      -

      - Réinitializer mot de passe -

      - - diff --git a/apps/nhost/nhost/emails/fr/password-reset/subject.txt b/apps/nhost/nhost/emails/fr/password-reset/subject.txt deleted file mode 100644 index 5c2caa35b..000000000 --- a/apps/nhost/nhost/emails/fr/password-reset/subject.txt +++ /dev/null @@ -1 +0,0 @@ -Réinitialiser votre mot de passe diff --git a/apps/nhost/nhost/emails/fr/signin-passwordless-sms/body.txt b/apps/nhost/nhost/emails/fr/signin-passwordless-sms/body.txt deleted file mode 100644 index 72d6ab249..000000000 --- a/apps/nhost/nhost/emails/fr/signin-passwordless-sms/body.txt +++ /dev/null @@ -1 +0,0 @@ -Votre code est ${code}. \ No newline at end of file diff --git a/apps/nhost/nhost/emails/fr/signin-passwordless/body.html b/apps/nhost/nhost/emails/fr/signin-passwordless/body.html deleted file mode 100644 index 8d8b09b6a..000000000 --- a/apps/nhost/nhost/emails/fr/signin-passwordless/body.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Lien magique - - - -

      Lien magique

      -

      Utilisez ce lien pour vous connecter de façon sécuritaire:

      -

      - Connexion -

      - - diff --git a/apps/nhost/nhost/emails/fr/signin-passwordless/subject.txt b/apps/nhost/nhost/emails/fr/signin-passwordless/subject.txt deleted file mode 100644 index dc2d81026..000000000 --- a/apps/nhost/nhost/emails/fr/signin-passwordless/subject.txt +++ /dev/null @@ -1 +0,0 @@ -Lien de connexion sécurisé diff --git a/apps/nhost/nhost/metadata/actions.graphql b/apps/nhost/nhost/metadata/actions.graphql deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/nhost/nhost/metadata/actions.yaml b/apps/nhost/nhost/metadata/actions.yaml deleted file mode 100644 index 1edb4c2ff..000000000 --- a/apps/nhost/nhost/metadata/actions.yaml +++ /dev/null @@ -1,6 +0,0 @@ -actions: [] -custom_types: - enums: [] - input_objects: [] - objects: [] - scalars: [] diff --git a/apps/nhost/nhost/metadata/allow_list.yaml b/apps/nhost/nhost/metadata/allow_list.yaml deleted file mode 100644 index fe51488c7..000000000 --- a/apps/nhost/nhost/metadata/allow_list.yaml +++ /dev/null @@ -1 +0,0 @@ -[] diff --git a/apps/nhost/nhost/metadata/api_limits.yaml b/apps/nhost/nhost/metadata/api_limits.yaml deleted file mode 100644 index 0967ef424..000000000 --- a/apps/nhost/nhost/metadata/api_limits.yaml +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/apps/nhost/nhost/metadata/cron_triggers.yaml b/apps/nhost/nhost/metadata/cron_triggers.yaml deleted file mode 100644 index fe51488c7..000000000 --- a/apps/nhost/nhost/metadata/cron_triggers.yaml +++ /dev/null @@ -1 +0,0 @@ -[] diff --git a/apps/nhost/nhost/metadata/databases/databases.yaml b/apps/nhost/nhost/metadata/databases/databases.yaml deleted file mode 100644 index f89c9e40f..000000000 --- a/apps/nhost/nhost/metadata/databases/databases.yaml +++ /dev/null @@ -1,14 +0,0 @@ -- name: default - kind: postgres - configuration: - connection_info: - database_url: - from_env: HASURA_GRAPHQL_DATABASE_URL - isolation_level: read-committed - pool_settings: - connection_lifetime: 600 - idle_timeout: 60 - max_connections: 10 - retries: 1 - use_prepared_statements: true - tables: "!include default/tables/tables.yaml" diff --git a/apps/nhost/nhost/metadata/databases/default/tables/auth_provider_requests.yaml b/apps/nhost/nhost/metadata/databases/default/tables/auth_provider_requests.yaml deleted file mode 100644 index 91ba1967d..000000000 --- a/apps/nhost/nhost/metadata/databases/default/tables/auth_provider_requests.yaml +++ /dev/null @@ -1,23 +0,0 @@ -table: - name: provider_requests - schema: auth -configuration: - column_config: - id: - custom_name: id - options: - custom_name: options - custom_column_names: - id: id - options: options - custom_name: authProviderRequests - custom_root_fields: - delete: deleteAuthProviderRequests - delete_by_pk: deleteAuthProviderRequest - insert: insertAuthProviderRequests - insert_one: insertAuthProviderRequest - select: authProviderRequests - select_aggregate: authProviderRequestsAggregate - select_by_pk: authProviderRequest - update: updateAuthProviderRequests - update_by_pk: updateAuthProviderRequest diff --git a/apps/nhost/nhost/metadata/databases/default/tables/auth_providers.yaml b/apps/nhost/nhost/metadata/databases/default/tables/auth_providers.yaml deleted file mode 100644 index 3de528dc9..000000000 --- a/apps/nhost/nhost/metadata/databases/default/tables/auth_providers.yaml +++ /dev/null @@ -1,28 +0,0 @@ -table: - name: providers - schema: auth -configuration: - column_config: - id: - custom_name: id - custom_column_names: - id: id - custom_name: authProviders - custom_root_fields: - delete: deleteAuthProviders - delete_by_pk: deleteAuthProvider - insert: insertAuthProviders - insert_one: insertAuthProvider - select: authProviders - select_aggregate: authProvidersAggregate - select_by_pk: authProvider - update: updateAuthProviders - update_by_pk: updateAuthProvider -array_relationships: - - name: userProviders - using: - foreign_key_constraint_on: - column: provider_id - table: - name: user_providers - schema: auth diff --git a/apps/nhost/nhost/metadata/databases/default/tables/auth_refresh_tokens.yaml b/apps/nhost/nhost/metadata/databases/default/tables/auth_refresh_tokens.yaml deleted file mode 100644 index e9152dfb3..000000000 --- a/apps/nhost/nhost/metadata/databases/default/tables/auth_refresh_tokens.yaml +++ /dev/null @@ -1,36 +0,0 @@ -table: - name: refresh_tokens - schema: auth -configuration: - column_config: - created_at: - custom_name: createdAt - expires_at: - custom_name: expiresAt - refresh_token: - custom_name: refreshToken - refresh_token_hash: - custom_name: refreshTokenHash - user_id: - custom_name: userId - custom_column_names: - created_at: createdAt - expires_at: expiresAt - refresh_token: refreshToken - refresh_token_hash: refreshTokenHash - user_id: userId - custom_name: authRefreshTokens - custom_root_fields: - delete: deleteAuthRefreshTokens - delete_by_pk: deleteAuthRefreshToken - insert: insertAuthRefreshTokens - insert_one: insertAuthRefreshToken - select: authRefreshTokens - select_aggregate: authRefreshTokensAggregate - select_by_pk: authRefreshToken - update: updateAuthRefreshTokens - update_by_pk: updateAuthRefreshToken -object_relationships: - - name: user - using: - foreign_key_constraint_on: user_id diff --git a/apps/nhost/nhost/metadata/databases/default/tables/auth_roles.yaml b/apps/nhost/nhost/metadata/databases/default/tables/auth_roles.yaml deleted file mode 100644 index bc6d5a2cf..000000000 --- a/apps/nhost/nhost/metadata/databases/default/tables/auth_roles.yaml +++ /dev/null @@ -1,35 +0,0 @@ -table: - name: roles - schema: auth -configuration: - column_config: - role: - custom_name: role - custom_column_names: - role: role - custom_name: authRoles - custom_root_fields: - delete: deleteAuthRoles - delete_by_pk: deleteAuthRole - insert: insertAuthRoles - insert_one: insertAuthRole - select: authRoles - select_aggregate: authRolesAggregate - select_by_pk: authRole - update: updateAuthRoles - update_by_pk: updateAuthRole -array_relationships: - - name: userRoles - using: - foreign_key_constraint_on: - column: role - table: - name: user_roles - schema: auth - - name: usersByDefaultRole - using: - foreign_key_constraint_on: - column: default_role - table: - name: users - schema: auth diff --git a/apps/nhost/nhost/metadata/databases/default/tables/auth_user_providers.yaml b/apps/nhost/nhost/metadata/databases/default/tables/auth_user_providers.yaml deleted file mode 100644 index 02b8eb2da..000000000 --- a/apps/nhost/nhost/metadata/databases/default/tables/auth_user_providers.yaml +++ /dev/null @@ -1,48 +0,0 @@ -table: - name: user_providers - schema: auth -configuration: - column_config: - access_token: - custom_name: accessToken - created_at: - custom_name: createdAt - id: - custom_name: id - provider_id: - custom_name: providerId - provider_user_id: - custom_name: providerUserId - refresh_token: - custom_name: refreshToken - updated_at: - custom_name: updatedAt - user_id: - custom_name: userId - custom_column_names: - access_token: accessToken - created_at: createdAt - id: id - provider_id: providerId - provider_user_id: providerUserId - refresh_token: refreshToken - updated_at: updatedAt - user_id: userId - custom_name: authUserProviders - custom_root_fields: - delete: deleteAuthUserProviders - delete_by_pk: deleteAuthUserProvider - insert: insertAuthUserProviders - insert_one: insertAuthUserProvider - select: authUserProviders - select_aggregate: authUserProvidersAggregate - select_by_pk: authUserProvider - update: updateAuthUserProviders - update_by_pk: updateAuthUserProvider -object_relationships: - - name: provider - using: - foreign_key_constraint_on: provider_id - - name: user - using: - foreign_key_constraint_on: user_id diff --git a/apps/nhost/nhost/metadata/databases/default/tables/auth_user_roles.yaml b/apps/nhost/nhost/metadata/databases/default/tables/auth_user_roles.yaml deleted file mode 100644 index f90553941..000000000 --- a/apps/nhost/nhost/metadata/databases/default/tables/auth_user_roles.yaml +++ /dev/null @@ -1,36 +0,0 @@ -table: - name: user_roles - schema: auth -configuration: - column_config: - created_at: - custom_name: createdAt - id: - custom_name: id - role: - custom_name: role - user_id: - custom_name: userId - custom_column_names: - created_at: createdAt - id: id - role: role - user_id: userId - custom_name: authUserRoles - custom_root_fields: - delete: deleteAuthUserRoles - delete_by_pk: deleteAuthUserRole - insert: insertAuthUserRoles - insert_one: insertAuthUserRole - select: authUserRoles - select_aggregate: authUserRolesAggregate - select_by_pk: authUserRole - update: updateAuthUserRoles - update_by_pk: updateAuthUserRole -object_relationships: - - name: roleByRole - using: - foreign_key_constraint_on: role - - name: user - using: - foreign_key_constraint_on: user_id diff --git a/apps/nhost/nhost/metadata/databases/default/tables/auth_user_security_keys.yaml b/apps/nhost/nhost/metadata/databases/default/tables/auth_user_security_keys.yaml deleted file mode 100644 index 9963b6234..000000000 --- a/apps/nhost/nhost/metadata/databases/default/tables/auth_user_security_keys.yaml +++ /dev/null @@ -1,33 +0,0 @@ -table: - name: user_security_keys - schema: auth -configuration: - column_config: - credential_id: - custom_name: credentialId - credential_public_key: - custom_name: credentialPublicKey - id: - custom_name: id - user_id: - custom_name: userId - custom_column_names: - credential_id: credentialId - credential_public_key: credentialPublicKey - id: id - user_id: userId - custom_name: authUserSecurityKeys - custom_root_fields: - delete: deleteAuthUserSecurityKeys - delete_by_pk: deleteAuthUserSecurityKey - insert: insertAuthUserSecurityKeys - insert_one: insertAuthUserSecurityKey - select: authUserSecurityKeys - select_aggregate: authUserSecurityKeysAggregate - select_by_pk: authUserSecurityKey - update: updateAuthUserSecurityKeys - update_by_pk: updateAuthUserSecurityKey -object_relationships: - - name: user - using: - foreign_key_constraint_on: user_id diff --git a/apps/nhost/nhost/metadata/databases/default/tables/auth_users.yaml b/apps/nhost/nhost/metadata/databases/default/tables/auth_users.yaml deleted file mode 100644 index 515dfbeb3..000000000 --- a/apps/nhost/nhost/metadata/databases/default/tables/auth_users.yaml +++ /dev/null @@ -1,135 +0,0 @@ -table: - name: users - schema: auth -configuration: - column_config: - active_mfa_type: - custom_name: activeMfaType - avatar_url: - custom_name: avatarUrl - created_at: - custom_name: createdAt - default_role: - custom_name: defaultRole - disabled: - custom_name: disabled - display_name: - custom_name: displayName - email: - custom_name: email - email_verified: - custom_name: emailVerified - id: - custom_name: id - is_anonymous: - custom_name: isAnonymous - last_seen: - custom_name: lastSeen - locale: - custom_name: locale - new_email: - custom_name: newEmail - otp_hash: - custom_name: otpHash - otp_hash_expires_at: - custom_name: otpHashExpiresAt - otp_method_last_used: - custom_name: otpMethodLastUsed - password_hash: - custom_name: passwordHash - phone_number: - custom_name: phoneNumber - phone_number_verified: - custom_name: phoneNumberVerified - ticket: - custom_name: ticket - ticket_expires_at: - custom_name: ticketExpiresAt - totp_secret: - custom_name: totpSecret - updated_at: - custom_name: updatedAt - webauthn_current_challenge: - custom_name: currentChallenge - custom_column_names: - active_mfa_type: activeMfaType - avatar_url: avatarUrl - created_at: createdAt - default_role: defaultRole - disabled: disabled - display_name: displayName - email: email - email_verified: emailVerified - id: id - is_anonymous: isAnonymous - last_seen: lastSeen - locale: locale - new_email: newEmail - otp_hash: otpHash - otp_hash_expires_at: otpHashExpiresAt - otp_method_last_used: otpMethodLastUsed - password_hash: passwordHash - phone_number: phoneNumber - phone_number_verified: phoneNumberVerified - ticket: ticket - ticket_expires_at: ticketExpiresAt - totp_secret: totpSecret - updated_at: updatedAt - webauthn_current_challenge: currentChallenge - custom_name: users - custom_root_fields: - delete: deleteUsers - delete_by_pk: deleteUser - insert: insertUsers - insert_one: insertUser - select: users - select_aggregate: usersAggregate - select_by_pk: user - update: updateUsers - update_by_pk: updateUser -object_relationships: - - name: defaultRoleByRole - using: - foreign_key_constraint_on: default_role -array_relationships: - - name: refreshTokens - using: - foreign_key_constraint_on: - column: user_id - table: - name: refresh_tokens - schema: auth - - name: roles - using: - foreign_key_constraint_on: - column: user_id - table: - name: user_roles - schema: auth - - name: securityKeys - using: - foreign_key_constraint_on: - column: user_id - table: - name: user_security_keys - schema: auth - - name: userProviders - using: - foreign_key_constraint_on: - column: user_id - table: - name: user_providers - schema: auth -select_permissions: - - role: public - permission: - columns: - - display_name - - id - filter: {} - - role: user - permission: - columns: - - display_name - - id - filter: {} diff --git a/apps/nhost/nhost/metadata/databases/default/tables/public_comments.yaml b/apps/nhost/nhost/metadata/databases/default/tables/public_comments.yaml deleted file mode 100644 index 54a21bec5..000000000 --- a/apps/nhost/nhost/metadata/databases/default/tables/public_comments.yaml +++ /dev/null @@ -1,71 +0,0 @@ -table: - name: comments - schema: public -configuration: - column_config: - created_at: - custom_name: createdAt - file_id: - custom_name: fileId - updated_at: - custom_name: updatedAt - user_id: - custom_name: userId - custom_column_names: - created_at: createdAt - file_id: fileId - updated_at: updatedAt - user_id: userId - custom_root_fields: {} -object_relationships: - - name: user - using: - foreign_key_constraint_on: user_id -insert_permissions: - - role: user - permission: - check: {} - set: - user_id: x-hasura-user-id - columns: - - file_id - - text -select_permissions: - - role: public - permission: - columns: - - created_at - - id - - file_id - - text - - updated_at - - user_id - filter: {} - limit: 100 - - role: user - permission: - columns: - - created_at - - id - - file_id - - text - - updated_at - - user_id - filter: {} - limit: 100 -update_permissions: - - role: user - permission: - columns: - - file_id - - text - filter: - user_id: - _eq: X-Hasura-User-Id - check: {} -delete_permissions: - - role: user - permission: - filter: - user_id: - _eq: X-Hasura-User-Id diff --git a/apps/nhost/nhost/metadata/databases/default/tables/storage_buckets.yaml b/apps/nhost/nhost/metadata/databases/default/tables/storage_buckets.yaml deleted file mode 100644 index 12b0e8343..000000000 --- a/apps/nhost/nhost/metadata/databases/default/tables/storage_buckets.yaml +++ /dev/null @@ -1,49 +0,0 @@ -table: - name: buckets - schema: storage -configuration: - column_config: - cache_control: - custom_name: cacheControl - created_at: - custom_name: createdAt - download_expiration: - custom_name: downloadExpiration - id: - custom_name: id - max_upload_file_size: - custom_name: maxUploadFileSize - min_upload_file_size: - custom_name: minUploadFileSize - presigned_urls_enabled: - custom_name: presignedUrlsEnabled - updated_at: - custom_name: updatedAt - custom_column_names: - cache_control: cacheControl - created_at: createdAt - download_expiration: downloadExpiration - id: id - max_upload_file_size: maxUploadFileSize - min_upload_file_size: minUploadFileSize - presigned_urls_enabled: presignedUrlsEnabled - updated_at: updatedAt - custom_name: buckets - custom_root_fields: - delete: deleteBuckets - delete_by_pk: deleteBucket - insert: insertBuckets - insert_one: insertBucket - select: buckets - select_aggregate: bucketsAggregate - select_by_pk: bucket - update: updateBuckets - update_by_pk: updateBucket -array_relationships: - - name: files - using: - foreign_key_constraint_on: - column: bucket_id - table: - name: files - schema: storage diff --git a/apps/nhost/nhost/metadata/databases/default/tables/storage_files.yaml b/apps/nhost/nhost/metadata/databases/default/tables/storage_files.yaml deleted file mode 100644 index 54b10962b..000000000 --- a/apps/nhost/nhost/metadata/databases/default/tables/storage_files.yaml +++ /dev/null @@ -1,98 +0,0 @@ -table: - name: files - schema: storage -configuration: - column_config: - bucket_id: - custom_name: bucketId - created_at: - custom_name: createdAt - etag: - custom_name: etag - id: - custom_name: id - is_uploaded: - custom_name: isUploaded - mime_type: - custom_name: mimeType - name: - custom_name: name - size: - custom_name: size - updated_at: - custom_name: updatedAt - uploaded_by_user_id: - custom_name: uploadedByUserId - custom_column_names: - bucket_id: bucketId - created_at: createdAt - etag: etag - id: id - is_uploaded: isUploaded - mime_type: mimeType - name: name - size: size - updated_at: updatedAt - uploaded_by_user_id: uploadedByUserId - custom_name: files - custom_root_fields: - delete: deleteFiles - delete_by_pk: deleteFile - insert: insertFiles - insert_one: insertFile - select: files - select_aggregate: filesAggregate - select_by_pk: file - update: updateFiles - update_by_pk: updateFile -object_relationships: - - name: bucket - using: - foreign_key_constraint_on: bucket_id -insert_permissions: - - role: user - permission: - check: {} - set: - uploaded_by_user_id: x-hasura-user-id - columns: - - bucket_id - - id - - mime_type - - name - - size -select_permissions: - - role: public - permission: - columns: - - bucket_id - - created_at - - etag - - id - - is_uploaded - - mime_type - - name - - size - - updated_at - - uploaded_by_user_id - filter: {} - - role: user - permission: - columns: - - is_uploaded - - size - - bucket_id - - etag - - mime_type - - name - - created_at - - updated_at - - id - - uploaded_by_user_id - filter: {} -delete_permissions: - - role: user - permission: - filter: - uploaded_by_user_id: - _eq: X-Hasura-User-Id diff --git a/apps/nhost/nhost/metadata/databases/default/tables/tables.yaml b/apps/nhost/nhost/metadata/databases/default/tables/tables.yaml deleted file mode 100644 index fbfb78e84..000000000 --- a/apps/nhost/nhost/metadata/databases/default/tables/tables.yaml +++ /dev/null @@ -1,11 +0,0 @@ -- "!include auth_provider_requests.yaml" -- "!include auth_providers.yaml" -- "!include auth_refresh_tokens.yaml" -- "!include auth_roles.yaml" -- "!include auth_user_providers.yaml" -- "!include auth_user_roles.yaml" -- "!include auth_user_security_keys.yaml" -- "!include auth_users.yaml" -- "!include public_comments.yaml" -- "!include storage_buckets.yaml" -- "!include storage_files.yaml" diff --git a/apps/nhost/nhost/metadata/graphql_schema_introspection.yaml b/apps/nhost/nhost/metadata/graphql_schema_introspection.yaml deleted file mode 100644 index 61a4dcac2..000000000 --- a/apps/nhost/nhost/metadata/graphql_schema_introspection.yaml +++ /dev/null @@ -1 +0,0 @@ -disabled_for_roles: [] diff --git a/apps/nhost/nhost/metadata/inherited_roles.yaml b/apps/nhost/nhost/metadata/inherited_roles.yaml deleted file mode 100644 index fe51488c7..000000000 --- a/apps/nhost/nhost/metadata/inherited_roles.yaml +++ /dev/null @@ -1 +0,0 @@ -[] diff --git a/apps/nhost/nhost/metadata/network.yaml b/apps/nhost/nhost/metadata/network.yaml deleted file mode 100644 index 0967ef424..000000000 --- a/apps/nhost/nhost/metadata/network.yaml +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/apps/nhost/nhost/metadata/query_collections.yaml b/apps/nhost/nhost/metadata/query_collections.yaml deleted file mode 100644 index fe51488c7..000000000 --- a/apps/nhost/nhost/metadata/query_collections.yaml +++ /dev/null @@ -1 +0,0 @@ -[] diff --git a/apps/nhost/nhost/metadata/remote_schemas.yaml b/apps/nhost/nhost/metadata/remote_schemas.yaml deleted file mode 100644 index fe51488c7..000000000 --- a/apps/nhost/nhost/metadata/remote_schemas.yaml +++ /dev/null @@ -1 +0,0 @@ -[] diff --git a/apps/nhost/nhost/metadata/rest_endpoints.yaml b/apps/nhost/nhost/metadata/rest_endpoints.yaml deleted file mode 100644 index fe51488c7..000000000 --- a/apps/nhost/nhost/metadata/rest_endpoints.yaml +++ /dev/null @@ -1 +0,0 @@ -[] diff --git a/apps/nhost/nhost/metadata/version.yaml b/apps/nhost/nhost/metadata/version.yaml deleted file mode 100644 index 0a70affa4..000000000 --- a/apps/nhost/nhost/metadata/version.yaml +++ /dev/null @@ -1 +0,0 @@ -version: 3 diff --git a/apps/nhost/nhost/migrations/default/1670452575113_init/up.sql b/apps/nhost/nhost/migrations/default/1670452575113_init/up.sql deleted file mode 100644 index 40c305ddd..000000000 --- a/apps/nhost/nhost/migrations/default/1670452575113_init/up.sql +++ /dev/null @@ -1,26 +0,0 @@ -SET check_function_bodies = false; -CREATE OR REPLACE FUNCTION public.set_current_timestamp_updated_at() RETURNS trigger - LANGUAGE plpgsql - AS $$ -DECLARE - _new record; -BEGIN - _new := NEW; - _new."updated_at" = NOW(); - RETURN _new; -END; -$$; -CREATE TABLE public.comments ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - text text NOT NULL, - user_id uuid NOT NULL, - file_id text -); -ALTER TABLE ONLY public.comments - ADD CONSTRAINT comments_pkey PRIMARY KEY (id); -CREATE TRIGGER set_public_comments_updated_at BEFORE UPDATE ON public.comments FOR EACH ROW EXECUTE FUNCTION public.set_current_timestamp_updated_at(); -COMMENT ON TRIGGER set_public_comments_updated_at ON public.comments IS 'trigger to set value of column "updated_at" to current timestamp on row update'; -ALTER TABLE ONLY public.comments - ADD CONSTRAINT comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON UPDATE RESTRICT ON DELETE RESTRICT; diff --git a/apps/nhost/package.json b/apps/nhost/package.json deleted file mode 100644 index 83fbe9760..000000000 --- a/apps/nhost/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "nhost", - "version": "0.0.0", - "type": "module", - "scripts": { - "dev": "nhost up", - "lint:markup": "markuplint --config ../../.markuplintrc.cjs \"**\"", - "lint:prettier": "prettier --check --ignore-path=../../.prettierignore .", - "lint": "concurrently pnpm:lint:*", - "format:prettier": "prettier --write --ignore-path=../../.prettierignore .", - "format": "concurrently pnpm:format:*" - } -} diff --git a/apps/nhost/tsconfig.json b/apps/nhost/tsconfig.json deleted file mode 100644 index 0f4467244..000000000 --- a/apps/nhost/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "compilerOptions": { - "allowJs": true, - "skipLibCheck": true, - "noEmit": true, - "esModuleInterop": true, - "resolveJsonModule": true, - "isolatedModules": true, - "strictNullChecks": false - } -} diff --git a/apps/story/.eslintignore b/apps/story/.eslintignore deleted file mode 100644 index 47d70e24c..000000000 --- a/apps/story/.eslintignore +++ /dev/null @@ -1,8 +0,0 @@ -.DS_Store -node_modules -.env -.env.* -!.env.example - -# custom -/storybook-static/ diff --git a/apps/story/.eslintrc.cjs b/apps/story/.eslintrc.cjs deleted file mode 100644 index 03ee7431b..000000000 --- a/apps/story/.eslintrc.cjs +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - root: true, - extends: ['custom'], -}; diff --git a/apps/story/.gitignore b/apps/story/.gitignore deleted file mode 100644 index 1aa0ac14e..000000000 --- a/apps/story/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/storybook-static diff --git a/apps/story/.storybook/main.js b/apps/story/.storybook/main.js deleted file mode 100644 index c289a7d8f..000000000 --- a/apps/story/.storybook/main.js +++ /dev/null @@ -1,18 +0,0 @@ -/** @type { import('@storybook/svelte-vite').StorybookConfig } */ -const config = { - stories: ['../stories/**/*.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx|svelte)'], - addons: [ - '@storybook/addon-links', - '@storybook/addon-essentials', - '@storybook/addon-interactions', - ], - framework: { - name: '@storybook/svelte-vite', - options: {}, - }, - docs: { - autodocs: 'tag', - }, -}; - -export default config; diff --git a/apps/story/.storybook/preview.js b/apps/story/.storybook/preview.js deleted file mode 100644 index 50468430a..000000000 --- a/apps/story/.storybook/preview.js +++ /dev/null @@ -1,16 +0,0 @@ -import 'tailwind-preset-base/global.css'; - -/** @type {import('@storybook/svelte').Preview} */ -const preview = { - parameters: { - actions: { argTypesRegex: '^on[A-Z].*' }, - controls: { - matchers: { - color: /(background|color)$/i, - date: /Date$/, - }, - }, - }, -}; - -export default preview; diff --git a/apps/story/README.md b/apps/story/README.md deleted file mode 100644 index 98d46d4f4..000000000 --- a/apps/story/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# `story` app - -Stories for the Svelte Components. - -## Commands - -```bash -pnpm build # Output `/storybook-static` -pnpm dev # Launch development server on port 6006 -pnpm preview # Check built static site -pnpm lint # cspell -pnpm format # Format with `prettier` -``` diff --git a/apps/story/package.json b/apps/story/package.json deleted file mode 100644 index 7ee0cd33c..000000000 --- a/apps/story/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "story", - "version": "0.0.0", - "type": "module", - "scripts": { - "dev": "storybook dev -p 6006", - "build": "storybook build", - "lint:js": "eslint .", - "lint:cspell": "cspell \"**\"", - "lint:prettier": "prettier --check --ignore-path=../../.prettierignore .", - "lint": "concurrently pnpm:lint:*", - "format:js": "eslint --fix .", - "format:prettier": "prettier --write --ignore-path=../../.prettierignore .", - "format": "concurrently pnpm:format:*" - }, - "dependencies": { - "ui": "workspace:*" - }, - "devDependencies": { - "@storybook/addon-essentials": "^7.6.6", - "@storybook/addon-interactions": "^7.6.6", - "@storybook/addon-links": "^7.6.6", - "@storybook/blocks": "^7.6.6", - "@storybook/svelte": "^7.6.6", - "@storybook/svelte-vite": "^7.6.6", - "@storybook/testing-library": "^0.2.2", - "eslint-config-custom": "workspace:*", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "storybook": "^7.6.6", - "svelte": "^4.2.8", - "tailwind-preset-base": "workspace:*", - "tailwindcss": "^3.4.0" - } -} diff --git a/apps/story/postcss.config.cjs b/apps/story/postcss.config.cjs deleted file mode 100644 index 12a703d90..000000000 --- a/apps/story/postcss.config.cjs +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, -}; diff --git a/apps/story/stories/ui/Button.stories.js b/apps/story/stories/ui/Button.stories.js deleted file mode 100644 index adc12a81a..000000000 --- a/apps/story/stories/ui/Button.stories.js +++ /dev/null @@ -1,66 +0,0 @@ -import ButtonView from './views/ButtonView.svelte'; - -// More on how to set up stories at: https://storybook.js.org/docs/svelte/writing-stories/introduction -export default { - title: 'ui/Button', - component: ButtonView, - tags: ['autodocs'], - argTypes: { - href: { - table: { - type: { summary: 'string' }, - defaultValue: { summary: '' }, - }, - control: { - type: 'text', - }, - }, - type: { - table: { - type: { summary: 'string' }, - defaultValue: { summary: '' }, - }, - control: { - type: 'text', - }, - }, - primary: { - table: { - type: { summary: 'boolean' }, - defaultValue: { summary: false }, - }, - control: { - type: 'boolean', - }, - }, - blank: { - table: { - type: { summary: 'boolean' }, - defaultValue: { summary: false }, - }, - control: { - type: 'boolean', - }, - }, - disabled: { - table: { - type: { summary: 'boolean' }, - defaultValue: { summary: false }, - }, - control: { - type: 'boolean', - }, - }, - }, -}; - -// More on writing stories with args: https://storybook.js.org/docs/svelte/writing-stories/args -export const Primary = { - args: { - primary: true, - }, -}; - -export const Secondary = { - args: {}, -}; diff --git a/apps/story/stories/ui/Input.stories.js b/apps/story/stories/ui/Input.stories.js deleted file mode 100644 index 74f500776..000000000 --- a/apps/story/stories/ui/Input.stories.js +++ /dev/null @@ -1,19 +0,0 @@ -import { Input } from 'ui'; - -// More on how to set up stories at: https://storybook.js.org/docs/svelte/writing-stories/introduction -export default { - title: 'ui/Input', - component: Input, - tags: ['autodocs'], -}; - -// More on writing stories with args: https://storybook.js.org/docs/svelte/writing-stories/args -export const Default = { - args: { - label: 'Text', - value: 'this is value', - error: { - required: 'Text is required', - }, - }, -}; diff --git a/apps/story/stories/ui/SectionFrame.stories.js b/apps/story/stories/ui/SectionFrame.stories.js deleted file mode 100644 index cb1807d07..000000000 --- a/apps/story/stories/ui/SectionFrame.stories.js +++ /dev/null @@ -1,37 +0,0 @@ -import SectionFrameView from './views/SectionFrameView.svelte'; - -// More on how to set up stories at: https://storybook.js.org/docs/svelte/writing-stories/introduction -export default { - title: 'ui/SectionFrame', - component: SectionFrameView, - tags: ['autodocs'], - argTypes: { - noPad: { - table: { - type: { summary: `y|top|` }, - defaultValue: { summary: '' }, - }, - control: { - type: 'select', - }, - options: ['', 'y', 'top'], - }, - }, -}; - -// More on writing stories with args: https://storybook.js.org/docs/svelte/writing-stories/args -export const Default = { - args: {}, -}; - -export const noPadY = { - args: { - noPad: 'y', - }, -}; - -export const noPadTop = { - args: { - noPad: 'top', - }, -}; diff --git a/apps/story/stories/ui/views/ButtonView.svelte b/apps/story/stories/ui/views/ButtonView.svelte deleted file mode 100644 index 0375841cb..000000000 --- a/apps/story/stories/ui/views/ButtonView.svelte +++ /dev/null @@ -1,16 +0,0 @@ - - -
      - - - - - -
      diff --git a/apps/story/stories/ui/views/SectionFrameView.svelte b/apps/story/stories/ui/views/SectionFrameView.svelte deleted file mode 100644 index aa3c552f4..000000000 --- a/apps/story/stories/ui/views/SectionFrameView.svelte +++ /dev/null @@ -1,5 +0,0 @@ - - -SectionFrame diff --git a/apps/story/tailwind.config.js b/apps/story/tailwind.config.js deleted file mode 100644 index a8d1281ff..000000000 --- a/apps/story/tailwind.config.js +++ /dev/null @@ -1,11 +0,0 @@ -import base from 'tailwind-preset-base'; - -/** @type {import('tailwindcss').Config} */ -export default { - presets: [base], - content: [ - './stories/**/*.svelte', - '../../apps/web/src/lib/**/*.svelte', // for using 'apps/web' - '../../packages/ui/components/**/*.svelte', // for using 'packages/ui' - ], -}; diff --git a/apps/web/.eslintignore b/apps/web/.eslintignore deleted file mode 100644 index da32c86ed..000000000 --- a/apps/web/.eslintignore +++ /dev/null @@ -1,16 +0,0 @@ -.DS_Store -node_modules -/build -/.svelte-kit -/package -.env -.env.* -!.env.example - -# Ignore files for PNPM, NPM and YARN -pnpm-lock.yaml -package-lock.json -yarn.lock - -# custom -/$houdini diff --git a/apps/web/.eslintrc.cjs b/apps/web/.eslintrc.cjs deleted file mode 100644 index 03ee7431b..000000000 --- a/apps/web/.eslintrc.cjs +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - root: true, - extends: ['custom'], -}; diff --git a/apps/web/.gitignore b/apps/web/.gitignore index 3fc87c3a6..72042403c 100644 --- a/apps/web/.gitignore +++ b/apps/web/.gitignore @@ -10,5 +10,5 @@ vite.config.js.timestamp-* vite.config.ts.timestamp-* # custom -$houdini -schema.graphql +/src/lib/$generated/* +!/src/lib/$generated/supabase-types.ts diff --git a/apps/web/.graphqlrc.yaml b/apps/web/.graphqlrc.yaml deleted file mode 100644 index b2b9055a5..000000000 --- a/apps/web/.graphqlrc.yaml +++ /dev/null @@ -1,9 +0,0 @@ -projects: - default: - schema: - - ./schema.graphql - - ./$houdini/graphql/schema.graphql - documents: - - '**/*.gql' - - '**/*.svelte' - - ./$houdini/graphql/documents.gql diff --git a/apps/web/README.md b/apps/web/README.md index 70031caa7..578cc13f5 100644 --- a/apps/web/README.md +++ b/apps/web/README.md @@ -1,6 +1,6 @@ # `web` app -Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte). +Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte). [[Demo](https://webapp-template.usagizmo.com/)] @@ -11,23 +11,21 @@ Everything you need to build a Svelte project, powered by [`create-svelte`](http ## Commands ```bash -pnpm generate # Output `.svelte-kit` and `schema.graphql` +pnpm generate # Output `src/lib/$generated/supabase-types.ts` pnpm build # Output `.svelte-kit/output/` pnpm preview # Preview the production build (after `pnpm build`) -pnpm dev # start the server and open the app in a new browser tab on port 3000 -pnpm lint # markuplint + cspell + eslint -pnpm format # Format with `prettier` - -# Others -pnpm package -pnpm check[:watch] +pnpm dev # start the server and open the app in a new browser tab on port 5173 +pnpm lint # markuplint + cspell + eslint + prettier +pnpm format # Format with eslint + prettier ``` +You can preview the production build with `pnpm preview`. + > To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. ## Deploy to Vercel (apps/web) - Framework Preset: `SvelteKit` - Root Directory: `apps/web` -- Environment Variables: Set 5 environment variables in `env` +- Environment Variables: Set 2 environment variables in `.env` diff --git a/apps/web/commands/supabase-types.js b/apps/web/commands/supabase-types.js new file mode 100755 index 000000000..1ab93d199 --- /dev/null +++ b/apps/web/commands/supabase-types.js @@ -0,0 +1,13 @@ +import { config } from 'dotenv'; +import { execSync } from 'node:child_process'; +import * as path from 'node:path'; +import url from 'node:url'; + +config(); + +const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); +const outputPath = path.join(__dirname, '..', 'src', 'lib', '$generated', 'supabase-types.ts'); + +execSync( + `supabase gen types typescript --db-url ${process.env.SUPABASE_DIRECT_URL} > '${outputPath}'`, +); diff --git a/apps/web/eslint.config.js b/apps/web/eslint.config.js new file mode 100644 index 000000000..e828940e7 --- /dev/null +++ b/apps/web/eslint.config.js @@ -0,0 +1,8 @@ +import config from '@repo/eslint-config'; + +export default [ + ...config, + { + ignores: ['.svelte-kit'], + }, +]; diff --git a/apps/web/houdini.config.js b/apps/web/houdini.config.js deleted file mode 100644 index d17238ded..000000000 --- a/apps/web/houdini.config.js +++ /dev/null @@ -1,34 +0,0 @@ -/** @type {import('houdini').ConfigFile} */ -const config = { - watchSchema: { - url: 'env:PUBLIC_GRAPHQL_ENDPOINT', - headers: { - 'X-Hasura-Admin-Secret': 'env:HASURA_ADMIN_SECRET', - }, - }, - plugins: { - 'houdini-svelte': { - client: './src/client', - }, - }, - scalars: { - // ref. https://www.houdinigraphql.com/api/config#custom-scalars - uuid: { - type: 'string', - unmarshal: (val) => val, - marshal: (text) => text, - }, - citext: { - type: 'string', - unmarshal: (val) => val, - marshal: (text) => text, - }, - timestamptz: { - type: 'Date', - unmarshal: (val) => new Date(val), - marshal: (date) => date.getTime(), - }, - }, -}; - -export default config; diff --git a/apps/web/package.json b/apps/web/package.json index 2d7780698..db6f99809 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -3,50 +3,42 @@ "version": "0.0.0", "type": "module", "scripts": { - "generate:svelte": "svelte-kit sync", - "generate:pull-schema": "houdini pull-schema", + "generate:supabase-types": "node ./commands/supabase-types.js", "generate": "concurrently pnpm:generate:*", "dev": "vite dev --open", - "build": "pnpm generate && vite build", + "build": "vite build", "preview": "vite preview", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch", - "lint:check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "lint:check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "lint:markup": "markuplint --config ../../.markuplintrc.cjs \"**\"", "lint:js": "eslint .", "lint:cspell": "cspell \"**\"", - "lint:prettier": "prettier --check --ignore-path=../../.prettierignore .", + "lint:prettier": "prettier . --check --ignore-path=../../.prettierignore", "lint": "concurrently pnpm:lint:*", "test:watch": "vitest", "test": "vitest run", "format:js": "eslint --fix .", - "format:prettier": "prettier --write --ignore-path=../../.prettierignore .", + "format:prettier": "prettier . --write --ignore-path=../../.prettierignore", "format": "concurrently pnpm:format:*" }, "dependencies": { - "@nhost/nhost-js": "^3.0.1", - "graphql": "^16.8.1", - "graphql-ws": "^5.14.3", - "js-cookie": "^3.0.5", - "luxon": "^3.4.4", - "ui": "workspace:*" + "@supabase/supabase-js": "^2.42.7", + "cdate": "^0.0.7" }, "devDependencies": { - "@sveltejs/adapter-auto": "^3.0.1", - "@sveltejs/kit": "^2.0.6", - "autoprefixer": "^10.4.16", - "eslint": "^8.56.0", - "eslint-config-custom": "workspace:*", - "graphqurl": "^1.0.1", - "houdini": "^1.2.35", - "houdini-svelte": "^1.2.35", - "postcss": "^8.4.32", - "prettier": "^3.1.1", - "prettier-plugin-svelte": "^3.1.2", - "svelte": "^4.2.8", - "svelte-check": "^3.6.2", - "tailwind-preset-base": "workspace:*", - "tailwindcss": "^3.4.0", - "vite": "^5.0.10", - "vitest": "^1.1.0" + "@repo/eslint-config": "workspace:*", + "@sveltejs/adapter-auto": "^3.2.0", + "@sveltejs/kit": "^2.5.7", + "@sveltejs/vite-plugin-svelte": "^3.1.0", + "@tailwindcss/postcss": "4.0.0-alpha.14", + "dotenv": "^16.4.5", + "supabase": "^1.163.6", + "svelte": "5.0.0-next.115", + "svelte-check": "^3.7.0", + "tailwindcss": "4.0.0-alpha.14", + "tslib": "^2.6.2", + "typescript": "^5.4.5", + "vite": "^5.2.10", + "vitest": "^1.5.2" } } diff --git a/apps/web/postcss.config.cjs b/apps/web/postcss.config.cjs deleted file mode 100644 index 12a703d90..000000000 --- a/apps/web/postcss.config.cjs +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, -}; diff --git a/apps/web/postcss.config.js b/apps/web/postcss.config.js new file mode 100644 index 000000000..a34a3d560 --- /dev/null +++ b/apps/web/postcss.config.js @@ -0,0 +1,5 @@ +export default { + plugins: { + '@tailwindcss/postcss': {}, + }, +}; diff --git a/apps/web/src/app.css b/apps/web/src/app.css new file mode 100644 index 000000000..f36b290c6 --- /dev/null +++ b/apps/web/src/app.css @@ -0,0 +1,14 @@ +/* ref. https://tailwindcss.com/blog/tailwindcss-v4-alpha */ +@import 'tailwindcss'; + +@theme { + /* --font-family-sans: YakuHanJP, Noto Sans JP, sans-serif; + --font-family-sans: -apple-system, blinkMacSystemFont, Helvetica, 'Yu Gothic', YuGothic, + 'BIZ UDPGothic', Meiryo, sans-serif; + --font-family-sans: -apple-system, blinkMacSystemFont, Helvetica, 'Hiragino Sans', + 'Hiragino Kaku Gothic ProN', 'BIZ UDPGothic', Meiryo, sans-serif; + --font-family-serif: 'Yu Mincho', YuMincho, 'Hiragino Mincho ProN', serif; */ + --font-family-sans: Inter, YakuHanJP, Noto Sans JP, sans-serif; + --font-family-mono: Source Code Pro, monospace; + --font-family-keycode: Lucida Grande; +} diff --git a/apps/web/src/app.html b/apps/web/src/app.html index c94a2e925..56a267482 100644 --- a/apps/web/src/app.html +++ b/apps/web/src/app.html @@ -2,13 +2,13 @@ - + { - const token = session?.token ?? null; - return createClient({ - url: wsUrl, - connectionParams: { - headers: { - ...(token ? { Authorization: `Bearer ${token}` } : {}), - }, - }, - }); - }), - ], -}); diff --git a/apps/web/src/hooks.server.js b/apps/web/src/hooks.server.js deleted file mode 100644 index 267dadb50..000000000 --- a/apps/web/src/hooks.server.js +++ /dev/null @@ -1,11 +0,0 @@ -import { NHOST_SESSION_KEY } from '$lib/const'; -import { parseSession } from '$lib/utils'; -import { setSession } from '$houdini'; - -/** @type {import('@sveltejs/kit').Handle} */ -export async function handle({ event, resolve }) { - const session = parseSession(event.cookies.get(NHOST_SESSION_KEY)); - const token = session?.accessToken ?? null; - setSession(event, { token }); - return await resolve(event); -} diff --git a/apps/web/src/index.test.ts b/apps/web/src/index.test.ts new file mode 100644 index 000000000..964d28725 --- /dev/null +++ b/apps/web/src/index.test.ts @@ -0,0 +1,7 @@ +import { describe, it, expect } from 'vitest'; + +describe('sum test', () => { + it('adds 1 + 2 to equal 3', () => { + expect(1 + 2).toBe(3); + }); +}); diff --git a/apps/web/src/lib/$generated/supabase-types.ts b/apps/web/src/lib/$generated/supabase-types.ts new file mode 100644 index 000000000..24e6ef916 --- /dev/null +++ b/apps/web/src/lib/$generated/supabase-types.ts @@ -0,0 +1,173 @@ +export type Json = + | string + | number + | boolean + | null + | { [key: string]: Json | undefined } + | Json[] + +export type Database = { + public: { + Tables: { + comments: { + Row: { + created_at: string + file_path: string | null + id: number + text: string + user_id: string + } + Insert: { + created_at?: string + file_path?: string | null + id?: number + text?: string + user_id: string + } + Update: { + created_at?: string + file_path?: string | null + id?: number + text?: string + user_id?: string + } + Relationships: [ + { + foreignKeyName: "public_comments_user_id_fkey" + columns: ["user_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + }, + ] + } + profiles: { + Row: { + bio: string + created_at: string + display_name: string + email: string + id: string + } + Insert: { + bio?: string + created_at?: string + display_name?: string + email: string + id: string + } + Update: { + bio?: string + created_at?: string + display_name?: string + email?: string + id?: string + } + Relationships: [ + { + foreignKeyName: "public_profiles_user_id_fkey" + columns: ["id"] + isOneToOne: true + referencedRelation: "users" + referencedColumns: ["id"] + }, + ] + } + } + Views: { + [_ in never]: never + } + Functions: { + [_ in never]: never + } + Enums: { + [_ in never]: never + } + CompositeTypes: { + [_ in never]: never + } + } +} + +type PublicSchema = Database[Extract] + +export type Tables< + PublicTableNameOrOptions extends + | keyof (PublicSchema["Tables"] & PublicSchema["Views"]) + | { schema: keyof Database }, + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } + ? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] & + Database[PublicTableNameOrOptions["schema"]]["Views"]) + : never = never, +> = PublicTableNameOrOptions extends { schema: keyof Database } + ? (Database[PublicTableNameOrOptions["schema"]]["Tables"] & + Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends { + Row: infer R + } + ? R + : never + : PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] & + PublicSchema["Views"]) + ? (PublicSchema["Tables"] & + PublicSchema["Views"])[PublicTableNameOrOptions] extends { + Row: infer R + } + ? R + : never + : never + +export type TablesInsert< + PublicTableNameOrOptions extends + | keyof PublicSchema["Tables"] + | { schema: keyof Database }, + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } + ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"] + : never = never, +> = PublicTableNameOrOptions extends { schema: keyof Database } + ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Insert: infer I + } + ? I + : never + : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] + ? PublicSchema["Tables"][PublicTableNameOrOptions] extends { + Insert: infer I + } + ? I + : never + : never + +export type TablesUpdate< + PublicTableNameOrOptions extends + | keyof PublicSchema["Tables"] + | { schema: keyof Database }, + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } + ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"] + : never = never, +> = PublicTableNameOrOptions extends { schema: keyof Database } + ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Update: infer U + } + ? U + : never + : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] + ? PublicSchema["Tables"][PublicTableNameOrOptions] extends { + Update: infer U + } + ? U + : never + : never + +export type Enums< + PublicEnumNameOrOptions extends + | keyof PublicSchema["Enums"] + | { schema: keyof Database }, + EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database } + ? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"] + : never = never, +> = PublicEnumNameOrOptions extends { schema: keyof Database } + ? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName] + : PublicEnumNameOrOptions extends keyof PublicSchema["Enums"] + ? PublicSchema["Enums"][PublicEnumNameOrOptions] + : never + diff --git a/apps/web/src/lib/components/Button.svelte b/apps/web/src/lib/components/Button.svelte new file mode 100644 index 000000000..4311dc20b --- /dev/null +++ b/apps/web/src/lib/components/Button.svelte @@ -0,0 +1,54 @@ + + + + +{#if element === 'a'} + + {@render children()} + +{:else} + +{/if} diff --git a/apps/web/src/lib/components/Input.svelte b/apps/web/src/lib/components/Input.svelte new file mode 100644 index 000000000..8017d69bd --- /dev/null +++ b/apps/web/src/lib/components/Input.svelte @@ -0,0 +1,41 @@ + + +
      + + {#if error.required && isDirty && !value} +
      {error.required}
      + {/if} +
      diff --git a/apps/web/src/lib/components/Meta.svelte b/apps/web/src/lib/components/Meta.svelte new file mode 100644 index 000000000..2c8fbca65 --- /dev/null +++ b/apps/web/src/lib/components/Meta.svelte @@ -0,0 +1,37 @@ + + + + {title} + + + + + + + + + + + + {#if canonical} + + {/if} + diff --git a/apps/web/src/lib/components/SectionFrame.svelte b/apps/web/src/lib/components/SectionFrame.svelte new file mode 100644 index 000000000..b6f86179c --- /dev/null +++ b/apps/web/src/lib/components/SectionFrame.svelte @@ -0,0 +1,32 @@ + + +
      + {@render children()} +
      diff --git a/apps/web/src/lib/components/TextArea.svelte b/apps/web/src/lib/components/TextArea.svelte new file mode 100644 index 000000000..e521c9bf7 --- /dev/null +++ b/apps/web/src/lib/components/TextArea.svelte @@ -0,0 +1,41 @@ + + +
      + + {#if error.required && isDirty && !value} +
      {error.required}
      + {/if} +
      diff --git a/packages/ui/components/icons/16x16/PaperPlaneIcon.svelte b/apps/web/src/lib/components/icons/16x16/PaperPlaneIcon.svelte similarity index 78% rename from packages/ui/components/icons/16x16/PaperPlaneIcon.svelte rename to apps/web/src/lib/components/icons/16x16/PaperPlaneIcon.svelte index 385b0302e..386025464 100644 --- a/packages/ui/components/icons/16x16/PaperPlaneIcon.svelte +++ b/apps/web/src/lib/components/icons/16x16/PaperPlaneIcon.svelte @@ -1,7 +1,7 @@ - - export let size = 16; + - export let size = 16; + - export let size = 20; + diff --git a/apps/web/src/lib/components/icons/20x20/CircleCloseIcon.svelte b/apps/web/src/lib/components/icons/20x20/CircleCloseIcon.svelte new file mode 100644 index 000000000..b3e4952d0 --- /dev/null +++ b/apps/web/src/lib/components/icons/20x20/CircleCloseIcon.svelte @@ -0,0 +1,13 @@ + + +
      + + +
      diff --git a/apps/web/src/lib/const.js b/apps/web/src/lib/const.js deleted file mode 100644 index fedc33848..000000000 --- a/apps/web/src/lib/const.js +++ /dev/null @@ -1 +0,0 @@ -export const NHOST_SESSION_KEY = 'nhostSession'; diff --git a/apps/web/src/lib/easing.js b/apps/web/src/lib/easing.ts similarity index 100% rename from apps/web/src/lib/easing.js rename to apps/web/src/lib/easing.ts diff --git a/apps/web/src/lib/features/comment/Comment.svelte b/apps/web/src/lib/features/comment/Comment.svelte new file mode 100644 index 000000000..25cdc352f --- /dev/null +++ b/apps/web/src/lib/features/comment/Comment.svelte @@ -0,0 +1,144 @@ + + +
      (isActionVisible = card.me ? true : false)} + onmouseleave={() => (isActionVisible = false)} +> +
      +
      +

      {card.name}

      + {#if card.me} +
      + +
      + {/if} + +
      +
      +

      {card.message}

      + {#if card.filePath} + {@const commentFileUrl = getCommentFileUrl(card.filePath)} +
      +
      + +
      + {#if isActionVisible} + + {/if} +
      + {/if} +
      + + {#if isActionVisible} +
      + +
      + {/if} +
      +
      diff --git a/apps/web/src/lib/features/comment/Comments.svelte b/apps/web/src/lib/features/comment/Comments.svelte new file mode 100644 index 000000000..7918b3844 --- /dev/null +++ b/apps/web/src/lib/features/comment/Comments.svelte @@ -0,0 +1,21 @@ + + +
      + {#if commentStore.isLoading} +
      +
      +
      + {:else} + {#each commentStore.comments as comment (comment.id)} +
      + +
      + {/each} + {/if} +
      diff --git a/apps/web/src/lib/features/comment/commentStore.svelte.ts b/apps/web/src/lib/features/comment/commentStore.svelte.ts new file mode 100644 index 000000000..8b60e2a54 --- /dev/null +++ b/apps/web/src/lib/features/comment/commentStore.svelte.ts @@ -0,0 +1,113 @@ +import { supabase } from '$lib/supabaseClient'; +import { userStore } from '$lib/features/user/userStore.svelte'; +import type { PostgrestError } from '@supabase/supabase-js'; +import { deleteCommentFile, uploadCommentFile } from './commentUtils'; + +export interface Comment { + id: number; + profiles: { + id: string; + display_name: string; + } | null; + text: string; + file_path: string | null; + created_at: string; +} + +export const commentQuery = ` + id, + profiles ( + id, + display_name + ), + text, + file_path, + created_at +`; + +export class CommentStore { + #isLoading = $state(false); + #comments = $state([]); + + get comments() { + return this.#comments; + } + + get isLoading() { + return this.#isLoading; + } + + async fetchComments() { + this.#isLoading = true; + + const { data, error } = await supabase + .from('comments') + .select(commentQuery) + .order('created_at', { ascending: false }); + + if (error) throw error; + + this.#comments = data; + this.#isLoading = false; + } + + async insertComment({ text, file }: { text: string; file: File | null }): Promise<{ + error: PostgrestError | Error | null; + }> { + if (!userStore.user) { + return { error: new Error('You must be logged in to comment') }; + } + + let file_path: string | null = null; + + if (file) { + const { data, error } = await uploadCommentFile(userStore.user.id, file); + if (error) return { error }; + file_path = data.path; + } + + const { data, error } = await supabase + .from('comments') + .insert([{ text, file_path, user_id: userStore.user.id }]) + .select(commentQuery); + if (error) return { error }; + + this.#comments.unshift(data[0]); + return { error: null }; + } + + async updateComment( + id: number, + props: { file_path?: string | null }, + ): Promise<{ error: PostgrestError | null }> { + const { error } = await supabase.from('comments').update(props).eq('id', id); + if (error) return { error }; + + this.#comments = this.#comments.map((comment) => { + if (comment.id === id) { + return { ...comment, ...props }; + } + return comment; + }); + + return { error: null }; + } + + async deleteComment( + id: number, + filePath: string | null, + ): Promise<{ error: PostgrestError | Error | null }> { + if (filePath) { + const { error } = await deleteCommentFile(filePath); + if (error) return { error }; + } + + const { error } = await supabase.from('comments').delete().eq('id', id); + if (error) return { error }; + + this.#comments = this.#comments.filter((comment) => comment.id !== id); + return { error: null }; + } +} + +export const commentStore = new CommentStore(); diff --git a/apps/web/src/lib/features/comment/commentUtils.ts b/apps/web/src/lib/features/comment/commentUtils.ts new file mode 100644 index 000000000..027879548 --- /dev/null +++ b/apps/web/src/lib/features/comment/commentUtils.ts @@ -0,0 +1,17 @@ +import { supabase } from '$lib/supabaseClient'; + +export async function uploadCommentFile(uid: string, file: File) { + const path = `${uid}/${Date.now()}_${file.name}`; + return supabase.storage.from('comments').upload(path, file); +} + +export async function deleteCommentFile(filePath: string) { + return supabase.storage.from('comments').remove([filePath]); +} + +export function getCommentFileUrl(path: string): string { + const { + data: { publicUrl }, + } = supabase.storage.from('comments').getPublicUrl(path); + return publicUrl; +} diff --git a/apps/web/src/lib/features/user/userStore.svelte.ts b/apps/web/src/lib/features/user/userStore.svelte.ts new file mode 100644 index 000000000..098c265cd --- /dev/null +++ b/apps/web/src/lib/features/user/userStore.svelte.ts @@ -0,0 +1,104 @@ +import { supabase } from '$lib/supabaseClient'; +import type { PostgrestError } from '@supabase/supabase-js'; + +export interface User { + id: string; + email: string; + displayName: string; + bio: string; +} + +export interface UserInputs { + email: string; + password: string; + displayName?: string; +} + +export class UserStore { + #user: User | null = $state(null); + #userInputs: UserInputs = $state({ + displayName: 'Guest', + email: 'email@add.com', + password: 'password0', + }); + + /** + * Get the user + * @returns The user + */ + get user(): User | null { + return this.#user; + } + + /** + * Set the user + */ + set user(user: User | null) { + this.#user = user; + } + + async updateUser( + id: string, + props: { bio?: string }, + ): Promise<{ error: PostgrestError | Error | null }> { + if (!this.#user) return { error: new Error('You must be logged in to update your profile') }; + + const { error } = await supabase.from('profiles').update(props).eq('id', id); + if (error) return { error }; + + this.#user = { ...this.#user, ...props }; + + return { error: null }; + } + + /** + * Get the user inputs + * @returns The user inputs + */ + get userInputs(): UserInputs { + return this.#userInputs; + } + + /** + * Set the user inputs + * @param userInputs - The user inputs + */ + setUserInputs(userInputs: Partial): void { + this.#userInputs = { ...this.#userInputs, ...userInputs }; + } + + /** + * Sign up and log in + * @param userInputs - The user inputs + */ + async signUp(): Promise { + const { email, password, displayName } = this.#userInputs; + const { error } = await supabase.auth.signUp({ + email, + password, + options: { + data: { display_name: displayName }, + }, + }); + error && alert(error.message); + } + + /** + * Log in a user + * @param userInputs - The user inputs + */ + async logIn(): Promise { + const { error } = await supabase.auth.signInWithPassword(this.#userInputs); + error && alert(error.message); + } + + /** + * Log out a user + */ + async logOut(): Promise { + const { error } = await supabase.auth.signOut(); + error && alert(error.message); + } +} + +export const userStore = new UserStore(); diff --git a/apps/web/src/lib/features/user/userUtils.ts b/apps/web/src/lib/features/user/userUtils.ts new file mode 100644 index 000000000..bd24f8486 --- /dev/null +++ b/apps/web/src/lib/features/user/userUtils.ts @@ -0,0 +1,23 @@ +import type { PostgrestError } from '@supabase/supabase-js'; +import type { User } from './userStore.svelte'; +import { supabase } from '../../supabaseClient'; + +export async function getUser( + id: string, +): Promise<{ user: User | null; error: PostgrestError | null }> { + const { data: profiles, error } = await supabase + .from('profiles') + .select('email, display_name, bio') + .eq('id', id); + + const user = profiles?.length + ? ({ + id, + email: profiles[0].email, + displayName: profiles[0].display_name, + bio: profiles[0].bio, + } satisfies User) + : null; + + return { user, error }; +} diff --git a/apps/web/src/lib/graphql/DeleteComment.gql b/apps/web/src/lib/graphql/DeleteComment.gql deleted file mode 100644 index 3410bd88f..000000000 --- a/apps/web/src/lib/graphql/DeleteComment.gql +++ /dev/null @@ -1,5 +0,0 @@ -mutation DeleteComment($id: uuid!) { - delete_comments_by_pk(id: $id) { - ...Comments_remove - } -} diff --git a/apps/web/src/lib/graphql/InsertComment.gql b/apps/web/src/lib/graphql/InsertComment.gql deleted file mode 100644 index 38114a37f..000000000 --- a/apps/web/src/lib/graphql/InsertComment.gql +++ /dev/null @@ -1,7 +0,0 @@ -mutation InsertComment($text: String!, $fileId: String) { - insert_comments(objects: { text: $text, fileId: $fileId }) { - returning { - ...Comments_insert - } - } -} diff --git a/apps/web/src/lib/graphql/UpdateCommentFileId.gql b/apps/web/src/lib/graphql/UpdateCommentFileId.gql deleted file mode 100644 index d0bdd0a42..000000000 --- a/apps/web/src/lib/graphql/UpdateCommentFileId.gql +++ /dev/null @@ -1,6 +0,0 @@ -mutation UpdateCommentFileId($id: uuid!, $fileId: String) { - update_comments_by_pk(pk_columns: { id: $id }, _set: { fileId: $fileId }) { - id - fileId - } -} diff --git a/apps/web/src/lib/nhost.js b/apps/web/src/lib/nhost.js deleted file mode 100644 index 83f370e25..000000000 --- a/apps/web/src/lib/nhost.js +++ /dev/null @@ -1,87 +0,0 @@ -import { NhostClient } from '@nhost/nhost-js'; -import Cookies from 'js-cookie'; -import { writable } from 'svelte/store'; -import { PUBLIC_NHOST_SUBDOMAIN, PUBLIC_NHOST_REGION } from '$env/static/public'; -import { NHOST_SESSION_KEY } from './const'; -import { parseSession, tryErrorAlertOnNhostApi } from './utils'; - -/** - * @typedef {import('@nhost/nhost-js').NhostSession} NhostSession - */ - -export const nhost = new NhostClient({ - subdomain: PUBLIC_NHOST_SUBDOMAIN, - region: PUBLIC_NHOST_REGION, -}); - -const session = parseSession(Cookies.get(NHOST_SESSION_KEY)); -export const user = writable(session?.user ?? null); - -let hasAlreadyAuthStateChanged = false; - -/** - * Set the Nhost session in a cookie - * @param {NhostSession} session - The session to set in the cookie - */ -function setNhostSessionInCookie(session) { - const expires = new Date(); - // Expire the cookie 60 seconds before the token expires - expires.setSeconds(expires.getSeconds() + session.accessTokenExpiresIn - 60); - Cookies.set(NHOST_SESSION_KEY, JSON.stringify(session), { - sameSite: 'strict', - expires, - }); -} - -nhost.auth.onAuthStateChanged((_, session) => { - if (session) { - setNhostSessionInCookie(session); - } else { - Cookies.remove(NHOST_SESSION_KEY); - } - - if (hasAlreadyAuthStateChanged) { - window.location.reload(); - return; - } - - user.set(session?.user ?? null); - hasAlreadyAuthStateChanged = true; -}); - -/** - * Sign up and log in - * @param {import('./userInputs').UserInputs} userInputs - The user inputs - * @returns {Promise} - */ -export async function signUp({ email, password, displayName }) { - const res = await nhost.auth.signUp({ - email, - password, - options: { - displayName, - }, - }); - tryErrorAlertOnNhostApi(res); -} - -/** - * Log in a user - * @param {import('./userInputs').UserInputs} userInputs - The user inputs - * @returns {Promise} - Whether the login was successful - */ -export async function logIn(userInputs) { - const res = await nhost.auth.signIn(userInputs); - const hasError = tryErrorAlertOnNhostApi(res); - return !hasError; -} - -/** - * Log out a user - * @returns {Promise} - Whether the logout was successful - */ -export async function logOut() { - const res = await nhost.auth.signOut(); - const hasError = tryErrorAlertOnNhostApi(res); - return !hasError; -} diff --git a/apps/web/src/lib/routes.js b/apps/web/src/lib/routes.ts similarity index 100% rename from apps/web/src/lib/routes.js rename to apps/web/src/lib/routes.ts diff --git a/apps/web/src/lib/store.js b/apps/web/src/lib/store.js deleted file mode 100644 index 9a69ea0b2..000000000 --- a/apps/web/src/lib/store.js +++ /dev/null @@ -1,9 +0,0 @@ -import { writable } from 'svelte/store'; -import { user } from './nhost'; -import { ROUTE } from './routes'; - -export const adminPath = writable(ROUTE.ADMIN); - -user.subscribe((value) => { - adminPath.set(value ? ROUTE.ADMIN : ROUTE.ADMIN_LOGIN); -}); diff --git a/apps/web/src/lib/supabaseClient.ts b/apps/web/src/lib/supabaseClient.ts new file mode 100644 index 000000000..876fe0754 --- /dev/null +++ b/apps/web/src/lib/supabaseClient.ts @@ -0,0 +1,5 @@ +import { createClient } from '@supabase/supabase-js'; +import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public'; +import type { Database } from './$generated/supabase-types'; + +export const supabase = createClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY); diff --git a/apps/web/src/lib/userInputs.js b/apps/web/src/lib/userInputs.js deleted file mode 100644 index cb80e8f02..000000000 --- a/apps/web/src/lib/userInputs.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @typedef {object} UserInputs - * @property {string} displayName - The user's display name - * @property {string} email - The user's email - * @property {string} password - The user's password - */ - -export const userInputsKey = Symbol(); diff --git a/apps/web/src/lib/utils.js b/apps/web/src/lib/utils.js deleted file mode 100644 index ce083172c..000000000 --- a/apps/web/src/lib/utils.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @typedef {import('@nhost/nhost-js').NhostSession} NhostSession - */ - -/** - * Set the Nhost session in a cookie - * @param {{ error?: { message: string } | null }} res - The response from an Nhost API call - * @returns {boolean} - True if there was an error, false otherwise - */ -export function tryErrorAlertOnNhostApi(res) { - const errorMessage = res.error?.message; - errorMessage && alert(errorMessage); - return !!errorMessage; -} - -/** - * Tries to show an error alert based on Houdini API errors if available - * @param {{ message: string }[] | null} errors - An array of error objects with a 'message' property, or null - * @returns {boolean} - Returns true if an error message was shown, otherwise false - */ -export function tryErrorAlertOnHoudiniApi(errors) { - if (!Array.isArray(errors) || typeof errors[0] !== 'object' || !errors[0]) return false; - const errorMessage = errors[0].message; - errorMessage && alert(errorMessage); - return !!errorMessage; -} - -/** - * Parse the session from a cookie - * @param {string | undefined} cookiesSession - The session from a cookie - * @returns {NhostSession | null} - The parsed session - */ -export function parseSession(cookiesSession) { - return cookiesSession ? JSON.parse(cookiesSession) : null; -} - -/** - * Checks if an object has an 'id' property - * @template T - * @param {T} obj - Object to check for the presence of an 'id' property - * @returns {obj is T & { id: string }} - True if the object has an 'id' property, false otherwise - */ -export function hasId(obj) { - if (obj == null || typeof obj !== 'object') return false; - return !!('id' in obj); -} - -/** - * Ensures that the object has an 'id' property - * Throws an error if the object doesn't have an 'id' property - * @template {object} T - * @param {T} obj - Object to ensure has an 'id' property - * @returns {T & { id: string }} - The same object with an 'id' property - * @throws {Error} - Throws an error if the object doesn't have an 'id' property - */ -export function toWithId(obj) { - if (hasId(obj)) return obj; - throw new Error('.id is required'); -} diff --git a/apps/web/src/lib/utils.test.js b/apps/web/src/lib/utils.test.js deleted file mode 100644 index 996bec2d1..000000000 --- a/apps/web/src/lib/utils.test.js +++ /dev/null @@ -1,56 +0,0 @@ -import { describe, it, expect, vi } from 'vitest'; -import { tryErrorAlertOnNhostApi, tryErrorAlertOnHoudiniApi } from './utils'; - -describe('@tryErrorAlertOnNhostApi', () => { - it('return false if it does not have `error.message`', () => { - const mock = vi.fn(); - vi.stubGlobal('alert', mock); - - expect(tryErrorAlertOnNhostApi({})).toBe(false); - expect(tryErrorAlertOnNhostApi({ error: null })).toBe(false); - expect(tryErrorAlertOnNhostApi({ error: { message: '' } })).toBe(false); - - expect(mock).toBeCalledTimes(0); - }); - - it('alert message and return true if it has `error.message`', () => { - const mock = vi.fn(); - vi.stubGlobal('alert', mock); - - expect(tryErrorAlertOnNhostApi({ error: { message: 'test' } })).toBe(true); - - expect(mock).toBeCalledTimes(1); - }); -}); - -describe('@tryErrorAlertOnHoudiniApi', () => { - it('return false if it does not have `error`', () => { - const mock = vi.fn(); - vi.stubGlobal('alert', mock); - - expect(tryErrorAlertOnHoudiniApi(null)).toBe(false); - // @ts-ignore - expect(tryErrorAlertOnHoudiniApi('')).toBe(false); - // @ts-ignore - expect(tryErrorAlertOnHoudiniApi('test')).toBe(false); - // @ts-ignore - expect(tryErrorAlertOnHoudiniApi(1)).toBe(false); - // @ts-ignore - expect(tryErrorAlertOnHoudiniApi({})).toBe(false); - expect(tryErrorAlertOnHoudiniApi([])).toBe(false); - // @ts-ignore - expect(tryErrorAlertOnHoudiniApi([{}])).toBe(false); - expect(tryErrorAlertOnHoudiniApi([{ message: '' }])).toBe(false); - - expect(mock).toBeCalledTimes(0); - }); - - it('alert message and return true if it has `[0].message`', () => { - const mock = vi.fn(); - vi.stubGlobal('alert', mock); - - expect(tryErrorAlertOnHoudiniApi([{ message: 'test' }])).toBe(true); - - expect(mock).toBeCalledTimes(1); - }); -}); diff --git a/apps/web/src/routes/+layout.svelte b/apps/web/src/routes/+layout.svelte index c13d04fbd..cc6acde15 100644 --- a/apps/web/src/routes/+layout.svelte +++ b/apps/web/src/routes/+layout.svelte @@ -1,20 +1,59 @@ - - + +
      -
      - +
      + {@render children()}
      diff --git a/apps/web/src/routes/+page.gql b/apps/web/src/routes/+page.gql deleted file mode 100644 index f48040b52..000000000 --- a/apps/web/src/routes/+page.gql +++ /dev/null @@ -1,6 +0,0 @@ -query Comments { - # I want to add it on top with InsertComment, so `createdAt: asc`. - comments(order_by: { createdAt: asc }) @list(name: "Comments") { - ...Comment - } -} diff --git a/apps/web/src/routes/+page.svelte b/apps/web/src/routes/+page.svelte index 3174966c1..c4d2f5a21 100644 --- a/apps/web/src/routes/+page.svelte +++ b/apps/web/src/routes/+page.svelte @@ -1,28 +1,28 @@ -
      - {#if $user} + {#if userStore.user} {:else} @@ -35,9 +35,7 @@

      Comments will be deleted as appropriate.

      -
      - -
      +
      diff --git a/apps/web/src/routes/Comment.svelte b/apps/web/src/routes/Comment.svelte deleted file mode 100644 index f25e1f610..000000000 --- a/apps/web/src/routes/Comment.svelte +++ /dev/null @@ -1,166 +0,0 @@ - - -
      (isActionVisible = card.me ? true : false)} - on:mouseleave={() => (isActionVisible = false)} -> -
      -
      -

      {card.name}

      - {#if card.me} -
      - -
      - {/if} - -
      -
      -

      {card.message}

      - {#if card.fileId} -
      -
      - -
      - {#if isActionVisible} - - {/if} -
      - {/if} -
      - - {#if isActionVisible} -
      - -
      - {/if} -
      -
      diff --git a/apps/web/src/routes/CommentForm.svelte b/apps/web/src/routes/CommentForm.svelte index 8266dcc63..d58a129e9 100644 --- a/apps/web/src/routes/CommentForm.svelte +++ b/apps/web/src/routes/CommentForm.svelte @@ -1,74 +1,63 @@ - @@ -76,38 +65,37 @@
      - diff --git a/apps/web/src/routes/Comments.svelte b/apps/web/src/routes/Comments.svelte deleted file mode 100644 index e96770a86..000000000 --- a/apps/web/src/routes/Comments.svelte +++ /dev/null @@ -1,29 +0,0 @@ - - -
      - {#each commentsWithId as comment (comment.id)} -
      - -
      - {/each} -
      diff --git a/apps/web/src/routes/GoogleAnalytics.svelte b/apps/web/src/routes/GoogleAnalytics.svelte index 4ad90b18d..2dd447fec 100644 --- a/apps/web/src/routes/GoogleAnalytics.svelte +++ b/apps/web/src/routes/GoogleAnalytics.svelte @@ -1,6 +1,8 @@ - - {#if PUBLIC_GOOGLE_ANALYTICS_ID} - - - {content} - - {/if} + + + {content} + diff --git a/apps/web/src/routes/HeaderNavigation.svelte b/apps/web/src/routes/HeaderNavigation.svelte index fa7f308d8..4f50b1c2c 100644 --- a/apps/web/src/routes/HeaderNavigation.svelte +++ b/apps/web/src/routes/HeaderNavigation.svelte @@ -1,20 +1,21 @@ -
      @@ -25,7 +26,7 @@ WebApp Template (web)
      @@ -34,5 +35,3 @@
  • - - diff --git a/apps/web/src/routes/HeaderNavigationItems.svelte b/apps/web/src/routes/HeaderNavigationItems.svelte index 9d4165dad..6a4d5ade7 100644 --- a/apps/web/src/routes/HeaderNavigationItems.svelte +++ b/apps/web/src/routes/HeaderNavigationItems.svelte @@ -1,16 +1,25 @@ -
      @@ -34,7 +43,7 @@ in:receive={{ key: 'header-navigation-items-bar' }} out:send={{ key: 'header-navigation-items-bar' }} class="absolute inset-x-0 bottom-0 block h-0.5 bg-zinc-900" - /> + > {/if} {/each} diff --git a/apps/web/src/routes/LoginMessage.svelte b/apps/web/src/routes/LoginMessage.svelte index 99514506c..460be6684 100644 --- a/apps/web/src/routes/LoginMessage.svelte +++ b/apps/web/src/routes/LoginMessage.svelte @@ -1,5 +1,6 @@ - diff --git a/apps/web/src/routes/admin/(isNotLoggedIn)/+layout.svelte b/apps/web/src/routes/admin/(isNotLoggedIn)/+layout.svelte index bb6a27f4e..44d12a434 100644 --- a/apps/web/src/routes/admin/(isNotLoggedIn)/+layout.svelte +++ b/apps/web/src/routes/admin/(isNotLoggedIn)/+layout.svelte @@ -1,35 +1,31 @@ -
      - - + + {@render children()}
      diff --git a/apps/web/src/routes/admin/(isNotLoggedIn)/AdminForm.svelte b/apps/web/src/routes/admin/(isNotLoggedIn)/AdminForm.svelte deleted file mode 100644 index 5276fc2da..000000000 --- a/apps/web/src/routes/admin/(isNotLoggedIn)/AdminForm.svelte +++ /dev/null @@ -1,40 +0,0 @@ - - -
      - {#if isSignUpPage} -
      - -
      - {/if} - - -
      diff --git a/apps/web/src/routes/admin/(isNotLoggedIn)/UserInputs.svelte b/apps/web/src/routes/admin/(isNotLoggedIn)/UserInputs.svelte new file mode 100644 index 000000000..71904ac17 --- /dev/null +++ b/apps/web/src/routes/admin/(isNotLoggedIn)/UserInputs.svelte @@ -0,0 +1,38 @@ + + +
      + {#if isSignUpPage} +
      + userStore.setUserInputs({ displayName: (event.target as HTMLInputElement).value })} + error={{ required: 'Display Name is required.' }} + /> +
      + {/if} + userStore.setUserInputs({ email: (event.target as HTMLInputElement).value })} + error={{ required: 'E-mail is required.' }} + /> + userStore.setUserInputs({ password: (event.target as HTMLInputElement).value })} + error={{ required: 'Password is required.' }} + /> +
      diff --git a/apps/web/src/routes/admin/(isNotLoggedIn)/login/+page.svelte b/apps/web/src/routes/admin/(isNotLoggedIn)/login/+page.svelte index 7f0f3b383..5f14af47e 100644 --- a/apps/web/src/routes/admin/(isNotLoggedIn)/login/+page.svelte +++ b/apps/web/src/routes/admin/(isNotLoggedIn)/login/+page.svelte @@ -1,19 +1,17 @@ - +
      - + {@render children()}
      diff --git a/apps/web/src/routes/admin/+page.svelte b/apps/web/src/routes/admin/+page.svelte index ec5f6280b..0355b23be 100644 --- a/apps/web/src/routes/admin/+page.svelte +++ b/apps/web/src/routes/admin/+page.svelte @@ -1,17 +1,10 @@ - -
      +
      - {#if $page.url.pathname === ROUTE.ADMIN_LOGIN} + {#if isSignUpPage} +
      +

      + You can register as a member
      + with an irresponsible email and password. +

      +

      No email will be sent.

      +
      + {:else}

      Guest account

      @@ -31,18 +40,10 @@
      pass:
      -
      password
      +
      password0
      - {:else} -
      -

      - You can register as a member
      - with an irresponsible email and password. -

      -

      No email will be sent.

      -
      {/if}
      diff --git a/apps/web/src/routes/admin/AdminHeaderTabs.svelte b/apps/web/src/routes/admin/AdminHeaderTabs.svelte index a1de5dafd..7f22f5a3f 100644 --- a/apps/web/src/routes/admin/AdminHeaderTabs.svelte +++ b/apps/web/src/routes/admin/AdminHeaderTabs.svelte @@ -1,4 +1,4 @@ - + + +
      +

      {user.displayName}

      +

      {user.email}

      +
      +