chore: format

This commit is contained in:
2025-10-10 16:43:21 +02:00
parent f0aabd63b6
commit 75c29e0ba4
551 changed files with 433948 additions and 94145 deletions

View File

@@ -1,34 +0,0 @@
{
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false
},
"formatter": {
"enabled": true,
"indentStyle": "tab"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteStyle": "double"
}
},
"assist": {
"enabled": true,
"actions": {
"source": {
"organizeImports": "on"
}
}
}
}

View File

@@ -9,8 +9,7 @@
"build:frontend": "git pull && pnpm install && pnpm --filter @sexy.pivoine.art/frontend build",
"dev:data": "cd ../compose/data && docker compose up -d",
"dev:directus": "cd ../compose/sexy && docker compose --env-file=.env.local up -d directus",
"dev": "pnpm dev:data && pnpm dev:directus && pnpm --filter @sexy.pivoine.art/frontend dev",
"format": "biome format --write"
"dev": "pnpm dev:data && pnpm dev:directus && pnpm --filter @sexy.pivoine.art/frontend dev"
},
"keywords": [],
"author": "",
@@ -25,8 +24,5 @@
"@tailwindcss/oxide",
"node-sass"
]
},
"devDependencies": {
"@biomejs/biome": "2.2.4"
}
}

View File

@@ -32,41 +32,39 @@ async function processVideo(
}
}
export default defineHook(
async ({ filter, action }, { services, logger }) => {
action("files.upload", async (meta, context) => {
await processVideo(meta, context, services, logger);
});
export default defineHook(async ({ filter, action }, { services, logger }) => {
action("files.upload", async (meta, context) => {
await processVideo(meta, context, services, logger);
});
filter(
"users.create",
(payload: {
first_name: string;
last_name: string;
artist_name: string;
slug: string;
}) => {
const artist_name = `${payload.first_name}-${new Date().getTime()}`;
const slug = slugify(artist_name);
const join_date = new Date();
return { ...payload, artist_name, slug, join_date };
},
);
filter(
"users.create",
(payload: {
first_name: string;
last_name: string;
artist_name: string;
slug: string;
}) => {
const artist_name = `${payload.first_name}-${new Date().getTime()}`;
const slug = slugify(artist_name);
const join_date = new Date();
return { ...payload, artist_name, slug, join_date };
},
);
filter(
"users.update",
(payload: {
first_name: string;
last_name: string;
artist_name: string;
slug: string;
}) => {
if (payload.artist_name) {
const slug = slugify(payload.artist_name);
return { ...payload, slug };
}
return payload;
},
);
},
);
filter(
"users.update",
(payload: {
first_name: string;
last_name: string;
artist_name: string;
slug: string;
}) => {
if (payload.artist_name) {
const slug = slugify(payload.artist_name);
return { ...payload, slug };
}
return payload;
},
);
});

View File

@@ -1,46 +1,48 @@
<script lang="ts">
import { _ } from 'svelte-i18n';
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle
} from '$lib/components/ui/dialog';
import { Button } from '$lib/components/ui/button';
import { Separator } from '$lib/components/ui/separator';
import type { Snippet } from 'svelte';
import Label from '../ui/label/label.svelte';
import Input from '../ui/input/input.svelte';
import { toast } from 'svelte-sonner';
import { _ } from "svelte-i18n";
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
} from "$lib/components/ui/dialog";
import { Button } from "$lib/components/ui/button";
import { Separator } from "$lib/components/ui/separator";
import type { Snippet } from "svelte";
import Label from "../ui/label/label.svelte";
import Input from "../ui/input/input.svelte";
import { toast } from "svelte-sonner";
interface Props {
open: boolean;
email: string;
children?: Snippet;
}
interface Props {
open: boolean;
email: string;
children?: Snippet;
}
let isLoading = $state(false);
let isLoading = $state(false);
async function handleSubscription(e: Event) {
e.preventDefault();
try {
isLoading = true;
await fetch("/newsletter", {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({email})
})
toast.success($_('newsletter_signup.toast_subscribe', { values: { email } }));
} finally {
isLoading = false;
open = false;
}
}
async function handleSubscription(e: Event) {
e.preventDefault();
try {
isLoading = true;
await fetch("/newsletter", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ email }),
});
toast.success(
$_("newsletter_signup.toast_subscribe", { values: { email } }),
);
} finally {
isLoading = false;
open = false;
}
}
let { open = $bindable(), email = $bindable() }: Props = $props();
let { open = $bindable(), email = $bindable() }: Props = $props();
</script>
<Dialog bind:open>

View File

@@ -1,11 +1,11 @@
<script>
import { _ } from 'svelte-i18n';
import { Button } from '../ui/button';
import { Card, CardContent } from '../ui/card';
import NewsletterSignupPopup from './newsletter-signup-popup.svelte';
let isPopupOpen = $state(false);
import { _ } from "svelte-i18n";
import { Button } from "../ui/button";
import { Card, CardContent } from "../ui/card";
import NewsletterSignupPopup from "./newsletter-signup-popup.svelte";
let isPopupOpen = $state(false);
let {email = ""} = $props();
let { email = "" } = $props();
</script>
<!-- Newsletter Signup -->

View File

@@ -841,7 +841,7 @@ export default {
close: "Close",
subscribe: "Subscribe",
subscribing: "Subscribing",
toast_subscribe: "Your email has been added to the newsletter list!"
toast_subscribe: "Your email has been added to the newsletter list!",
},
sharing_popup_button: {
share: "Share",

View File

@@ -2,7 +2,10 @@ import { error } from "@sveltejs/kit";
import { getArticleBySlug } from "$lib/services.js";
export async function load({ fetch, params, locals }) {
try {
return { article: await getArticleBySlug(params.slug, fetch), authStatus: locals.authStatus };
return {
article: await getArticleBySlug(params.slug, fetch),
authStatus: locals.authStatus,
};
} catch {
error(404, "Article not found");
}

View File

@@ -1,19 +1,22 @@
import { LETTERSPACE_API_KEY, LETTERSPACE_API_URL, LETTERSPACE_LIST_ID } from '$env/static/private';
import { json } from '@sveltejs/kit';
import {
LETTERSPACE_API_KEY,
LETTERSPACE_API_URL,
LETTERSPACE_LIST_ID,
} from "$env/static/private";
import { json } from "@sveltejs/kit";
export async function POST({ request, fetch }) {
const { email } = await request.json();
const lists = [LETTERSPACE_LIST_ID];
const { email } = await request.json();
const lists = [LETTERSPACE_LIST_ID];
await fetch(`${LETTERSPACE_API_URL}/subscribers`, {
method: "POST",
headers: {
'Content-Type': 'application/json',
'X-API-Key': LETTERSPACE_API_KEY
},
body: JSON.stringify({ email, lists })
});
await fetch(`${LETTERSPACE_API_URL}/subscribers`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": LETTERSPACE_API_KEY,
},
body: JSON.stringify({ email, lists }),
});
return json({ email }, { status: 201 });
}
return json({ email }, { status: 201 });
}

View File

@@ -1,69 +1,69 @@
<script lang="ts">
import { _ } from 'svelte-i18n';
import { goto } from '$app/navigation';
import { Button } from '$lib/components/ui/button';
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle
} from '$lib/components/ui/card';
import { Input } from '$lib/components/ui/input';
import { Label } from '$lib/components/ui/label';
import { Checkbox } from '$lib/components/ui/checkbox';
import { toast } from 'svelte-sonner';
import * as Alert from '$lib/components/ui/alert';
import PeonyIcon from '$lib/components/icon/peony-icon.svelte';
import { register } from '$lib/services';
import PeonyBackground from '$lib/components/background/peony-background.svelte';
import Meta from '$lib/components/meta/meta.svelte';
import { onMount } from 'svelte';
import Logo from '$lib/components/logo/logo.svelte';
import { _ } from "svelte-i18n";
import { goto } from "$app/navigation";
import { Button } from "$lib/components/ui/button";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "$lib/components/ui/card";
import { Input } from "$lib/components/ui/input";
import { Label } from "$lib/components/ui/label";
import { Checkbox } from "$lib/components/ui/checkbox";
import { toast } from "svelte-sonner";
import * as Alert from "$lib/components/ui/alert";
import PeonyIcon from "$lib/components/icon/peony-icon.svelte";
import { register } from "$lib/services";
import PeonyBackground from "$lib/components/background/peony-background.svelte";
import Meta from "$lib/components/meta/meta.svelte";
import { onMount } from "svelte";
import Logo from "$lib/components/logo/logo.svelte";
let firstName = $state('');
let lastName = $state('');
let email = $state('');
let password = $state('');
let confirmPassword = $state('');
let showPassword = $state(false);
let showConfirmPassword = $state(false);
let agreeTerms = $state(false);
let isLoading = $state(false);
let isError = $state(false);
let error = $state('');
let firstName = $state("");
let lastName = $state("");
let email = $state("");
let password = $state("");
let confirmPassword = $state("");
let showPassword = $state(false);
let showConfirmPassword = $state(false);
let agreeTerms = $state(false);
let isLoading = $state(false);
let isError = $state(false);
let error = $state("");
async function handleSubmit(e: Event) {
e.preventDefault();
try {
if (!agreeTerms) {
throw new Error($_('auth.signup.agree_error'));
}
if (password !== confirmPassword) {
throw new Error($_('auth.signup.password_error'));
}
isLoading = true;
isError = false;
error = '';
await register(email, password, firstName, lastName);
toast.success($_('auth.signup.toast_register', { values: { email } }));
goto('/login');
} catch (err: any) {
error = err.message;
isError = true;
} finally {
isLoading = false;
}
}
async function handleSubmit(e: Event) {
e.preventDefault();
try {
if (!agreeTerms) {
throw new Error($_("auth.signup.agree_error"));
}
if (password !== confirmPassword) {
throw new Error($_("auth.signup.password_error"));
}
isLoading = true;
isError = false;
error = "";
await register(email, password, firstName, lastName);
toast.success($_("auth.signup.toast_register", { values: { email } }));
goto("/login");
} catch (err: any) {
error = err.message;
isError = true;
} finally {
isLoading = false;
}
}
const { data } = $props();
const { data } = $props();
onMount(() => {
if (!data.authStatus.authenticated) {
return;
}
goto('/me');
});
onMount(() => {
if (!data.authStatus.authenticated) {
return;
}
goto("/me");
});
</script>
<Meta

View File

@@ -1,66 +1,65 @@
<script lang="ts">
import { _ } from 'svelte-i18n';
import { Button } from '$lib/components/ui/button';
import { Card, CardContent } from '$lib/components/ui/card';
import { Input } from '$lib/components/ui/input';
import {
Select,
SelectContent,
SelectItem,
SelectTrigger
} from '$lib/components/ui/select';
import { getAssetUrl } from '$lib/directus';
import Meta from '$lib/components/meta/meta.svelte';
import TimeAgo from 'javascript-time-ago';
import { formatVideoDuration } from '$lib/utils';
import { _ } from "svelte-i18n";
import { Button } from "$lib/components/ui/button";
import { Card, CardContent } from "$lib/components/ui/card";
import { Input } from "$lib/components/ui/input";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
} from "$lib/components/ui/select";
import { getAssetUrl } from "$lib/directus";
import Meta from "$lib/components/meta/meta.svelte";
import TimeAgo from "javascript-time-ago";
import { formatVideoDuration } from "$lib/utils";
const timeAgo = new TimeAgo('en');
const timeAgo = new TimeAgo("en");
let searchQuery = $state('');
let sortBy = $state('trending');
let categoryFilter = $state('all');
let durationFilter = $state('all');
let searchQuery = $state("");
let sortBy = $state("trending");
let categoryFilter = $state("all");
let durationFilter = $state("all");
const { data } = $props();
const { data } = $props();
const filteredVideos = $derived(() => {
return data.videos
.filter((video) => {
const matchesSearch = video.title
.toLowerCase()
.includes(searchQuery.toLowerCase());
// ||
// video.model.toLowerCase().includes(searchQuery.toLowerCase());
const matchesCategory = categoryFilter === 'all';
const matchesDuration =
durationFilter === 'all' ||
(durationFilter === 'short' && video.movie.duration < 10 * 60) ||
(durationFilter === 'medium' &&
video.movie.duration >= 10 * 60 &&
video.movie.duration < 20 * 60) ||
(durationFilter === 'long' && video.movie.duration >= 20 * 60);
return matchesSearch && matchesCategory && matchesDuration;
})
.sort((a, b) => {
// if (sortBy === "trending")
// return (
// parseInt(b.views.replace(/[^\d]/g, "")) -
// parseInt(a.views.replace(/[^\d]/g, ""))
// );
if (sortBy === 'recent')
return (
new Date(b.upload_date).getTime() -
new Date(a.upload_date).getTime()
);
// if (sortBy === "popular")
// return (
// parseInt(b.likes.replace(/[^\d]/g, "")) -
// parseInt(a.likes.replace(/[^\d]/g, ""))
// );
if (sortBy === 'duration') return b.movie.duration - a.movie.duration;
return a.title.localeCompare(b.title);
});
});
const filteredVideos = $derived(() => {
return data.videos
.filter((video) => {
const matchesSearch = video.title
.toLowerCase()
.includes(searchQuery.toLowerCase());
// ||
// video.model.toLowerCase().includes(searchQuery.toLowerCase());
const matchesCategory = categoryFilter === "all";
const matchesDuration =
durationFilter === "all" ||
(durationFilter === "short" && video.movie.duration < 10 * 60) ||
(durationFilter === "medium" &&
video.movie.duration >= 10 * 60 &&
video.movie.duration < 20 * 60) ||
(durationFilter === "long" && video.movie.duration >= 20 * 60);
return matchesSearch && matchesCategory && matchesDuration;
})
.sort((a, b) => {
// if (sortBy === "trending")
// return (
// parseInt(b.views.replace(/[^\d]/g, "")) -
// parseInt(a.views.replace(/[^\d]/g, ""))
// );
if (sortBy === "recent")
return (
new Date(b.upload_date).getTime() - new Date(a.upload_date).getTime()
);
// if (sortBy === "popular")
// return (
// parseInt(b.likes.replace(/[^\d]/g, "")) -
// parseInt(a.likes.replace(/[^\d]/g, ""))
// );
if (sortBy === "duration") return b.movie.duration - a.movie.duration;
return a.title.localeCompare(b.title);
});
});
</script>
<Meta title={$_('videos.title')} description={$_('videos.description')} />

View File

@@ -6,11 +6,7 @@ settings:
importers:
.:
devDependencies:
'@biomejs/biome':
specifier: 2.2.4
version: 2.2.4
.: {}
packages/bundle:
dependencies:
@@ -185,59 +181,6 @@ packages:
resolution: {integrity: sha512-x0LvFTekgSX+83TI28Y9wYPUfzrnl2aT5+5QLnO6v7mSJYtEEevuDRN0F0uSHRk1G1IWZC43o00Y0xDDrpBGPQ==}
engines: {node: '>=6.9.0'}
'@biomejs/biome@2.2.4':
resolution: {integrity: sha512-TBHU5bUy/Ok6m8c0y3pZiuO/BZoY/OcGxoLlrfQof5s8ISVwbVBdFINPQZyFfKwil8XibYWb7JMwnT8wT4WVPg==}
engines: {node: '>=14.21.3'}
hasBin: true
'@biomejs/cli-darwin-arm64@2.2.4':
resolution: {integrity: sha512-RJe2uiyaloN4hne4d2+qVj3d3gFJFbmrr5PYtkkjei1O9c+BjGXgpUPVbi8Pl8syumhzJjFsSIYkcLt2VlVLMA==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [darwin]
'@biomejs/cli-darwin-x64@2.2.4':
resolution: {integrity: sha512-cFsdB4ePanVWfTnPVaUX+yr8qV8ifxjBKMkZwN7gKb20qXPxd/PmwqUH8mY5wnM9+U0QwM76CxFyBRJhC9tQwg==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [darwin]
'@biomejs/cli-linux-arm64-musl@2.2.4':
resolution: {integrity: sha512-7TNPkMQEWfjvJDaZRSkDCPT/2r5ESFPKx+TEev+I2BXDGIjfCZk2+b88FOhnJNHtksbOZv8ZWnxrA5gyTYhSsQ==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [linux]
'@biomejs/cli-linux-arm64@2.2.4':
resolution: {integrity: sha512-M/Iz48p4NAzMXOuH+tsn5BvG/Jb07KOMTdSVwJpicmhN309BeEyRyQX+n1XDF0JVSlu28+hiTQ2L4rZPvu7nMw==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [linux]
'@biomejs/cli-linux-x64-musl@2.2.4':
resolution: {integrity: sha512-m41nFDS0ksXK2gwXL6W6yZTYPMH0LughqbsxInSKetoH6morVj43szqKx79Iudkp8WRT5SxSh7qVb8KCUiewGg==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [linux]
'@biomejs/cli-linux-x64@2.2.4':
resolution: {integrity: sha512-orr3nnf2Dpb2ssl6aihQtvcKtLySLta4E2UcXdp7+RTa7mfJjBgIsbS0B9GC8gVu0hjOu021aU8b3/I1tn+pVQ==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [linux]
'@biomejs/cli-win32-arm64@2.2.4':
resolution: {integrity: sha512-NXnfTeKHDFUWfxAefa57DiGmu9VyKi0cDqFpdI+1hJWQjGJhJutHPX0b5m+eXvTKOaf+brU+P0JrQAZMb5yYaQ==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [win32]
'@biomejs/cli-win32-x64@2.2.4':
resolution: {integrity: sha512-3Y4V4zVRarVh/B/eSHczR4LYoSVyv3Dfuvm3cWs5w/HScccS0+Wt/lHOcDTRYeHjQmMYVC3rIRWqyN2EI52+zg==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [win32]
'@directus/composables@11.2.3':
resolution: {integrity: sha512-1WvDGVKu8rBF0g0IlFAit4rNO/WPcdne+FeQIPmVIa7iR+TR+BX2YUD6II2nDAmOQWxp9E2wjM6DOL3s3pxfCQ==}
peerDependencies:
@@ -4249,41 +4192,6 @@ snapshots:
'@babel/helper-string-parser': 7.27.1
'@babel/helper-validator-identifier': 7.27.1
'@biomejs/biome@2.2.4':
optionalDependencies:
'@biomejs/cli-darwin-arm64': 2.2.4
'@biomejs/cli-darwin-x64': 2.2.4
'@biomejs/cli-linux-arm64': 2.2.4
'@biomejs/cli-linux-arm64-musl': 2.2.4
'@biomejs/cli-linux-x64': 2.2.4
'@biomejs/cli-linux-x64-musl': 2.2.4
'@biomejs/cli-win32-arm64': 2.2.4
'@biomejs/cli-win32-x64': 2.2.4
'@biomejs/cli-darwin-arm64@2.2.4':
optional: true
'@biomejs/cli-darwin-x64@2.2.4':
optional: true
'@biomejs/cli-linux-arm64-musl@2.2.4':
optional: true
'@biomejs/cli-linux-arm64@2.2.4':
optional: true
'@biomejs/cli-linux-x64-musl@2.2.4':
optional: true
'@biomejs/cli-linux-x64@2.2.4':
optional: true
'@biomejs/cli-win32-arm64@2.2.4':
optional: true
'@biomejs/cli-win32-x64@2.2.4':
optional: true
'@directus/composables@11.2.3(vue@3.5.18(typescript@5.9.2))':
dependencies:
'@directus/constants': 13.0.3