From 595e53f4d8a6e105bdf214c1da3b40bb8871134d Mon Sep 17 00:00:00 2001 From: Carter <35710697+cmintey@users.noreply.github.com> Date: Mon, 27 Nov 2023 22:26:18 -0600 Subject: [PATCH] change tabs to spaces (#79) --- .eslintrc.cjs | 85 ++-- .prettierrc | 13 +- .vscode/settings.json | 10 +- README.md | 16 +- docker-compose.yaml | 22 +- package.json | 152 +++---- postcss.config.cjs | 12 +- prisma/seed.js | 170 ++++---- src/ambient.d.ts | 100 ++--- src/app.d.ts | 46 +- src/app.html | 68 +-- src/app.postcss | 154 +++---- src/hooks.server.ts | 4 +- src/lib/api/groups.ts | 122 +++--- src/lib/api/items.ts | 100 ++--- src/lib/api/users.ts | 108 ++--- src/lib/components/Avatar.svelte | 18 +- src/lib/components/BackButton.svelte | 45 +- src/lib/components/Backdrop.svelte | 19 +- src/lib/components/Drawer.svelte | 20 +- src/lib/components/PasswordInput.svelte | 190 ++++---- src/lib/components/Search.svelte | 36 +- src/lib/components/TokenCopy.svelte | 70 +-- src/lib/components/UserCard.svelte | 68 +-- .../components/account/ChangePassword.svelte | 156 +++---- src/lib/components/account/EditProfile.svelte | 102 +++-- .../admin/Actions/ClearListsButton.svelte | 78 ++-- src/lib/components/admin/ActionsForm.svelte | 4 +- src/lib/components/admin/Groups.svelte | 132 +++--- src/lib/components/admin/InviteUser.svelte | 132 +++--- src/lib/components/admin/SMTPAlert.svelte | 38 +- .../admin/SettingsForm/Claims.svelte | 18 +- .../admin/SettingsForm/PublicSignup.svelte | 18 +- .../components/admin/SettingsForm/SMTP.svelte | 162 ++++--- .../admin/SettingsForm/Suggestions.svelte | 46 +- .../admin/SettingsForm/index.svelte | 171 ++++---- src/lib/components/admin/Users.svelte | 67 ++- src/lib/components/modals/AddUserModal.svelte | 92 ++-- .../components/modals/GroupSelectModal.svelte | 50 +-- .../components/modals/InviteUserModal.svelte | 112 +++-- .../components/navigation/BottomTabs.svelte | 53 +-- src/lib/components/navigation/NavBar.svelte | 101 +++-- .../navigation/NavMenu/GroupSubMenu.svelte | 162 +++---- .../navigation/NavMenu/NavMenu.svelte | 114 ++--- .../navigation/NavigationDrawer.svelte | 48 +- .../navigation/NavigationLoadingBar.svelte | 22 +- src/lib/components/navigation/navigation.ts | 30 +- .../components/wishlists/ApprovalAlert.svelte | 30 +- .../wishlists/ItemCard/ApprovalButtons.svelte | 60 ++- .../wishlists/ItemCard/ClaimButtons.svelte | 73 ++-- .../wishlists/ItemCard/ItemCard.svelte | 400 ++++++++--------- .../components/wishlists/ItemDrawer.svelte | 50 +-- src/lib/components/wishlists/ItemForm.svelte | 277 ++++++------ .../wishlists/chips/BaseChip.svelte | 159 ++++--- .../wishlists/chips/ClaimFilter.svelte | 36 +- .../components/wishlists/chips/SortBy.svelte | 42 +- src/lib/schema.ts | 6 +- src/lib/server/auth.ts | 24 +- src/lib/server/config.ts | 284 ++++++------ src/lib/server/email.ts | 124 +++--- src/lib/server/group-membership.ts | 52 +-- src/lib/server/image-util.ts | 16 +- src/lib/server/invite-user.ts | 84 ++-- src/lib/server/prisma.ts | 4 +- src/lib/server/shopping/helpers.ts | 30 +- src/lib/server/shopping/index.ts | 410 +++++++++--------- src/lib/server/token.ts | 22 +- src/lib/stores/idle.ts | 96 ++-- src/lib/stores/viewed-items.ts | 16 +- src/lib/validations.ts | 42 +- src/lib/zxcvbn.ts | 20 +- src/routes/+error.svelte | 40 +- src/routes/+layout.server.ts | 4 +- src/routes/+layout.svelte | 200 ++++----- src/routes/+page.server.ts | 166 +++---- src/routes/+page.svelte | 48 +- src/routes/account/+page.server.ts | 192 ++++---- src/routes/account/+page.svelte | 82 ++-- src/routes/admin/+layout.svelte | 56 +-- src/routes/admin/+page.server.ts | 16 +- src/routes/admin/actions/+page.svelte | 2 +- src/routes/admin/groups/+page.server.ts | 48 +- src/routes/admin/groups/+page.svelte | 6 +- .../admin/groups/[groupId]/+layout.server.ts | 24 +- .../admin/groups/[groupId]/+layout@.svelte | 122 +++--- .../admin/groups/[groupId]/+page.server.ts | 16 +- .../groups/[groupId]/members/+page.server.ts | 122 +++--- .../groups/[groupId]/members/+page.svelte | 219 +++++----- .../groups/[groupId]/settings/+page.server.ts | 112 ++--- .../groups/[groupId]/settings/+page.svelte | 63 ++- src/routes/admin/settings/+page.server.ts | 128 +++--- src/routes/admin/settings/+page.svelte | 8 +- src/routes/admin/users/+page.server.ts | 88 ++-- src/routes/admin/users/+page.svelte | 6 +- .../admin/users/[username]/+page.server.ts | 144 +++--- .../admin/users/[username]/+page@.svelte | 138 +++--- src/routes/api/assets/[id]/+server.ts | 26 +- src/routes/api/groups/+server.ts | 38 +- src/routes/api/groups/[groupId]/+server.ts | 88 ++-- src/routes/api/groups/[groupId]/auth.ts | 51 ++- .../[groupId]/users/[userId]/+server.ts | 236 +++++----- src/routes/api/items/+server.ts | 50 +-- src/routes/api/items/[itemId]/+server.ts | 242 +++++------ src/routes/api/product/+server.ts | 60 +-- src/routes/api/users/+server.ts | 22 +- src/routes/api/users/[userId]/+server.ts | 84 ++-- .../api/users/[userId]/groups/+server.ts | 91 ++-- .../[userId]/groups/[groupId]/+server.ts | 107 +++-- src/routes/claims/+page.server.ts | 74 ++-- src/routes/claims/+page.svelte | 82 ++-- src/routes/forgot-password/+page.server.ts | 88 ++-- src/routes/forgot-password/+page.svelte | 120 +++-- src/routes/group-error/+page.server.ts | 8 +- src/routes/group-error/+page.svelte | 14 +- src/routes/login/+page.server.ts | 64 +-- src/routes/login/+page.svelte | 126 +++--- src/routes/logout/+server.ts | 10 +- src/routes/reset-password/+page.server.ts | 148 +++---- src/routes/reset-password/+page.svelte | 158 +++---- src/routes/signup/+page.server.ts | 198 ++++----- src/routes/signup/+page.svelte | 157 ++++--- .../wishlists/[username]/+page.server.ts | 186 ++++---- src/routes/wishlists/[username]/+page.svelte | 196 ++++----- .../[username]/edit/[itemId]/+page.server.ts | 145 +++---- .../[username]/edit/[itemId]/+page.svelte | 48 +- .../wishlists/[username]/new/+page.server.ts | 145 +++---- .../wishlists/[username]/new/+page.svelte | 82 ++-- src/routes/wishlists/me/+page.server.ts | 10 +- src/theme.postcss | 328 +++++++------- svelte.config.js | 20 +- tailwind.config.ts | 32 +- theme.ts | 194 ++++----- tsconfig.json | 30 +- vite.config.ts | 84 ++-- 134 files changed, 5801 insertions(+), 6004 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index f0135fb..bbaf867 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,47 +1,42 @@ module.exports = { - root: true, - parser: "@typescript-eslint/parser", - extends: [ - "eslint:recommended", - "plugin:svelte/prettier", - "plugin:@typescript-eslint/recommended", - "prettier" - ], - plugins: ["@typescript-eslint"], - ignorePatterns: ["*.cjs"], - rules: { - "svelte/sort-attributes": "warn", - "svelte/shorthand-directive": [ - "warn", - { - prefer: "always" - } - ] - }, - overrides: [ - { - files: ["*.svelte"], - parser: "svelte-eslint-parser", - // Parse the ` - - - - - - - - - - %sveltekit.head% - - -
%sveltekit.body%
- + + + + + + + + + + + + + + %sveltekit.head% + + +
%sveltekit.body%
+ diff --git a/src/app.postcss b/src/app.postcss index 30186c7..80f4496 100644 --- a/src/app.postcss +++ b/src/app.postcss @@ -1,101 +1,101 @@ @font-face { - font-family: "Lato"; - src: - url("/fonts/Lato-Regular.woff2") format("woff2"), - url("/fonts/Lato-Regular.woff") format("woff"); - font-weight: normal; - font-style: normal; - font-display: swap; + font-family: "Lato"; + src: + url("/fonts/Lato-Regular.woff2") format("woff2"), + url("/fonts/Lato-Regular.woff") format("woff"); + font-weight: normal; + font-style: normal; + font-display: swap; } @font-face { - font-family: "Lato"; - src: - url("/fonts/Lato-Light.woff2") format("woff2"), - url("/fonts/Lato-Light.woff") format("woff"); - font-weight: 300; - font-style: normal; - font-display: swap; + font-family: "Lato"; + src: + url("/fonts/Lato-Light.woff2") format("woff2"), + url("/fonts/Lato-Light.woff") format("woff"); + font-weight: 300; + font-style: normal; + font-display: swap; } @font-face { - font-family: "Lato"; - src: - url("/fonts/Lato-LightItalic.woff2") format("woff2"), - url("/fonts/Lato-LightItalic.woff") format("woff"); - font-weight: 300; - font-style: italic; - font-display: swap; + font-family: "Lato"; + src: + url("/fonts/Lato-LightItalic.woff2") format("woff2"), + url("/fonts/Lato-LightItalic.woff") format("woff"); + font-weight: 300; + font-style: italic; + font-display: swap; } @font-face { - font-family: "Lato Hairline"; - src: - url("/fonts/Lato-Hairline.woff2") format("woff2"), - url("/fonts/Lato-Hairline.woff") format("woff"); - font-weight: 300; - font-style: normal; - font-display: swap; + font-family: "Lato Hairline"; + src: + url("/fonts/Lato-Hairline.woff2") format("woff2"), + url("/fonts/Lato-Hairline.woff") format("woff"); + font-weight: 300; + font-style: normal; + font-display: swap; } @font-face { - font-family: "Lato"; - src: - url("/fonts/Lato-Italic.woff2") format("woff2"), - url("/fonts/Lato-Italic.woff") format("woff"); - font-weight: normal; - font-style: italic; - font-display: swap; + font-family: "Lato"; + src: + url("/fonts/Lato-Italic.woff2") format("woff2"), + url("/fonts/Lato-Italic.woff") format("woff"); + font-weight: normal; + font-style: italic; + font-display: swap; } @font-face { - font-family: "Lato"; - src: - url("/fonts/Lato-Bold.woff2") format("woff2"), - url("/fonts/Lato-Bold.woff") format("woff"); - font-weight: bold; - font-style: normal; - font-display: swap; + font-family: "Lato"; + src: + url("/fonts/Lato-Bold.woff2") format("woff2"), + url("/fonts/Lato-Bold.woff") format("woff"); + font-weight: bold; + font-style: normal; + font-display: swap; } @font-face { - font-family: "Lato Hairline"; - src: - url("/fonts/Lato-HairlineItalic.woff2") format("woff2"), - url("/fonts/Lato-HairlineItalic.woff") format("woff"); - font-weight: 300; - font-style: italic; - font-display: swap; + font-family: "Lato Hairline"; + src: + url("/fonts/Lato-HairlineItalic.woff2") format("woff2"), + url("/fonts/Lato-HairlineItalic.woff") format("woff"); + font-weight: 300; + font-style: italic; + font-display: swap; } @font-face { - font-family: "Lato"; - src: - url("/fonts/Lato-Black.woff2") format("woff2"), - url("/fonts/Lato-Black.woff") format("woff"); - font-weight: 900; - font-style: normal; - font-display: swap; + font-family: "Lato"; + src: + url("/fonts/Lato-Black.woff2") format("woff2"), + url("/fonts/Lato-Black.woff") format("woff"); + font-weight: 900; + font-style: normal; + font-display: swap; } @font-face { - font-family: "Lato"; - src: - url("/fonts/Lato-BlackItalic.woff2") format("woff2"), - url("/fonts/Lato-BlackItalic.woff") format("woff"); - font-weight: 900; - font-style: italic; - font-display: swap; + font-family: "Lato"; + src: + url("/fonts/Lato-BlackItalic.woff2") format("woff2"), + url("/fonts/Lato-BlackItalic.woff") format("woff"); + font-weight: 900; + font-style: italic; + font-display: swap; } @font-face { - font-family: "Lato"; - src: - url("/fonts/Lato-BoldItalic.woff2") format("woff2"), - url("/fonts/Lato-BoldItalic.woff") format("woff"); - font-weight: bold; - font-style: italic; - font-display: swap; + font-family: "Lato"; + src: + url("/fonts/Lato-BoldItalic.woff2") format("woff2"), + url("/fonts/Lato-BoldItalic.woff") format("woff"); + font-weight: bold; + font-style: italic; + font-display: swap; } @tailwind base; @@ -105,22 +105,22 @@ html, body { - @apply h-full overflow-hidden; + @apply h-full overflow-hidden; } -a:not(.unstyled):is(:not(.prose *)):not(.btn):not(.btn-icon):not(.app-bar a):not(.logo-item):not( - a.card - ):not(.list-nav a) { - @apply text-primary-700 underline decoration-primary-500/20 decoration-dotted underline-offset-4 hover:decoration-primary-500 dark:text-primary-500; +a:not(.unstyled):is(:not(.prose *)):not(.btn):not(.btn-icon):not(.app-bar a):not(.logo-item):not(a.card):not( + .list-nav a + ) { + @apply text-primary-700 underline decoration-primary-500/20 decoration-dotted underline-offset-4 hover:decoration-primary-500 dark:text-primary-500; } label:not(.unstyled) { - @apply space-y-2; + @apply space-y-2; } /*! purgecss start ignore */ .ptr--icon, .ptr--text { - @apply text-primary-900 dark:text-primary-50; + @apply text-primary-900 dark:text-primary-50; } /*! purgecss end ignore */ diff --git a/src/hooks.server.ts b/src/hooks.server.ts index 1bed0be..65d6b62 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -2,6 +2,6 @@ import { auth } from "$lib/server/auth"; import type { Handle } from "@sveltejs/kit"; export const handle: Handle = async ({ event, resolve }) => { - event.locals = auth.handleRequest(event); - return await resolve(event); + event.locals = auth.handleRequest(event); + return await resolve(event); }; diff --git a/src/lib/api/groups.ts b/src/lib/api/groups.ts index 3831918..2469ed4 100644 --- a/src/lib/api/groups.ts +++ b/src/lib/api/groups.ts @@ -2,85 +2,77 @@ import { Role } from "$lib/schema"; import type { Group, UserGroupMembership } from "@prisma/client"; export class GroupAPI { - groupId: string; - constructor(groupId: string) { - this.groupId = groupId; - } + groupId: string; + constructor(groupId: string) { + this.groupId = groupId; + } - _makeRequest = async (method: string, path = "", body?: Record) => { - const options: RequestInit = { - method, - headers: { - "content-type": "application/json", - accept: "application/json" - } - }; + _makeRequest = async (method: string, path = "", body?: Record) => { + const options: RequestInit = { + method, + headers: { + "content-type": "application/json", + accept: "application/json" + } + }; - if (body) options.body = JSON.stringify(body); + if (body) options.body = JSON.stringify(body); - return await fetch(`/api/groups/${this.groupId}${path}`, options); - }; + return await fetch(`/api/groups/${this.groupId}${path}`, options); + }; - addMember = async (userId: string, manager = false): Promise => { - return await this._makeRequest("PUT", `/users/${userId}`, { manager }).then((resp) => - resp.json() - ); - }; + addMember = async (userId: string, manager = false): Promise => { + return await this._makeRequest("PUT", `/users/${userId}`, { manager }).then((resp) => resp.json()); + }; - removeMember = async (userId: string): Promise => { - return await this._makeRequest("DELETE", `/users/${userId}`).then((resp) => resp.json()); - }; + removeMember = async (userId: string): Promise => { + return await this._makeRequest("DELETE", `/users/${userId}`).then((resp) => resp.json()); + }; - makeManager = async (userId: string): Promise => { - return await this._makeRequest("PATCH", `/users/${userId}`, { manager: true }).then((resp) => - resp.json() - ); - }; + makeManager = async (userId: string): Promise => { + return await this._makeRequest("PATCH", `/users/${userId}`, { manager: true }).then((resp) => resp.json()); + }; - removeManager = async (userId: string): Promise => { - return await this._makeRequest("PATCH", `/users/${userId}`, { manager: false }).then((resp) => - resp.json() - ); - }; + removeManager = async (userId: string): Promise => { + return await this._makeRequest("PATCH", `/users/${userId}`, { manager: false }).then((resp) => resp.json()); + }; - isManager = async (userId: string): Promise => { - return await this._makeRequest("GET", `/users/${userId}`) - .then(async (resp) => { - const content = await resp.json(); - return content.membership as UserGroupMembership; - }) - .then( - (membership) => membership.roleId === Role.GROUP_MANAGER || membership.roleId === Role.ADMIN - ); - }; + isManager = async (userId: string): Promise => { + return await this._makeRequest("GET", `/users/${userId}`) + .then(async (resp) => { + const content = await resp.json(); + return content.membership as UserGroupMembership; + }) + .then((membership) => membership.roleId === Role.GROUP_MANAGER || membership.roleId === Role.ADMIN); + }; - delete = async (): Promise => { - return await this._makeRequest("DELETE").then((resp) => resp.json()); - }; + delete = async (): Promise => { + return await this._makeRequest("DELETE").then((resp) => resp.json()); + }; - update = async (group: Partial) => { - return await this._makeRequest("PATCH", "/", group).then((resp) => resp.json()); - }; + update = async (group: Partial) => { + return await this._makeRequest("PATCH", "/", group).then((resp) => resp.json()); + }; } export class GroupsAPI { - _makeRequest = async (method: string, body?: Record) => { - const options: RequestInit = { - method, - headers: { - "content-type": "application/json", - accept: "application/json" - } - }; + _makeRequest = async (method: string, body?: Record) => { + const options: RequestInit = { + method, + headers: { + "content-type": "application/json", + accept: "application/json" + } + }; - if (body) options.body = JSON.stringify(body); + if (body) options.body = JSON.stringify(body); - return await fetch(`/api/groups`, options); - }; + return await fetch(`/api/groups`, options); + }; - create = async (name: string): Promise => { - return await this._makeRequest("PUT", { name }) - .then((resp) => resp.json()) - .then(({ group }) => group); - }; + create = async (name: string): Promise => { + return await this._makeRequest("PUT", { name }) + .then((resp) => resp.json()) + .then(({ group }) => group); + }; } diff --git a/src/lib/api/items.ts b/src/lib/api/items.ts index 3c3c7f3..eedfc67 100644 --- a/src/lib/api/items.ts +++ b/src/lib/api/items.ts @@ -1,68 +1,68 @@ export class ItemAPI { - itemId: number; - constructor(itemId: number) { - this.itemId = itemId; - } + itemId: number; + constructor(itemId: number) { + this.itemId = itemId; + } - _makeRequest = async (method: string, body?: Record) => { - const options: RequestInit = { - method, - headers: { - "content-type": "application/json", - accept: "application/json" - } - }; + _makeRequest = async (method: string, body?: Record) => { + const options: RequestInit = { + method, + headers: { + "content-type": "application/json", + accept: "application/json" + } + }; - if (body) options.body = JSON.stringify(body); + if (body) options.body = JSON.stringify(body); - return await fetch(`/api/items/${this.itemId}`, options); - }; + return await fetch(`/api/items/${this.itemId}`, options); + }; - delete = async () => { - return await this._makeRequest("DELETE"); - }; + delete = async () => { + return await this._makeRequest("DELETE"); + }; - approve = async () => { - return await this._makeRequest("PATCH", { approved: true }); - }; + approve = async () => { + return await this._makeRequest("PATCH", { approved: true }); + }; - deny = async () => { - return await this.delete(); - }; + deny = async () => { + return await this.delete(); + }; - claim = async (userId: string) => { - return await this._makeRequest("PATCH", { pledgedById: userId }); - }; + claim = async (userId: string) => { + return await this._makeRequest("PATCH", { pledgedById: userId }); + }; - unclaim = async () => { - return await this._makeRequest("PATCH", { pledgedById: "0" }); - }; + unclaim = async () => { + return await this._makeRequest("PATCH", { pledgedById: "0" }); + }; - purchase = async () => { - return await this._makeRequest("PATCH", { purchased: true }); - }; + purchase = async () => { + return await this._makeRequest("PATCH", { purchased: true }); + }; - unpurchase = async () => { - return await this._makeRequest("PATCH", { purchased: false }); - }; + unpurchase = async () => { + return await this._makeRequest("PATCH", { purchased: false }); + }; } export class ItemsAPI { - _makeRequest = async (method: string, path: string, body?: Record) => { - const options: RequestInit = { - method, - headers: { - "content-type": "application/json", - accept: "application/json" - } - }; + _makeRequest = async (method: string, path: string, body?: Record) => { + const options: RequestInit = { + method, + headers: { + "content-type": "application/json", + accept: "application/json" + } + }; - if (body) options.body = JSON.stringify(body); + if (body) options.body = JSON.stringify(body); - return await fetch(`/api/items${path}`, options); - }; + return await fetch(`/api/items${path}`, options); + }; - delete = async (groupId?: string) => { - return await this._makeRequest("DELETE", groupId ? `?groupId=${groupId}` : ""); - }; + delete = async (groupId?: string) => { + return await this._makeRequest("DELETE", groupId ? `?groupId=${groupId}` : ""); + }; } diff --git a/src/lib/api/users.ts b/src/lib/api/users.ts index ed9b786..385969a 100644 --- a/src/lib/api/users.ts +++ b/src/lib/api/users.ts @@ -1,61 +1,61 @@ import type { Group, UserGroupMembership } from "@prisma/client"; export class UserAPI { - userId: string; - constructor(userId: string) { - this.userId = userId; - } - - _makeRequest = async (method: string, path = "", body?: Record) => { - const options: RequestInit = { - method, - headers: { - "content-type": "application/json", - accept: "application/json" - } - }; - - if (body) options.body = JSON.stringify(body); - - return await fetch(`/api/users/${this.userId}${path}`, options); - }; - - groups = async (): Promise => { - return await this._makeRequest("GET", "/groups") - .then((resp) => resp.json()) - .then(({ groups }) => groups); - }; - - activeGroup = async (): Promise => { - return await this._makeRequest("GET", "/groups?active=true") - .then((resp) => resp.json()) - .then(({ groups }) => groups[0]); - }; - - setActiveGroup = async (groupId: string): Promise => { - return await this._makeRequest("PATCH", `/groups/${groupId}`, { active: true }) - .then((resp) => resp.json()) - .then(({ membership }) => membership); - }; + userId: string; + constructor(userId: string) { + this.userId = userId; + } + + _makeRequest = async (method: string, path = "", body?: Record) => { + const options: RequestInit = { + method, + headers: { + "content-type": "application/json", + accept: "application/json" + } + }; + + if (body) options.body = JSON.stringify(body); + + return await fetch(`/api/users/${this.userId}${path}`, options); + }; + + groups = async (): Promise => { + return await this._makeRequest("GET", "/groups") + .then((resp) => resp.json()) + .then(({ groups }) => groups); + }; + + activeGroup = async (): Promise => { + return await this._makeRequest("GET", "/groups?active=true") + .then((resp) => resp.json()) + .then(({ groups }) => groups[0]); + }; + + setActiveGroup = async (groupId: string): Promise => { + return await this._makeRequest("PATCH", `/groups/${groupId}`, { active: true }) + .then((resp) => resp.json()) + .then(({ membership }) => membership); + }; } export class UsersAPI { - _makeRequest = async (method: string, query = "") => { - const options: RequestInit = { - method, - headers: { - accept: "application/json" - } - }; - - return await fetch(`/api/users${query}`, options); - }; - - all = async () => { - return await this._makeRequest("GET"); - }; - - search = async (search: string) => { - return await this._makeRequest("GET", `?name=${search}`); - }; + _makeRequest = async (method: string, query = "") => { + const options: RequestInit = { + method, + headers: { + accept: "application/json" + } + }; + + return await fetch(`/api/users${query}`, options); + }; + + all = async () => { + return await this._makeRequest("GET"); + }; + + search = async (search: string) => { + return await this._makeRequest("GET", `?name=${search}`); + }; } diff --git a/src/lib/components/Avatar.svelte b/src/lib/components/Avatar.svelte index 4de0412..233ddde 100644 --- a/src/lib/components/Avatar.svelte +++ b/src/lib/components/Avatar.svelte @@ -1,15 +1,15 @@ x + y.at(0), "")} - src={user?.picture ? `/api/assets/${user.picture}` : ""} - {...$$props} + background="bg-primary-400-500-token" + initials={user?.name.split(" ").reduce((x, y) => x + y.at(0), "")} + src={user?.picture ? `/api/assets/${user.picture}` : ""} + {...$$props} /> diff --git a/src/lib/components/BackButton.svelte b/src/lib/components/BackButton.svelte index 117f74e..113c1d5 100644 --- a/src/lib/components/BackButton.svelte +++ b/src/lib/components/BackButton.svelte @@ -1,35 +1,28 @@ {#if disabled} - - Wishlist Logo - Wishlist - + + Wishlist Logo + Wishlist + {:else} - + {/if} diff --git a/src/lib/components/Backdrop.svelte b/src/lib/components/Backdrop.svelte index 6a8eebe..9ae4a2a 100644 --- a/src/lib/components/Backdrop.svelte +++ b/src/lib/components/Backdrop.svelte @@ -1,19 +1,14 @@
-
- -
- {text} +
+ +
+ {text}
diff --git a/src/lib/components/Drawer.svelte b/src/lib/components/Drawer.svelte index bb84fd9..7c58df1 100644 --- a/src/lib/components/Drawer.svelte +++ b/src/lib/components/Drawer.svelte @@ -1,16 +1,16 @@ - {#if $drawerStore.id === "nav"} - - {:else} - - {/if} + {#if $drawerStore.id === "nav"} + + {:else} + + {/if} diff --git a/src/lib/components/PasswordInput.svelte b/src/lib/components/PasswordInput.svelte index 4047a86..a042f3b 100644 --- a/src/lib/components/PasswordInput.svelte +++ b/src/lib/components/PasswordInput.svelte @@ -1,115 +1,109 @@ {#if strengthMeter && value !== "" && strength} -
- -
- -
-
+
+ +
+ +
+
-
- {#if strength.feedback.warning} -
- -

{strength.feedback.warning}

-
- {/if} -
    - {#each strength.feedback.suggestions as suggestion} -
  • - -

    {suggestion}

    -
  • - {/each} -
-
+
+ {#if strength.feedback.warning} +
+ +

{strength.feedback.warning}

+
+ {/if} +
    + {#each strength.feedback.suggestions as suggestion} +
  • + +

    {suggestion}

    +
  • + {/each} +
+
- {#if strength.score < 3} -

Weak

- {:else if strength.score < 4} -

Moderate

- {:else} -

Strong

- {/if} + {#if strength.score < 3} +

Weak

+ {:else if strength.score < 4} +

Moderate

+ {:else} +

Strong

+ {/if} {/if} diff --git a/src/lib/components/Search.svelte b/src/lib/components/Search.svelte index 035fcd8..25c4c53 100644 --- a/src/lib/components/Search.svelte +++ b/src/lib/components/Search.svelte @@ -1,25 +1,25 @@ diff --git a/src/lib/components/TokenCopy.svelte b/src/lib/components/TokenCopy.svelte index d7ae7e2..3cc625b 100644 --- a/src/lib/components/TokenCopy.svelte +++ b/src/lib/components/TokenCopy.svelte @@ -1,43 +1,43 @@
- - - - - - -
- -
- Copy to clipboard -
-
- {#if copiedVisible} - Copied! - {/if} -
+ + + + + + +
+ +
+ Copy to clipboard +
+
+ {#if copiedVisible} + Copied! + {/if} +
diff --git a/src/lib/components/UserCard.svelte b/src/lib/components/UserCard.svelte index ff20b5a..b9f056f 100644 --- a/src/lib/components/UserCard.svelte +++ b/src/lib/components/UserCard.svelte @@ -1,40 +1,40 @@ -
-
- -
- - {user.name} - -
- - - {!hideCount && user._count ? `${user._count.items}/` : ""}{user.items.length} - - {#if newItems} - - {/if} -
-
-
-
+
+
+ +
+ + {user.name} + +
+ + + {!hideCount && user._count ? `${user._count.items}/` : ""}{user.items.length} + + {#if newItems} + + {/if} +
+
+
+
diff --git a/src/lib/components/account/ChangePassword.svelte b/src/lib/components/account/ChangePassword.svelte index 7bd58ba..9500fe1 100644 --- a/src/lib/components/account/ChangePassword.svelte +++ b/src/lib/components/account/ChangePassword.svelte @@ -1,89 +1,89 @@
{ - return async ({ result, update }) => { - if (result.type === "success") { - const t = { - message: "Password updated successfully", - autohide: true, - timeout: 5000 - }; + method="POST" + use:enhance={() => { + return async ({ result, update }) => { + if (result.type === "success") { + const t = { + message: "Password updated successfully", + autohide: true, + timeout: 5000 + }; - passwordReset.current = ""; - toastStore.trigger(t); - } + passwordReset.current = ""; + toastStore.trigger(t); + } - passwordReset.new = ""; - passwordReset.confirm = ""; - update(); - }; - }} + passwordReset.new = ""; + passwordReset.confirm = ""; + update(); + }; + }} > -
- -
- -
+
+ +
+ +
- - {#if passwordReset.new !== passwordReset.confirm} - Passwords must match - {/if} - {#if $page.form?.error && $page.form?.errors} -
    - {#each $page.form.errors as error} - {#if error.field === "newPassword"} - {#each error.message.split("\n") as message} -
  • {message}
  • - {/each} - {:else} -
  • {error.message}
  • - {/if} - {/each} -
- {/if} - -
+ + {#if passwordReset.new !== passwordReset.confirm} + Passwords must match + {/if} + {#if $page.form?.error && $page.form?.errors} +
    + {#each $page.form.errors as error} + {#if error.field === "newPassword"} + {#each error.message.split("\n") as message} +
  • {message}
  • + {/each} + {:else} +
  • {error.message}
  • + {/if} + {/each} +
+ {/if} + +
diff --git a/src/lib/components/account/EditProfile.svelte b/src/lib/components/account/EditProfile.svelte index 33527dc..96ba2eb 100644 --- a/src/lib/components/account/EditProfile.svelte +++ b/src/lib/components/account/EditProfile.svelte @@ -1,62 +1,60 @@
-
- +
+ - + - + - {#if $page.form?.error && $page.form?.errors} -
    - {#each $page.form.errors as error} -
  • {error.message}
  • - {/each} -
- {/if} + {#if $page.form?.error && $page.form?.errors} +
    + {#each $page.form.errors as error} +
  • {error.message}
  • + {/each} +
+ {/if} - -
+ +
diff --git a/src/lib/components/admin/Actions/ClearListsButton.svelte b/src/lib/components/admin/Actions/ClearListsButton.svelte index 7f26fda..be9d9ba 100644 --- a/src/lib/components/admin/Actions/ClearListsButton.svelte +++ b/src/lib/components/admin/Actions/ClearListsButton.svelte @@ -1,49 +1,49 @@ diff --git a/src/lib/components/admin/ActionsForm.svelte b/src/lib/components/admin/ActionsForm.svelte index 3a97625..24bd458 100644 --- a/src/lib/components/admin/ActionsForm.svelte +++ b/src/lib/components/admin/ActionsForm.svelte @@ -1,7 +1,7 @@
- +
diff --git a/src/lib/components/admin/Groups.svelte b/src/lib/components/admin/Groups.svelte index 8d05827..7b247fb 100644 --- a/src/lib/components/admin/Groups.svelte +++ b/src/lib/components/admin/Groups.svelte @@ -1,82 +1,82 @@
- - + +
{#if groupData} - +
{/if} diff --git a/src/lib/components/admin/InviteUser.svelte b/src/lib/components/admin/InviteUser.svelte index 5585b6c..93d0895 100644 --- a/src/lib/components/admin/InviteUser.svelte +++ b/src/lib/components/admin/InviteUser.svelte @@ -1,83 +1,83 @@ { - formData.set("invite-email", email); - formData.set("invite-group", groupId); + class="flex flex-col space-y-4 md:flex-row md:items-end md:space-x-4 md:space-y-0" + method="POST" + use:enhance={({ formData }) => { + formData.set("invite-email", email); + formData.set("invite-group", groupId); - return async ({ result, update }) => { - if (result.type === "success" && config.smtp.enable) { - triggerToast(); - } - update(); - }; - }} + return async ({ result, update }) => { + if (result.type === "success" && config.smtp.enable) { + triggerToast(); + } + update(); + }; + }} > - + - - {#if config.smtp.enable} - - {/if} + + {#if config.smtp.enable} + + {/if} - {#if form?.url} -
- Invite link - This invite link is only valid for one signup -
- {/if} + {#if form?.url} +
+ Invite link + This invite link is only valid for one signup +
+ {/if} - - - + {/if} diff --git a/src/lib/components/admin/SettingsForm/Claims.svelte b/src/lib/components/admin/SettingsForm/Claims.svelte index 6f0f155..402f0ea 100644 --- a/src/lib/components/admin/SettingsForm/Claims.svelte +++ b/src/lib/components/admin/SettingsForm/Claims.svelte @@ -1,17 +1,11 @@
-

Claims

- +

Claims

+
diff --git a/src/lib/components/admin/SettingsForm/PublicSignup.svelte b/src/lib/components/admin/SettingsForm/PublicSignup.svelte index 4077e3b..a8735f9 100644 --- a/src/lib/components/admin/SettingsForm/PublicSignup.svelte +++ b/src/lib/components/admin/SettingsForm/PublicSignup.svelte @@ -1,17 +1,11 @@
-

Public Signup

- +

Public Signup

+
diff --git a/src/lib/components/admin/SettingsForm/SMTP.svelte b/src/lib/components/admin/SettingsForm/SMTP.svelte index c2695b2..d862589 100644 --- a/src/lib/components/admin/SettingsForm/SMTP.svelte +++ b/src/lib/components/admin/SettingsForm/SMTP.svelte @@ -1,90 +1,84 @@
-

SMTP

- - {#if enabled} -
- - - - - - -
- {/if} +

SMTP

+ + {#if enabled} +
+ + + + + + +
+ {/if}
diff --git a/src/lib/components/admin/SettingsForm/Suggestions.svelte b/src/lib/components/admin/SettingsForm/Suggestions.svelte index ed73fb3..a7cb133 100644 --- a/src/lib/components/admin/SettingsForm/Suggestions.svelte +++ b/src/lib/components/admin/SettingsForm/Suggestions.svelte @@ -1,28 +1,28 @@
-

Suggestions

- - {#if enabled} - - {/if} +

Suggestions

+ + {#if enabled} + + {/if}
diff --git a/src/lib/components/admin/SettingsForm/index.svelte b/src/lib/components/admin/SettingsForm/index.svelte index 0fce2c6..74fed5f 100644 --- a/src/lib/components/admin/SettingsForm/index.svelte +++ b/src/lib/components/admin/SettingsForm/index.svelte @@ -1,99 +1,96 @@ { - if (action.search === "?/send-test") { - sending = true; - } - return ({ action, result }) => { - if (action.search === "?/settings" && result.type === "success") { - saved = true; - } - if (action.search === "?/send-test" && result.type === "success") { - sending = false; - sent = true; - } - }; - }} + action="?/settings" + method="POST" + use:enhance={({ action }) => { + if (action.search === "?/send-test") { + sending = true; + } + return ({ action, result }) => { + if (action.search === "?/settings" && result.type === "success") { + saved = true; + } + if (action.search === "?/send-test" && result.type === "success") { + sending = false; + sent = true; + } + }; + }} > -
-
- -
-
- -
-
- -
+
+
+ +
+
+ +
+
+ +
-
- -
-
+
+ +
+
- {#if form?.error && form?.errors} -
    - {#each form.errors as error} -
  • {error.message}
  • - {/each} -
- {/if} + {#if form?.error && form?.errors} +
    + {#each form.errors as error} +
  • {error.message}
  • + {/each} +
+ {/if} -
- - {#if saved && config.smtp.enable} - - {/if} -
+
+ + {#if saved && config.smtp.enable} + + {/if} +
diff --git a/src/lib/components/admin/Users.svelte b/src/lib/components/admin/Users.svelte index a1391c8..6747c35 100644 --- a/src/lib/components/admin/Users.svelte +++ b/src/lib/components/admin/Users.svelte @@ -1,49 +1,44 @@
- - + +
{#if userData} -
+
{/if} diff --git a/src/lib/components/modals/AddUserModal.svelte b/src/lib/components/modals/AddUserModal.svelte index c0d4e61..46401cf 100644 --- a/src/lib/components/modals/AddUserModal.svelte +++ b/src/lib/components/modals/AddUserModal.svelte @@ -1,56 +1,56 @@
-
Add User
- Search for a user to add to the group - - - {#if users.length > 0} - - {#each users as user} - - {user.name} - - {/each} - - {/if} - -
- - -
+
Add User
+ Search for a user to add to the group + + + {#if users.length > 0} + + {#each users as user} + + {user.name} + + {/each} + + {/if} + +
+ + +
diff --git a/src/lib/components/modals/GroupSelectModal.svelte b/src/lib/components/modals/GroupSelectModal.svelte index 31429ea..5e4168d 100644 --- a/src/lib/components/modals/GroupSelectModal.svelte +++ b/src/lib/components/modals/GroupSelectModal.svelte @@ -1,33 +1,33 @@
-
Select Group
- - {#each groups as group} - - {group.name} - - {/each} - +
Select Group
+ + {#each groups as group} + + {group.name} + + {/each} + -
- - -
+
+ + +
diff --git a/src/lib/components/modals/InviteUserModal.svelte b/src/lib/components/modals/InviteUserModal.svelte index b49ddd1..d7df4af 100644 --- a/src/lib/components/modals/InviteUserModal.svelte +++ b/src/lib/components/modals/InviteUserModal.svelte @@ -1,70 +1,68 @@
-
Invite User
+
Invite User
- {#if smtpEnabled} - Enter the user's email and select a group for the user to join - {:else} - Select a group for the user to join. An invite link will be generated - {/if} + {#if smtpEnabled} + Enter the user's email and select a group for the user to join + {:else} + Select a group for the user to join. An invite link will be generated + {/if} - {#if smtpEnabled} - - {/if} + {#if smtpEnabled} + + {/if} - {#if groups && groups.length > 0} - - - {#each groups as group} - - {group.name} - - {/each} - - {/if} + {#if groups && groups.length > 0} + + + {#each groups as group} + + {group.name} + + {/each} + + {/if} -
- - -
+
+ + +
diff --git a/src/lib/components/navigation/BottomTabs.svelte b/src/lib/components/navigation/BottomTabs.svelte index 98ae50c..ee5f86c 100644 --- a/src/lib/components/navigation/BottomTabs.svelte +++ b/src/lib/components/navigation/BottomTabs.svelte @@ -1,37 +1,32 @@ {#if user && $isInstalled} - - {#each navItems as navItem, value} - goto(`${navItem.href}`)} - > - - - {/each} - + + {#each navItems as navItem, value} + goto(`${navItem.href}`)}> + + + {/each} + {/if} diff --git a/src/lib/components/navigation/NavBar.svelte b/src/lib/components/navigation/NavBar.svelte index cdb6d95..68b0301 100644 --- a/src/lib/components/navigation/NavBar.svelte +++ b/src/lib/components/navigation/NavBar.svelte @@ -1,61 +1,58 @@ - -
- {#if user && !$isInstalled} - {#if user} - - {/if} - - Wishlist Logo - Wishlist - - {:else} - - {/if} -
-
+ +
+ {#if user && !$isInstalled} + {#if user} + + {/if} + + Wishlist Logo + Wishlist + + {:else} + + {/if} +
+
- {#if user} - - {/if} + {#if user} + + {/if} - - - + + +
diff --git a/src/lib/components/navigation/NavMenu/GroupSubMenu.svelte b/src/lib/components/navigation/NavMenu/GroupSubMenu.svelte index 91f7ee7..78715e0 100644 --- a/src/lib/components/navigation/NavMenu/GroupSubMenu.svelte +++ b/src/lib/components/navigation/NavMenu/GroupSubMenu.svelte @@ -1,95 +1,95 @@ {#await userAPI.groups() then groups} - {#each groups as group} - {#if group.active} - {#if groups.length > 1} -
  • -
    - - {group.name} -
    -
  • - {/if} - {#if group.isManager} -
  • - -
  • - {/if} - {/if} - {/each} - {#if groups.length > 1} -
  • - -
  • - {/if} + {#each groups as group} + {#if group.active} + {#if groups.length > 1} +
  • +
    + + {group.name} +
    +
  • + {/if} + {#if group.isManager} +
  • + +
  • + {/if} + {/if} + {/each} + {#if groups.length > 1} +
  • + +
  • + {/if} {/await}
  • - +
  • diff --git a/src/lib/components/navigation/NavMenu/NavMenu.svelte b/src/lib/components/navigation/NavMenu/NavMenu.svelte index 8f0a124..ad3f3f8 100644 --- a/src/lib/components/navigation/NavMenu/NavMenu.svelte +++ b/src/lib/components/navigation/NavMenu/NavMenu.svelte @@ -1,67 +1,67 @@ {#if user} - -
    - +
    {:else} - + {/if} diff --git a/src/lib/components/navigation/NavigationDrawer.svelte b/src/lib/components/navigation/NavigationDrawer.svelte index 1afc84f..ad09177 100644 --- a/src/lib/components/navigation/NavigationDrawer.svelte +++ b/src/lib/components/navigation/NavigationDrawer.svelte @@ -1,33 +1,33 @@
    - Wishlist - + Wishlist +
    diff --git a/src/lib/components/navigation/NavigationLoadingBar.svelte b/src/lib/components/navigation/NavigationLoadingBar.svelte index 512c5a4..772d7e5 100644 --- a/src/lib/components/navigation/NavigationLoadingBar.svelte +++ b/src/lib/components/navigation/NavigationLoadingBar.svelte @@ -1,16 +1,16 @@
    - +
    diff --git a/src/lib/components/navigation/navigation.ts b/src/lib/components/navigation/navigation.ts index a455833..51fe967 100644 --- a/src/lib/components/navigation/navigation.ts +++ b/src/lib/components/navigation/navigation.ts @@ -1,17 +1,17 @@ export const navItems = [ - { - label: "Home", - href: "/", - icon: "ion:home" - }, - { - label: "My Wishes", - href: "/wishlists/me", - icon: "ion:gift" - }, - { - label: "My Claims", - href: "/claims", - icon: "ion:albums" - } + { + label: "Home", + href: "/", + icon: "ion:home" + }, + { + label: "My Wishes", + href: "/wishlists/me", + icon: "ion:gift" + }, + { + label: "My Claims", + href: "/claims", + icon: "ion:albums" + } ] satisfies NavItem[]; diff --git a/src/lib/components/wishlists/ApprovalAlert.svelte b/src/lib/components/wishlists/ApprovalAlert.svelte index 47aa03e..e244512 100644 --- a/src/lib/components/wishlists/ApprovalAlert.svelte +++ b/src/lib/components/wishlists/ApprovalAlert.svelte @@ -1,20 +1,20 @@ {#if approvalCount > 0} - + {/if} diff --git a/src/lib/components/wishlists/ItemCard/ApprovalButtons.svelte b/src/lib/components/wishlists/ItemCard/ApprovalButtons.svelte index a6ed3aa..32f4984 100644 --- a/src/lib/components/wishlists/ItemCard/ApprovalButtons.svelte +++ b/src/lib/components/wishlists/ItemCard/ApprovalButtons.svelte @@ -1,42 +1,32 @@
    - {#if !item.approved} - - - {:else if user.username === item.user?.username || user.username === item.addedBy?.username} - - - {/if} + {#if !item.approved} + + + {:else if user.username === item.user?.username || user.username === item.addedBy?.username} + + + {/if}
    diff --git a/src/lib/components/wishlists/ItemCard/ClaimButtons.svelte b/src/lib/components/wishlists/ItemCard/ClaimButtons.svelte index b16d595..278a073 100644 --- a/src/lib/components/wishlists/ItemCard/ClaimButtons.svelte +++ b/src/lib/components/wishlists/ItemCard/ClaimButtons.svelte @@ -1,47 +1,44 @@ {#if user.username === $page.params.username} -
    +
    {:else if item.pledgedBy} - {#if item.pledgedBy.username === user.username} -
    - - -
    - {:else if showName} - Claimed by {item.pledgedBy?.name} - {:else} - Claimed - {/if} + {#if item.pledgedBy.username === user.username} +
    + + +
    + {:else if showName} + Claimed by {item.pledgedBy?.name} + {:else} + Claimed + {/if} {:else} - + {/if} diff --git a/src/lib/components/wishlists/ItemCard/ItemCard.svelte b/src/lib/components/wishlists/ItemCard/ItemCard.svelte index 4700989..7875a82 100644 --- a/src/lib/components/wishlists/ItemCard/ItemCard.svelte +++ b/src/lib/components/wishlists/ItemCard/ItemCard.svelte @@ -1,209 +1,209 @@ diff --git a/src/lib/components/wishlists/ItemDrawer.svelte b/src/lib/components/wishlists/ItemDrawer.svelte index 850dae5..d8eefe8 100644 --- a/src/lib/components/wishlists/ItemDrawer.svelte +++ b/src/lib/components/wishlists/ItemDrawer.svelte @@ -1,32 +1,32 @@
    -
    -
    -
    - - {item.name} - -
    - {#if item.price} - {item.price} - · - {/if} +
    +
    +
    + + {item.name} + +
    + {#if item.price} + {item.price} + · + {/if} - - {#if showFor} - For {item.user?.name} - {:else} - Added by {item.addedBy?.name} - {/if} - -
    -

    {item.note}

    + + {#if showFor} + For {item.user?.name} + {:else} + Added by {item.addedBy?.name} + {/if} + +
    +

    {item.note}

    diff --git a/src/lib/components/wishlists/ItemForm.svelte b/src/lib/components/wishlists/ItemForm.svelte index ffd46d5..41770bc 100644 --- a/src/lib/components/wishlists/ItemForm.svelte +++ b/src/lib/components/wishlists/ItemForm.svelte @@ -1,164 +1,153 @@
    - + - + - + - + - + -