Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,764 changes: 757 additions & 2,007 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"format:check": "prettier --check --plugin prettier-plugin-svelte ./src",
"prepare": "husky && husky install",
"db:types": "supabase gen types typescript --local > src/supabase.ts",
"db:reset": "supabase db reset",
"postinstall": "patch-package"
"db:reset": "supabase db reset"
},
"devDependencies": {
"@melt-ui/pp": "^0.3.2",
Expand Down Expand Up @@ -51,7 +50,6 @@
"jsdom": "^24.1.0",
"lucide-svelte": "^0.473.0",
"msw": "^2.3.1",
"patch-package": "^8.0.0",
"postcss": "^8.4.31",
"prettier": "^3.4.2",
"prettier-plugin-svelte": "^3.0.3",
Expand All @@ -65,7 +63,6 @@
},
"type": "module",
"dependencies": {
"@sentry/sveltekit": "^9.5.0",
"@square/svelte-store": "^0.2.1",
"@supabase/ssr": "^0.3.0",
"@supabase/supabase-js": "^2.33.0",
Expand All @@ -84,7 +81,7 @@
"svelte-file-dropzone": "^2.0.8",
"svelte-legos": "^0.2.2",
"svelte-sonner": "^0.3.22",
"sveltekit-superforms": "^2.3.0",
"sveltekit-superforms": "2.11.0",
"svelty-email": "^0.0.11",
"tailwind-merge": "^2.3.0",
"tailwind-variants": "^0.2.1",
Expand All @@ -104,4 +101,4 @@
],
"*./src": "prettier --write"
}
}
}
28 changes: 14 additions & 14 deletions src/hooks.client.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { PUBLIC_ENVIRONMENT } from '$env/static/public';
import * as Sentry from '@sentry/sveltekit';
import { handleErrorWithSentry } from '@sentry/sveltekit';
// import { PUBLIC_ENVIRONMENT } from '$env/static/public';
// import * as Sentry from '@sentry/sveltekit';
// import { handleErrorWithSentry } from '@sentry/sveltekit';

Sentry.init({
dsn: 'https://485a49edf664c4bad08c2ab0bf87a8eb@o4507622077169664.ingest.de.sentry.io/4507622079660112',
environment: PUBLIC_ENVIRONMENT,
enabled: PUBLIC_ENVIRONMENT !== "local",
tracesSampleRate: 1.0,
// For instance, initialize Session Replay:
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
integrations: [Sentry.replayIntegration()],
});
// Sentry.init({
// dsn: 'https://485a49edf664c4bad08c2ab0bf87a8eb@o4507622077169664.ingest.de.sentry.io/4507622079660112',
// environment: PUBLIC_ENVIRONMENT,
// enabled: PUBLIC_ENVIRONMENT !== "local",
// tracesSampleRate: 1.0,
// // For instance, initialize Session Replay:
// replaysSessionSampleRate: 0.1,
// replaysOnErrorSampleRate: 1.0,
// integrations: [Sentry.replayIntegration()],
// });


export const handleError = handleErrorWithSentry();
// export const handleError = handleErrorWithSentry();
// or alternatively, if you don't have a custom error handler:
// export const handleError = handleErrorWithSentry();
11 changes: 7 additions & 4 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import { sequence } from "@sveltejs/kit/hooks";
import {
PUBLIC_SUPABASE_URL,
PUBLIC_SUPABASE_ANON_KEY,
PUBLIC_ENVIRONMENT,
// PUBLIC_ENVIRONMENT,
} from "$env/static/public";
import { createClient } from "@supabase/supabase-js";
import { PRIVATE_SUPABASE_SERVICE_ROLE } from "$env/static/private";
import { initCloudflareSentryHandle, sentryHandle } from '@sentry/sveltekit';
// import { initCloudflareSentryHandle, sentryHandle } from '@sentry/sveltekit';

const supabase: Handle = async ({ event, resolve }) => {
/**
Expand Down Expand Up @@ -98,9 +97,13 @@ const authGuard: Handle = async ({ event, resolve }) => {
};


export const handle: Handle = sequence(initCloudflareSentryHandle({
export const handle: Handle = sequence(
/*initCloudflareSentryHandle(
{
dsn: "https://485a49edf664c4bad08c2ab0bf87a8eb@o4507622077169664.ingest.de.sentry.io/4507622079660112",
tracesSampleRate: 1.0,
environment: PUBLIC_ENVIRONMENT,
enabled: PUBLIC_ENVIRONMENT !== "local",
}), sentryHandle(), supabase, authGuard);
})
, sentryHandle(),*/
supabase, authGuard);
2 changes: 1 addition & 1 deletion src/lib/components/atoms/delete-account.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
variant="destructive"
disabled={$delayed}
aria-label="Delete account"
class="md:min-w-wider md:self-center"
class="wide-button md:self-center"
>
{#if $delayed}
<LoadingSpinner class="mr-2" /> <span>Laddar...</span>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/molecules/avatar-form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
<FormMessage {message} scroll />
<Button
type="submit"
class="md:min-w-wider md:self-center"
class="wide-button md:self-center"
disabled={$allErrors.length > 0 || $delayed || !$form.avatar}
>
{#if $timeout}
Expand Down
23 changes: 12 additions & 11 deletions src/lib/components/molecules/owner-section.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,20 @@
export let listing: ListingWithProfile | undefined = undefined;

const { slug } = $page.params;
const url = `/profile/${slug}?${listing && `id=${listing.id}`}${listing ? "&" : "?"}preview=true`;
const url = `/profile/${slug}?${listing ? `id=${listing.id}&` : ""}preview=true`;
</script>

<div class="mt-6 flex flex-col items-center gap-y-4">
<Button
on:click={() => goto(url)}
variant="outline"
class="flex w-full items-center gap-x-2 self-center bg-card md:w-auto"
><ExternalLink class="h-4 w-4" />visa som student</Button
>
<div class="mb-2 mt-4 flex flex-col items-center gap-y-4 md:mb-6">
<IsPublished
isPublished={listing?.visible}
class="self-center"
variant="accent"
/>
<small class="mb-8 flex flex-col gap-y-4 px-8 text-center text-lg">
<p class="text-muted-foreground">
<small class="flex flex-col gap-y-4 px-8 text-center text-lg">
<p class="flex flex-col text-muted-foreground">
Vill du göra ändringar på din profilbeskrivning eller annan informationen
om dig själv? <Link href="/account/settings" class="whitespace-nowrap"
om dig själv?
<Link href="/account/settings" class="whitespace-nowrap"
>Gå till din profil</Link
>
</p>
Expand All @@ -42,4 +37,10 @@
{/if}
<p class="italic text-muted-foreground">Bara du kan se detta.</p>
</small>
<Button
on:click={() => goto(url)}
variant="outline-card"
class="wide-button icon-button"
><ExternalLink class="size-4" />visa som student</Button
>
</div>
6 changes: 5 additions & 1 deletion src/lib/components/molecules/profile-header-info.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@
{#if listing}
<div class="flex flex-col gap-y-1">
<SecondaryTitle>
{listing.hourlyPrice} SEK
{#if listing.hourlyPrice < 1}
Gratis
{:else}
{listing.hourlyPrice} SEK
{/if}
</SecondaryTitle>
<p class="text-sm text-muted-foreground">60 minuter</p>
</div>
Expand Down
24 changes: 24 additions & 0 deletions src/lib/components/molecules/profile-preview.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<script lang="ts">
import type { ListingWithProfile } from "src/lib/shared/models/listing.ts";
import { Button } from "$lib/components/ui/button/index.js";
import OwnerSection from "./owner-section.svelte";
import * as Drawer from "$lib/components/ui/drawer/index.js";

export let listing: ListingWithProfile | undefined = undefined;
</script>

<Drawer.Root>
<Drawer.Trigger class="mt-4 md:mb-8 md:mt-0"
><Button class="wide-button" variant="outline-card">Inställningar</Button
></Drawer.Trigger
>
<Drawer.Content>
<div class="mx-auto mt-0 h-2 w-[100px] rounded-full bg-black/10"></div>
<Drawer.Header>
<Drawer.Title>Inställningar</Drawer.Title>
<Drawer.Description>
<OwnerSection {listing} />
</Drawer.Description>
</Drawer.Header>
</Drawer.Content>
</Drawer.Root>
8 changes: 7 additions & 1 deletion src/lib/components/molecules/search-result-item.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@
</div>
<div class="flex flex-col items-center gap-y-1">
<h3 class="text-xl md:text-2xl {boxStyling}">
{result.hourlyPrice} <span class="text-sm md:text-lg">SEK</span>
<span class="text-sm md:text-lg">
{#if result.hourlyPrice < 1}
Gratis
{:else}
{result.hourlyPrice} SEK
{/if}
</span>
</h3>
<p class="text-sm text-muted-foreground">60 minuter</p>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/molecules/settings-form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
const { enhance, delayed, allErrors, message } = form;
</script>


<form
method="POST"
use:enhance
Expand All @@ -37,7 +36,8 @@
{delayed}
{allErrors}
text={submitText}
class="md:min-w-wider md:self-center {submitStyling}"
class={cn("wide-button md:self-center", submitStyling)}
/>
{/if}
<slot name="view-profile" />
</form>
2 changes: 1 addition & 1 deletion src/lib/shared/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const contactEmail = "info@digitutor.se";
export const noReplyEmail = "noreply@digitutor.se";
export const localBaseUrl = "http://localhost:5173";
export const testBaseUrl = `https://dev.mindic.pages.dev`;
export const prodBaseUrl = `https://digitutor.se`;
export const prodBaseUrl = `https://digitutor.pages.dev`;

export const getBaseUrl = (env: string): string => {
if (env === "local") return localBaseUrl;
Expand Down
20 changes: 11 additions & 9 deletions src/lib/shared/utils/logging/utils.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { PUBLIC_ENVIRONMENT } from "$env/static/public";
import * as Sentry from "@sentry/sveltekit";
// import * as Sentry from "@sentry/sveltekit";

export const logErrorServer = (options: { error?: unknown, message: string, additionalData?: Record<string, unknown>, critical?: boolean }): string => {
let { additionalData } = options;
const {message} = options;
if (options.critical) {
if (additionalData) additionalData.critical = true;
else additionalData = { critical: false };
}
return ""; // terminated logging as of 2025-12-17t

// let { additionalData } = options;
// const {message} = options;
// if (options.critical) {
// if (additionalData) additionalData.critical = true;
// else additionalData = { critical: false };
// }

if (handleLocalLog({ error: options.error, additionalData, })) return crypto.randomUUID();
return Sentry.captureException(options.error, { extra: { ...(additionalData && additionalData), message } });
// if (handleLocalLog({ error: options.error, additionalData, })) return crypto.randomUUID();
// return Sentry.captureException(options.error, { extra: { ...(additionalData && additionalData), message } });
};

const handleLocalLog = (data?: Record<string, unknown>): boolean => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,8 @@
<Button
variant="outline"
href="/profile/{profile.id}?id={slug}"
class="flex gap-x-2 bg-card"
><ExternalLink class="h-4 w-4" />visa annons</Button
class="icon-button bg-card"
><ExternalLink class="size-4" />visa annons</Button
>
</div>
<div class="flex justify-between gap-x-2 md:gap-x-6">
Expand Down
20 changes: 16 additions & 4 deletions src/routes/(admin)/account/(menu)/settings/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { zodClient } from "sveltekit-superforms/adapters";
import { Input } from "$lib/components/ui/input/index.js";
import * as Form from "$lib/components/ui/form/index.js";
import ExternalLink from "lucide-svelte/icons/square-arrow-out-up-right";
import { toast } from "svelte-sonner";
import {
deleteAccountSchema as deleteSchema,
Expand Down Expand Up @@ -33,6 +34,7 @@
import ChevronUp from "lucide-svelte/icons/chevron-up";
import { websiteName } from "src/lib/shared/constants/constants.ts";
import CharCount from "src/lib/components/atoms/char-count.svelte";
import { Button } from "src/lib/components/ui/button/index.ts";

export let data: PageData;
$: ({ profile, uploadAvatarForm, deleteAvatarForm } = data);
Expand All @@ -42,7 +44,7 @@
onUpdated({ form }) {
if (form.valid) {
nameReset({ newState: data.updateNameForm.data });
toast.success(`Ändrat namn.`);
toast.success(`Sparat namn.`);
}
},
resetForm: false,
Expand Down Expand Up @@ -148,14 +150,24 @@
/>
<Form.FieldErrors />
</Form.Field>
<Button
slot="view-profile"
variant="outline"
href="/profile/{profile.id}"
class="wide-button icon-button self-center"
target="_blank"
>
Visa profil
<ExternalLink class="size-button-icon" />
</Button>
</SettingsForm>
{/if}

<SettingsForm
form={nameForm}
action="?/name"
title="Namn"
submitText="Ändra"
submitText="Spara"
>
<Form.Field form={nameForm} name="firstName">
<Form.Control let:attrs>
Expand All @@ -175,7 +187,7 @@
form={emailForm}
action="?/email"
title="E-postadress"
submitText="Ändra"
submitText="Spara"
>
<p class="text-muted-foreground">
Du kommer behöva bekräfta den nya <span class="italic">och</span> den gamla
Expand Down Expand Up @@ -205,7 +217,7 @@
form={passwordForm}
action="?/password"
title="Lösenord"
submitText="Ändra"
submitText="Spara"
>
<Form.Field form={passwordForm} name="current">
<Form.Control let:attrs>
Expand Down
Loading
Loading