Compare commits
21 Commits
54bf8cf915
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
7170a6214b
|
|||
|
c946d019b3
|
|||
|
01dcf193dd
|
|||
|
f236e818af
|
|||
|
2636c58d37
|
|||
|
093b5bf9a9
|
|||
|
302d5cb293
|
|||
|
0523df45cf
|
|||
|
b295012340
|
|||
|
2c395e36d3
|
|||
|
72ca5e9b77
|
|||
|
be35bd24c2
|
|||
|
f5a2be3598
|
|||
|
954eff069b
|
|||
|
013059b62f
|
|||
|
8d28e8a6ad
|
|||
|
7a4a13736e
|
|||
|
c6669134f5
|
|||
|
7a34bc50fc
|
|||
|
eccfc7013a
|
|||
|
adceb3a61b
|
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules/
|
||||||
32
Dockerfile
Normal file
32
Dockerfile
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# Stage 1: Build the application
|
||||||
|
FROM oven/bun:1 as builder
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy dependency definition files
|
||||||
|
COPY package.json ./
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN bun install
|
||||||
|
|
||||||
|
# Copy the rest of the application code
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build the Nuxt application
|
||||||
|
RUN bun run build
|
||||||
|
|
||||||
|
# Stage 2: Create the production image
|
||||||
|
FROM node:20-slim as runner
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy the built output from the builder stage
|
||||||
|
COPY --from=builder /app/.output ./.output
|
||||||
|
|
||||||
|
# Set environment variables for the Nuxt server
|
||||||
|
ENV HOST=0.0.0.0
|
||||||
|
ENV PORT=3000
|
||||||
|
|
||||||
|
# Expose the port the app runs on
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
# The command to run the application
|
||||||
|
CMD ["node", ".output/server/index.mjs"]
|
||||||
22
app/app.vue
22
app/app.vue
@@ -1,10 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<naive-config>
|
<naive-config>
|
||||||
|
<n-global-style />
|
||||||
<n-dialog-provider>
|
<n-dialog-provider>
|
||||||
<n-notification-provider>
|
<n-notification-provider>
|
||||||
|
<naive-notification />
|
||||||
<n-message-provider>
|
<n-message-provider>
|
||||||
<n-loading-bar-provider>
|
<n-loading-bar-provider>
|
||||||
<nuxt-loading-indicator />
|
<naive-loading-bar navigation />
|
||||||
<nuxt-layout>
|
<nuxt-layout>
|
||||||
<nuxt-page />
|
<nuxt-page />
|
||||||
</nuxt-layout>
|
</nuxt-layout>
|
||||||
@@ -17,22 +19,4 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import "@fontsource-variable/nunito"
|
import "@fontsource-variable/nunito"
|
||||||
import { usePreferredColorScheme } from "@vueuse/core"
|
|
||||||
|
|
||||||
const { colorModePreference } = useNaiveColorMode()
|
|
||||||
const colorScheme = usePreferredColorScheme()
|
|
||||||
|
|
||||||
colorModePreference.set("system")
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
switch (colorScheme.value) {
|
|
||||||
case "dark":
|
|
||||||
colorModePreference.set("dark")
|
|
||||||
case "light":
|
|
||||||
colorModePreference.set("light")
|
|
||||||
default:
|
|
||||||
colorModePreference.set("system")
|
|
||||||
}
|
|
||||||
colorModePreference.sync()
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -34,4 +34,19 @@
|
|||||||
|
|
||||||
.n-image-preview-toolbar {
|
.n-image-preview-toolbar {
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.h-layout {
|
||||||
|
/* margin of the navbar + actual navbar */
|
||||||
|
height: calc(100vh - 64px*2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* for the minimal layout */
|
||||||
|
.h-compact-layout {
|
||||||
|
height: calc(100vh - 48px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.min-h-layout {
|
||||||
|
/* margin of the navbar + actual navbar */
|
||||||
|
min-height: calc(100vh - 64px*2);
|
||||||
}
|
}
|
||||||
46
app/components.d.ts
vendored
46
app/components.d.ts
vendored
@@ -20,27 +20,50 @@ declare module 'vue' {
|
|||||||
NCardSection: typeof import('naive-ui')['NCardSection']
|
NCardSection: typeof import('naive-ui')['NCardSection']
|
||||||
NCarousel: typeof import('naive-ui')['NCarousel']
|
NCarousel: typeof import('naive-ui')['NCarousel']
|
||||||
NCarouselItem: typeof import('naive-ui')['NCarouselItem']
|
NCarouselItem: typeof import('naive-ui')['NCarouselItem']
|
||||||
|
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||||
NChip: typeof import('naive-ui')['NChip']
|
NChip: typeof import('naive-ui')['NChip']
|
||||||
|
NCode: typeof import('naive-ui')['NCode']
|
||||||
|
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
||||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||||
|
NDatePicker: typeof import('naive-ui')['NDatePicker']
|
||||||
NDialog: typeof import('naive-ui')['NDialog']
|
NDialog: typeof import('naive-ui')['NDialog']
|
||||||
NDialogProvider: typeof import('naive-ui')['NDialogProvider']
|
NDialogProvider: typeof import('naive-ui')['NDialogProvider']
|
||||||
|
NDivider: typeof import('naive-ui')['NDivider']
|
||||||
|
NDrawer: typeof import('naive-ui')['NDrawer']
|
||||||
|
NDrawerContent: typeof import('naive-ui')['NDrawerContent']
|
||||||
NDropdown: typeof import('naive-ui')['NDropdown']
|
NDropdown: typeof import('naive-ui')['NDropdown']
|
||||||
|
NEmpty: typeof import('naive-ui')['NEmpty']
|
||||||
|
NForm: typeof import('naive-ui')['NForm']
|
||||||
|
NFormItem: typeof import('naive-ui')['NFormItem']
|
||||||
|
NGlobalStyle: typeof import('naive-ui')['NGlobalStyle']
|
||||||
NIcon: typeof import('naive-ui')['NIcon']
|
NIcon: typeof import('naive-ui')['NIcon']
|
||||||
NImage: typeof import('naive-ui')['NImage']
|
NImage: typeof import('naive-ui')['NImage']
|
||||||
|
NImagePreview: typeof import('naive-ui')['NImagePreview']
|
||||||
NImg: typeof import('naive-ui')['NImg']
|
NImg: typeof import('naive-ui')['NImg']
|
||||||
NInfiniteScroll: typeof import('naive-ui')['NInfiniteScroll']
|
NInfiniteScroll: typeof import('naive-ui')['NInfiniteScroll']
|
||||||
NInput: typeof import('naive-ui')['NInput']
|
NInput: typeof import('naive-ui')['NInput']
|
||||||
|
NList: typeof import('naive-ui')['NList']
|
||||||
|
NListItem: typeof import('naive-ui')['NListItem']
|
||||||
NLoadingBarProvider: typeof import('naive-ui')['NLoadingBarProvider']
|
NLoadingBarProvider: typeof import('naive-ui')['NLoadingBarProvider']
|
||||||
NMenu: typeof import('naive-ui')['NMenu']
|
NMenu: typeof import('naive-ui')['NMenu']
|
||||||
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
||||||
NModal: typeof import('naive-ui')['NModal']
|
NModal: typeof import('naive-ui')['NModal']
|
||||||
NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
|
NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
|
||||||
|
NPopover: typeof import('naive-ui')['NPopover']
|
||||||
|
NProgress: typeof import('naive-ui')['NProgress']
|
||||||
|
NRadio: typeof import('naive-ui')['NRadio']
|
||||||
|
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
|
||||||
|
NResult: typeof import('naive-ui')['NResult']
|
||||||
NSelect: typeof import('naive-ui')['NSelect']
|
NSelect: typeof import('naive-ui')['NSelect']
|
||||||
NSpace: typeof import('naive-ui')['NSpace']
|
NSpace: typeof import('naive-ui')['NSpace']
|
||||||
NSpin: typeof import('naive-ui')['NSpin']
|
NSpin: typeof import('naive-ui')['NSpin']
|
||||||
|
NTab: typeof import('naive-ui')['NTab']
|
||||||
|
NTabPane: typeof import('naive-ui')['NTabPane']
|
||||||
|
NTabs: typeof import('naive-ui')['NTabs']
|
||||||
NTag: typeof import('naive-ui')['NTag']
|
NTag: typeof import('naive-ui')['NTag']
|
||||||
NTextarea: typeof import('naive-ui')['NTextarea']
|
NTextarea: typeof import('naive-ui')['NTextarea']
|
||||||
NThemeEditor: typeof import('naive-ui')['NThemeEditor']
|
NThemeEditor: typeof import('naive-ui')['NThemeEditor']
|
||||||
|
NTooltip: typeof import('naive-ui')['NTooltip']
|
||||||
RouterLink: typeof import('vue-router')['RouterLink']
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
RouterView: typeof import('vue-router')['RouterView']
|
RouterView: typeof import('vue-router')['RouterView']
|
||||||
}
|
}
|
||||||
@@ -56,27 +79,50 @@ declare global {
|
|||||||
const NCardSection: typeof import('naive-ui')['NCardSection']
|
const NCardSection: typeof import('naive-ui')['NCardSection']
|
||||||
const NCarousel: typeof import('naive-ui')['NCarousel']
|
const NCarousel: typeof import('naive-ui')['NCarousel']
|
||||||
const NCarouselItem: typeof import('naive-ui')['NCarouselItem']
|
const NCarouselItem: typeof import('naive-ui')['NCarouselItem']
|
||||||
|
const NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||||
const NChip: typeof import('naive-ui')['NChip']
|
const NChip: typeof import('naive-ui')['NChip']
|
||||||
|
const NCode: typeof import('naive-ui')['NCode']
|
||||||
|
const NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
||||||
const NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
const NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||||
|
const NDatePicker: typeof import('naive-ui')['NDatePicker']
|
||||||
const NDialog: typeof import('naive-ui')['NDialog']
|
const NDialog: typeof import('naive-ui')['NDialog']
|
||||||
const NDialogProvider: typeof import('naive-ui')['NDialogProvider']
|
const NDialogProvider: typeof import('naive-ui')['NDialogProvider']
|
||||||
|
const NDivider: typeof import('naive-ui')['NDivider']
|
||||||
|
const NDrawer: typeof import('naive-ui')['NDrawer']
|
||||||
|
const NDrawerContent: typeof import('naive-ui')['NDrawerContent']
|
||||||
const NDropdown: typeof import('naive-ui')['NDropdown']
|
const NDropdown: typeof import('naive-ui')['NDropdown']
|
||||||
|
const NEmpty: typeof import('naive-ui')['NEmpty']
|
||||||
|
const NForm: typeof import('naive-ui')['NForm']
|
||||||
|
const NFormItem: typeof import('naive-ui')['NFormItem']
|
||||||
|
const NGlobalStyle: typeof import('naive-ui')['NGlobalStyle']
|
||||||
const NIcon: typeof import('naive-ui')['NIcon']
|
const NIcon: typeof import('naive-ui')['NIcon']
|
||||||
const NImage: typeof import('naive-ui')['NImage']
|
const NImage: typeof import('naive-ui')['NImage']
|
||||||
|
const NImagePreview: typeof import('naive-ui')['NImagePreview']
|
||||||
const NImg: typeof import('naive-ui')['NImg']
|
const NImg: typeof import('naive-ui')['NImg']
|
||||||
const NInfiniteScroll: typeof import('naive-ui')['NInfiniteScroll']
|
const NInfiniteScroll: typeof import('naive-ui')['NInfiniteScroll']
|
||||||
const NInput: typeof import('naive-ui')['NInput']
|
const NInput: typeof import('naive-ui')['NInput']
|
||||||
|
const NList: typeof import('naive-ui')['NList']
|
||||||
|
const NListItem: typeof import('naive-ui')['NListItem']
|
||||||
const NLoadingBarProvider: typeof import('naive-ui')['NLoadingBarProvider']
|
const NLoadingBarProvider: typeof import('naive-ui')['NLoadingBarProvider']
|
||||||
const NMenu: typeof import('naive-ui')['NMenu']
|
const NMenu: typeof import('naive-ui')['NMenu']
|
||||||
const NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
const NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
||||||
const NModal: typeof import('naive-ui')['NModal']
|
const NModal: typeof import('naive-ui')['NModal']
|
||||||
const NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
|
const NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
|
||||||
|
const NPopover: typeof import('naive-ui')['NPopover']
|
||||||
|
const NProgress: typeof import('naive-ui')['NProgress']
|
||||||
|
const NRadio: typeof import('naive-ui')['NRadio']
|
||||||
|
const NRadioGroup: typeof import('naive-ui')['NRadioGroup']
|
||||||
|
const NResult: typeof import('naive-ui')['NResult']
|
||||||
const NSelect: typeof import('naive-ui')['NSelect']
|
const NSelect: typeof import('naive-ui')['NSelect']
|
||||||
const NSpace: typeof import('naive-ui')['NSpace']
|
const NSpace: typeof import('naive-ui')['NSpace']
|
||||||
const NSpin: typeof import('naive-ui')['NSpin']
|
const NSpin: typeof import('naive-ui')['NSpin']
|
||||||
|
const NTab: typeof import('naive-ui')['NTab']
|
||||||
|
const NTabPane: typeof import('naive-ui')['NTabPane']
|
||||||
|
const NTabs: typeof import('naive-ui')['NTabs']
|
||||||
const NTag: typeof import('naive-ui')['NTag']
|
const NTag: typeof import('naive-ui')['NTag']
|
||||||
const NTextarea: typeof import('naive-ui')['NTextarea']
|
const NTextarea: typeof import('naive-ui')['NTextarea']
|
||||||
const NThemeEditor: typeof import('naive-ui')['NThemeEditor']
|
const NThemeEditor: typeof import('naive-ui')['NThemeEditor']
|
||||||
|
const NTooltip: typeof import('naive-ui')['NTooltip']
|
||||||
const RouterLink: typeof import('vue-router')['RouterLink']
|
const RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
const RouterView: typeof import('vue-router')['RouterView']
|
const RouterView: typeof import('vue-router')['RouterView']
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="relative rounded-md overflow-hidden" :style="containerStyle">
|
<div class="relative rounded-md overflow-hidden" :style="containerStyle">
|
||||||
<template v-if="itemType == 'image'">
|
<div
|
||||||
|
v-if="itemType == 'image'"
|
||||||
|
class="flex flex-col items-center justify-center"
|
||||||
|
>
|
||||||
<!-- Blurhash placeholder -->
|
<!-- Blurhash placeholder -->
|
||||||
<div
|
<div
|
||||||
v-if="blurhash"
|
v-if="blurhash"
|
||||||
@@ -22,11 +25,11 @@
|
|||||||
@load="imageLoaded = true"
|
@load="imageLoaded = true"
|
||||||
@error="imageLoaded = true"
|
@error="imageLoaded = true"
|
||||||
/>
|
/>
|
||||||
</template>
|
</div>
|
||||||
|
|
||||||
<audio
|
<audio
|
||||||
v-else-if="itemType == 'audio'"
|
v-else-if="itemType == 'audio'"
|
||||||
class="w-full h-auto"
|
class="w-full"
|
||||||
:src="remoteSource"
|
:src="remoteSource"
|
||||||
controls
|
controls
|
||||||
/>
|
/>
|
||||||
@@ -105,8 +108,8 @@ const blurhashContainerStyle = computed(() => {
|
|||||||
|
|
||||||
const containerStyle = computed(() => {
|
const containerStyle = computed(() => {
|
||||||
return {
|
return {
|
||||||
"max-height": props.maxHeight ?? "720px",
|
maxHeight: props.maxHeight ?? "720px",
|
||||||
"aspect-ratio": aspectRatio.value
|
aspectRatio: aspectRatio.value?.toString()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<!-- All images: use carousel -->
|
<!-- All images: use carousel -->
|
||||||
<div
|
<div
|
||||||
v-if="isAllImages"
|
v-if="isAllImages"
|
||||||
class="carousel-container rounded-lg overflow-hidden"
|
class="carousel-container rounded-xl border bg-base-300 overflow-hidden"
|
||||||
:style="carouselStyle"
|
:style="carouselStyle"
|
||||||
>
|
>
|
||||||
<n-carousel height="100%" show-arrow>
|
<n-carousel height="100%" show-arrow>
|
||||||
@@ -19,15 +19,19 @@
|
|||||||
v-for="attachment in attachments"
|
v-for="attachment in attachments"
|
||||||
:key="attachment.id"
|
:key="attachment.id"
|
||||||
height="100%"
|
height="100%"
|
||||||
|
width="100%"
|
||||||
cover
|
cover
|
||||||
>
|
>
|
||||||
<attachment-item original class="h-full" :item="attachment" />
|
<attachment-item
|
||||||
|
original
|
||||||
|
class="h-full w-full"
|
||||||
|
:item="attachment"
|
||||||
|
/>
|
||||||
</n-carousel-item>
|
</n-carousel-item>
|
||||||
</n-carousel>
|
</n-carousel>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Mixed content: vertical scrollable -->
|
<div v-else class="space-y-4 flex flex-col">
|
||||||
<div v-else class="space-y-4 max-h-96 overflow-y-auto">
|
|
||||||
<attachment-item
|
<attachment-item
|
||||||
v-for="attachment in attachments"
|
v-for="attachment in attachments"
|
||||||
:key="attachment.id"
|
:key="attachment.id"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div v-if="provider === 'cloudflare'">
|
<div v-if="provider === 'cloudflare'">
|
||||||
<turnstile v-if="!!apiKey" :sitekey="apiKey" @callback="handleSuccess" />
|
<turnstile v-if="!!apiKey" :sitekey="apiKey" @callback="handleSuccess" />
|
||||||
<div v-else class="mx-auto">
|
<div v-else class="mx-auto">
|
||||||
<n-spin />
|
<span class="loading loading-spinner loading-md"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="provider === 'hcaptcha'">
|
<div v-else-if="provider === 'hcaptcha'">
|
||||||
@@ -11,9 +11,10 @@
|
|||||||
v-if="!!apiKey"
|
v-if="!!apiKey"
|
||||||
:sitekey="apiKey"
|
:sitekey="apiKey"
|
||||||
@verify="(tk: string) => handleSuccess(tk)"
|
@verify="(tk: string) => handleSuccess(tk)"
|
||||||
/>
|
>
|
||||||
|
</hcaptcha>
|
||||||
<div v-else class="mx-auto">
|
<div v-else class="mx-auto">
|
||||||
<n-spin />
|
<span class="loading loading-spinner loading-md"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -22,7 +23,7 @@
|
|||||||
:data-sitekey="apiKey"
|
:data-sitekey="apiKey"
|
||||||
/>
|
/>
|
||||||
<div v-else class="flex flex-col items-center justify-center gap-1">
|
<div v-else class="flex flex-col items-center justify-center gap-1">
|
||||||
<span class="mdi mdi-alert-circle-outline text-3xl"></span>
|
<n-icon :component="AlertTriangleIcon" />
|
||||||
<span>Captcha provider not configured correctly.</span>
|
<span>Captcha provider not configured correctly.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -32,6 +33,7 @@
|
|||||||
import { ref, onMounted } from "vue"
|
import { ref, onMounted } from "vue"
|
||||||
import Turnstile from "cfturnstile-vue3"
|
import Turnstile from "cfturnstile-vue3"
|
||||||
import Hcaptcha from "@hcaptcha/vue3-hcaptcha"
|
import Hcaptcha from "@hcaptcha/vue3-hcaptcha"
|
||||||
|
import { AlertTriangleIcon } from "lucide-vue-next"
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
provider: {
|
provider: {
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="container absolute bottom-5 left-1/2 -translate-x-1/2">
|
|
||||||
<div class="flex justify-between items-center">
|
|
||||||
<n-select
|
|
||||||
:options="[{ label: 'English (United States)', value: 'en-us' }]"
|
|
||||||
model-value="en-us"
|
|
||||||
size="small"
|
|
||||||
class="flex-grow-0"
|
|
||||||
/>
|
|
||||||
<div class="flex">
|
|
||||||
<n-button text size="small">Help</n-button>
|
|
||||||
<n-button text size="small">Privacy</n-button>
|
|
||||||
<n-button text size="small">Terms</n-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-3">
|
||||||
<pub-select v-model:value="publisher" />
|
<pub-select v-model:value="publisher" />
|
||||||
<n-input
|
<n-input
|
||||||
v-model:value="content"
|
v-model:value="content"
|
||||||
@@ -8,11 +8,11 @@
|
|||||||
@keydown.meta.enter.exact="submit"
|
@keydown.meta.enter.exact="submit"
|
||||||
@keydown.ctrl.enter.exact="submit"
|
@keydown.ctrl.enter.exact="submit"
|
||||||
/>
|
/>
|
||||||
<div class="flex justify-between">
|
<div class="flex justify-end">
|
||||||
<n-button type="primary" :loading="submitting" @click="submit">
|
<n-button type="primary" :loading="submitting" @click="submit">
|
||||||
Post
|
Post
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<span class="mdi mdi-send"></span>
|
<n-icon :component="SendIcon" />
|
||||||
</template>
|
</template>
|
||||||
</n-button>
|
</n-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -20,8 +20,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { SendIcon } from "lucide-vue-next"
|
||||||
import { useSolarNetwork } from '~/composables/useSolarNetwork'
|
import { ref } from "vue"
|
||||||
|
import { useSolarNetwork } from "~/composables/useSolarNetwork"
|
||||||
|
|
||||||
// Interface for uploaded files in the editor
|
// Interface for uploaded files in the editor
|
||||||
interface UploadedFile {
|
interface UploadedFile {
|
||||||
@@ -30,10 +31,10 @@ interface UploadedFile {
|
|||||||
type: string
|
type: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const emits = defineEmits(['posted'])
|
const emits = defineEmits(["posted"])
|
||||||
|
|
||||||
const publisher = ref<string | undefined>()
|
const publisher = ref<string | undefined>()
|
||||||
const content = ref('')
|
const content = ref("")
|
||||||
|
|
||||||
const fileList = ref<UploadedFile[]>([])
|
const fileList = ref<UploadedFile[]>([])
|
||||||
|
|
||||||
@@ -43,21 +44,21 @@ async function submit() {
|
|||||||
submitting.value = true
|
submitting.value = true
|
||||||
const api = useSolarNetwork()
|
const api = useSolarNetwork()
|
||||||
await api(`/sphere/posts?pub=${publisher.value}`, {
|
await api(`/sphere/posts?pub=${publisher.value}`, {
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
'content-type': 'application/json',
|
"content-type": "application/json"
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
content: content.value,
|
content: content.value,
|
||||||
attachments: fileList.value
|
attachments: fileList.value
|
||||||
.filter((e) => e.url != null)
|
.filter((e) => e.url != null)
|
||||||
.map((e) => e.url!.split('/').reverse()[0]),
|
.map((e) => e.url!.split("/").reverse()[0])
|
||||||
}),
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
submitting.value = false
|
submitting.value = false
|
||||||
content.value = ''
|
content.value = ""
|
||||||
fileList.value = []
|
fileList.value = []
|
||||||
emits('posted')
|
emits("posted")
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-card :size="compact ? 'small' : 'medium'">
|
<n-card>
|
||||||
<div :class="['flex flex-col', compact ? 'gap-1' : 'gap-3']">
|
<div :class="['flex flex-col', compact ? 'gap-1' : 'gap-3']">
|
||||||
<post-header :item="props.item" :compact="compact" />
|
<post-header :item="props.item" :compact="compact" />
|
||||||
|
|
||||||
@@ -22,21 +22,17 @@
|
|||||||
<template v-if="showReferenced">
|
<template v-if="showReferenced">
|
||||||
<div
|
<div
|
||||||
v-if="props.item.repliedPost || props.item.repliedGone"
|
v-if="props.item.repliedPost || props.item.repliedGone"
|
||||||
class="border rounded-xl"
|
class="border rounded-xl mt-2"
|
||||||
>
|
>
|
||||||
<div class="p-2 flex items-center gap-2">
|
<div class="p-2 flex items-center gap-2">
|
||||||
<n-icon :component="ReplyIcon" class="ms-2" />
|
<n-icon :component="ReplyIcon" class="ms-2" />
|
||||||
<span class="font-bold">Replying to</span>
|
<span class="font-bold">Replying to</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div v-if="props.item.repliedGone" class="text-sm opacity-60">
|
||||||
v-if="props.item.repliedGone"
|
|
||||||
class="px-4 pb-3 text-sm opacity-60"
|
|
||||||
>
|
|
||||||
Post unavailable
|
Post unavailable
|
||||||
</div>
|
</div>
|
||||||
<post-item
|
<post-item
|
||||||
v-else-if="props.item.repliedPost"
|
v-else-if="props.item.repliedPost"
|
||||||
class="px-4 pb-3"
|
|
||||||
:item="props.item.repliedPost"
|
:item="props.item.repliedPost"
|
||||||
slim
|
slim
|
||||||
compact
|
compact
|
||||||
@@ -47,21 +43,17 @@
|
|||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="props.item.forwardedPost || props.item.forwardedGone"
|
v-if="props.item.forwardedPost || props.item.forwardedGone"
|
||||||
class="border rounded-xl"
|
class="border rounded-xl mt-2"
|
||||||
>
|
>
|
||||||
<div class="p-2 flex items-center gap-2">
|
<div class="p-2 flex items-center gap-2">
|
||||||
<n-icon :component="ForwardIcon" class="ms-2" />
|
<n-icon :component="ForwardIcon" class="ms-2" />
|
||||||
<span class="font-bold">Forwarded</span>
|
<span class="font-bold">Forwarded</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div v-if="props.item.forwardedGone" class="text-sm opacity-60">
|
||||||
v-if="props.item.forwardedGone"
|
|
||||||
class="px-4 pb-3 text-sm opacity-60"
|
|
||||||
>
|
|
||||||
Post unavailable
|
Post unavailable
|
||||||
</div>
|
</div>
|
||||||
<post-item
|
<post-item
|
||||||
v-else-if="props.item.forwardedPost"
|
v-else-if="props.item.forwardedPost"
|
||||||
class="px-4 pb-3"
|
|
||||||
:item="props.item.forwardedPost"
|
:item="props.item.forwardedPost"
|
||||||
slim
|
slim
|
||||||
compact
|
compact
|
||||||
|
|||||||
@@ -1,52 +1,51 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="post-list">
|
<div class="post-list">
|
||||||
<!-- Error State -->
|
<!-- Error State -->
|
||||||
<v-alert
|
<n-alert
|
||||||
v-if="hasError"
|
v-if="hasError"
|
||||||
type="error"
|
type="error"
|
||||||
class="mb-4"
|
|
||||||
closable
|
closable
|
||||||
@click:close="refresh"
|
@close="refresh"
|
||||||
|
class="mb-4"
|
||||||
>
|
>
|
||||||
{{ error }}
|
{{ error }}
|
||||||
</v-alert>
|
</n-alert>
|
||||||
|
|
||||||
<!-- Posts List -->
|
<!-- Posts List -->
|
||||||
<v-infinite-scroll
|
<n-infinite-scroll :distance="0" @load="loadMore" style="overflow: auto">
|
||||||
height="auto"
|
|
||||||
class="space-y-4 overflow-y-hidden"
|
|
||||||
side="end"
|
|
||||||
@load="loadMore"
|
|
||||||
>
|
|
||||||
<template v-for="item in posts" :key="item.id">
|
<template v-for="item in posts" :key="item.id">
|
||||||
<post-item
|
<post-item
|
||||||
|
class="mb-4"
|
||||||
:item="item"
|
:item="item"
|
||||||
@react="(symbol, attitude, delta) => $emit('react', item.id, symbol, attitude, delta)"
|
@react="
|
||||||
|
(symbol, attitude, delta) =>
|
||||||
|
$emit('react', item.id, symbol, attitude, delta)
|
||||||
|
"
|
||||||
@click="router.push('/posts/' + item.id)"
|
@click="router.push('/posts/' + item.id)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- Loading State -->
|
<!-- Loading State -->
|
||||||
<template #loading>
|
<div v-if="loading" class="flex justify-center py-4">
|
||||||
<div class="flex justify-center py-4">
|
<n-spin size="medium" />
|
||||||
<v-progress-circular indeterminate size="32" />
|
</div>
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- Empty State -->
|
<!-- Empty State -->
|
||||||
<template #empty>
|
<div
|
||||||
<div v-if="!posts" class="text-center py-8 text-muted-foreground">
|
v-if="!loading && posts.length === 0 && !hasError"
|
||||||
<v-icon icon="mdi-post-outline" size="48" class="mb-2 opacity-50" />
|
class="text-center py-8 text-muted-foreground"
|
||||||
<p>No posts found</p>
|
>
|
||||||
</div>
|
<n-icon :component="FileText" size="48" class="mb-2 opacity-50" />
|
||||||
</template>
|
<p>No posts found</p>
|
||||||
</v-infinite-scroll>
|
</div>
|
||||||
|
</n-infinite-scroll>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { usePostList } from "~/composables/usePostList"
|
import { usePostList } from "~/composables/usePostList"
|
||||||
import type { PostListParams } from "~/composables/usePostList"
|
import type { PostListParams } from "~/composables/usePostList"
|
||||||
|
import { FileText } from "lucide-vue-next"
|
||||||
|
|
||||||
import PostItem from "./PostItem.vue"
|
import PostItem from "./PostItem.vue"
|
||||||
|
|
||||||
@@ -60,12 +59,7 @@ defineEmits<{
|
|||||||
react: [postId: string, symbol: string, attitude: number, delta: number]
|
react: [postId: string, symbol: string, attitude: number, delta: number]
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { posts, hasError, error, loadMore, refresh } =
|
const { posts, hasError, error, loading, loadMore, refresh } = usePostList(
|
||||||
usePostList(props.params)
|
props.params
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
|
||||||
.post-list .v-infinite-scroll .v-infinite-scroll__side:first-child {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,14 +1,78 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-card title="Post your reply" size="small" embedded>
|
<n-card title="Quick Reply" size="small" embedded>
|
||||||
<n-input
|
<div class="flex flex-col gap-2 mb-1">
|
||||||
type="textarea"
|
<pub-select v-model:value="publisher" />
|
||||||
placeholder="Talk about this post for a bit."
|
<n-input
|
||||||
size="large"
|
v-model:value="content"
|
||||||
:rows="5"
|
type="textarea"
|
||||||
auto-grow
|
placeholder="Talk about this post for a bit."
|
||||||
></n-input>
|
size="large"
|
||||||
<div class="flex justify-end mt-4">
|
:rows="3"
|
||||||
<n-button append-icon="mdi-send" size="small">Send</n-button>
|
auto-grow
|
||||||
|
@keydown.meta.enter.exact="submit"
|
||||||
|
@keydown.ctrl.enter.exact="submit"
|
||||||
|
>
|
||||||
|
<template #suffix>
|
||||||
|
<div class="flex items-end h-full py-3">
|
||||||
|
<n-button text :loading="submitting" @click="submit">
|
||||||
|
<template #icon>
|
||||||
|
<n-icon :component="SendIcon" />
|
||||||
|
</template>
|
||||||
|
</n-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</n-input>
|
||||||
</div>
|
</div>
|
||||||
</n-card>
|
</n-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { SendIcon } from "lucide-vue-next"
|
||||||
|
import { ref } from "vue"
|
||||||
|
import { useSolarNetwork } from "~/composables/useSolarNetwork"
|
||||||
|
|
||||||
|
// Interface for uploaded files in the editor
|
||||||
|
interface UploadedFile {
|
||||||
|
name: string
|
||||||
|
url: string
|
||||||
|
type: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
repliedPostId: string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emits = defineEmits(["posted"])
|
||||||
|
|
||||||
|
const publisher = ref<string | undefined>()
|
||||||
|
const content = ref("")
|
||||||
|
|
||||||
|
const fileList = ref<UploadedFile[]>([])
|
||||||
|
|
||||||
|
const submitting = ref(false)
|
||||||
|
|
||||||
|
async function submit() {
|
||||||
|
if (!content.value.trim()) return
|
||||||
|
|
||||||
|
submitting.value = true
|
||||||
|
const api = useSolarNetwork()
|
||||||
|
await api(`/sphere/posts?pub=${publisher.value}`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"content-type": "application/json"
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
content: content.value,
|
||||||
|
replied_post_id: props.repliedPostId,
|
||||||
|
attachments: fileList.value
|
||||||
|
.filter((e) => e.url != null)
|
||||||
|
.map((e) => e.url!.split("/").reverse()[0])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
submitting.value = false
|
||||||
|
content.value = ""
|
||||||
|
fileList.value = []
|
||||||
|
emits("posted")
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -28,13 +28,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- Empty State -->
|
<!-- Empty State -->
|
||||||
<div
|
<n-empty
|
||||||
v-if="!replies || replies.length === 0"
|
v-if="!replies || replies.length === 0"
|
||||||
class="text-center py-8 text-muted-foreground"
|
class="text-center py-8 text-muted-foreground"
|
||||||
|
size="small"
|
||||||
>
|
>
|
||||||
<v-icon icon="mdi-comment-outline" size="48" class="mb-2 opacity-50" />
|
No Replies
|
||||||
<p>No replies yet</p>
|
</n-empty>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</n-card>
|
</n-card>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="replies-list">
|
<div class="replies-list">
|
||||||
<post-quick-reply v-if="!props.hideQuickReply" class="mb-4" />
|
<post-quick-reply
|
||||||
|
v-if="!props.hideQuickReply"
|
||||||
|
:replied-post-id="props.params.postId"
|
||||||
|
@posted="refresh"
|
||||||
|
class="mb-4"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- Error State -->
|
<!-- Error State -->
|
||||||
<n-alert
|
<n-alert
|
||||||
@@ -33,15 +38,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- Empty State -->
|
<!-- Empty State -->
|
||||||
<div
|
<n-empty
|
||||||
v-if="!replies || replies.length === 0"
|
v-if="!replies || replies.length === 0"
|
||||||
class="text-center py-8 text-muted-foreground"
|
class="text-center py-8 text-muted-foreground"
|
||||||
|
size="small"
|
||||||
>
|
>
|
||||||
<n-icon size="48" class="mb-2 opacity-50">
|
No Replies
|
||||||
<i class="mdi mdi-comment-outline"></i>
|
</n-empty>
|
||||||
</n-icon>
|
|
||||||
<p>No replies yet</p>
|
|
||||||
</div>
|
|
||||||
</n-infinite-scroll>
|
</n-infinite-scroll>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,65 +1,74 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-select
|
<n-config-provider :theme-overrides="{ common: { borderRadius: '8px' } }">
|
||||||
:options="pubStore.publishers"
|
<n-select
|
||||||
label-field="nick"
|
:options="pubStore.publishers"
|
||||||
value-field="name"
|
label-field="nick"
|
||||||
:value="props.value"
|
value-field="name"
|
||||||
@update:value="(v) => emits('update:value', v)"
|
:value="props.value"
|
||||||
:render-label="renderLabel"
|
@update:value="(v) => emits('update:value', v)"
|
||||||
:render-tag="renderTag"
|
:render-label="renderLabel"
|
||||||
/>
|
:render-tag="renderTag"
|
||||||
|
/>
|
||||||
|
</n-config-provider>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { usePubStore } from '~/stores/pub'
|
import { usePubStore } from "~/stores/pub"
|
||||||
import { watch, h } from 'vue'
|
import { watch, h } from "vue"
|
||||||
import type { SelectRenderLabel, SelectRenderTag } from 'naive-ui'
|
import type { SelectRenderLabel, SelectRenderTag } from "naive-ui"
|
||||||
|
|
||||||
const pubStore = usePubStore()
|
const pubStore = usePubStore()
|
||||||
const apiBase = useSolarNetworkUrl()
|
const apiBase = useSolarNetworkUrl()
|
||||||
|
|
||||||
const props = defineProps<{ value: string | undefined }>()
|
const props = defineProps<{ value: string | undefined }>()
|
||||||
const emits = defineEmits(['update:value'])
|
const emits = defineEmits(["update:value"])
|
||||||
|
|
||||||
const renderLabel: SelectRenderLabel = (option) => {
|
const renderLabel: SelectRenderLabel = (option) => {
|
||||||
return h('div', { class: 'flex items-center' }, [
|
const pubData = pubStore.publishers.filter((p) => p.id == option.id)[0]
|
||||||
|
return h("div", { class: "flex items-center" }, [
|
||||||
h(NAvatar, {
|
h(NAvatar, {
|
||||||
src: option.picture ? `${apiBase.value}/drive/files/${option.picture.id}` : undefined,
|
round: true,
|
||||||
size: 'small',
|
src: pubData?.picture?.id
|
||||||
class: 'mr-2'
|
? `${apiBase}/drive/files/${pubData.picture!.id}`
|
||||||
|
: undefined,
|
||||||
|
size: "small",
|
||||||
|
class: "mr-2"
|
||||||
}),
|
}),
|
||||||
h('div', null, [
|
h("div", null, [
|
||||||
h('div', null, option.nick as string),
|
h("div", null, pubData!.nick),
|
||||||
h('div', { class: 'text-xs text-gray-500' }, `@${option.name as string}`)
|
h("div", { class: "text-xs opacity-80" }, `@${pubData!.name as string}`)
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderTag: SelectRenderTag = ({ option }) => {
|
const renderTag: SelectRenderTag = ({ option }) => {
|
||||||
|
const pubData = pubStore.publishers.filter((p) => p.id == option.id)[0]
|
||||||
return h(
|
return h(
|
||||||
'div',
|
"div",
|
||||||
{
|
{
|
||||||
class: 'flex items-center'
|
class: "flex items-center"
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
h(NAvatar, {
|
h(NAvatar, {
|
||||||
src: option.picture ? `${apiBase.value}/drive/files/${option.picture.id}` : undefined,
|
round: true,
|
||||||
size: 'small',
|
src: pubData?.picture?.id
|
||||||
class: 'mr-2'
|
? `${apiBase}/drive/files/${pubData.picture!.id}`
|
||||||
|
: undefined,
|
||||||
|
size: "small",
|
||||||
|
class: "mr-2"
|
||||||
}),
|
}),
|
||||||
option.nick as string
|
option.nick as string
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
pubStore,
|
pubStore,
|
||||||
(value) => {
|
(value) => {
|
||||||
if (!props.value && value.publishers) {
|
if (!props.value && value.publishers) {
|
||||||
emits('update:value', pubStore.publishers[0]?.name)
|
emits("update:value", pubStore.publishers[0]?.name)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ deep: true, immediate: true },
|
{ deep: true, immediate: true }
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
80
app/components/VerificationMark.vue
Normal file
80
app/components/VerificationMark.vue
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<template>
|
||||||
|
<n-popover trigger="hover" placement="top">
|
||||||
|
<template #trigger>
|
||||||
|
<div
|
||||||
|
class="rounded-4xl aspect-square flex items-center justify-center mb-1"
|
||||||
|
:style="`background-color: ${verificationColor}; width: ${
|
||||||
|
props.size ?? 16
|
||||||
|
}px; height: ${props.size ?? 16}px`"
|
||||||
|
>
|
||||||
|
<component
|
||||||
|
:is="verificationIcon"
|
||||||
|
fill="white"
|
||||||
|
stroke="white"
|
||||||
|
style="padding: 0.2rem"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div class="max-w-xs">
|
||||||
|
<div class="font-bold">{{ mark.title || "No title" }}</div>
|
||||||
|
<div class="text-sm mt-1">{{ mark.description || "No description" }}</div>
|
||||||
|
</div>
|
||||||
|
</n-popover>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from "vue"
|
||||||
|
import type { SnVerification } from "~/types/api/publisher"
|
||||||
|
import {
|
||||||
|
Wrench,
|
||||||
|
BadgeCheck,
|
||||||
|
ShieldCheck,
|
||||||
|
Landmark,
|
||||||
|
Palette,
|
||||||
|
Code,
|
||||||
|
Drama
|
||||||
|
} from "lucide-vue-next"
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
mark: SnVerification
|
||||||
|
size?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps<Props>()
|
||||||
|
|
||||||
|
// Icon mapping based on verification type
|
||||||
|
const verificationIcons = [
|
||||||
|
Wrench, // 0: build_circle equivalent
|
||||||
|
BadgeCheck, // 1: verified
|
||||||
|
ShieldCheck, // 2: verified (alternative)
|
||||||
|
Landmark, // 3: account_balance
|
||||||
|
Palette, // 4: palette
|
||||||
|
Code, // 5: code
|
||||||
|
Drama // 6: masks
|
||||||
|
]
|
||||||
|
|
||||||
|
// Color mapping based on verification type
|
||||||
|
const verificationColors = [
|
||||||
|
"#14b8a6", // teal
|
||||||
|
"#03a9f4", // lightBlue
|
||||||
|
"#3f51b5", // indigo
|
||||||
|
"#f44336", // red
|
||||||
|
"#ff9800", // orange
|
||||||
|
"#2196f3", // blue
|
||||||
|
"#448aff" // blueAccent
|
||||||
|
]
|
||||||
|
|
||||||
|
const verificationIcon = computed(() => {
|
||||||
|
const type = props.mark.type
|
||||||
|
return type >= 0 && type < verificationIcons.length
|
||||||
|
? verificationIcons[type]
|
||||||
|
: BadgeCheck
|
||||||
|
})
|
||||||
|
|
||||||
|
const verificationColor = computed(() => {
|
||||||
|
const type = props.mark.type
|
||||||
|
return type >= 0 && type < verificationColors.length
|
||||||
|
? verificationColors[type]
|
||||||
|
: "#2196f3"
|
||||||
|
})
|
||||||
|
</script>
|
||||||
83
app/components/VerificationStatusCard.vue
Normal file
83
app/components/VerificationStatusCard.vue
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<template>
|
||||||
|
<div v-if="mark" class="verification-card">
|
||||||
|
<div class="flex items-start">
|
||||||
|
<n-icon
|
||||||
|
:component="verificationIcon"
|
||||||
|
:size="32"
|
||||||
|
:color="verificationColor"
|
||||||
|
class="shrink-0"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="mt-2">
|
||||||
|
<div class="font-bold text-base">{{ mark.title || "No title" }}</div>
|
||||||
|
<div class="text-sm mt-1">{{ mark.description || "No description" }}</div>
|
||||||
|
<div class="text-xs mt-1.5 opacity-80">
|
||||||
|
Verified by<br />{{ mark.verifiedBy || "No one verified it" }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from "vue"
|
||||||
|
import type { SnVerification } from "~/types/api/publisher"
|
||||||
|
import {
|
||||||
|
Wrench,
|
||||||
|
BadgeCheck,
|
||||||
|
ShieldCheck,
|
||||||
|
Landmark,
|
||||||
|
Palette,
|
||||||
|
Code,
|
||||||
|
Drama
|
||||||
|
} from "lucide-vue-next"
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
mark: SnVerification
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps<Props>()
|
||||||
|
|
||||||
|
// Icon mapping based on verification type
|
||||||
|
const verificationIcons = [
|
||||||
|
Wrench, // 0: build_circle equivalent
|
||||||
|
BadgeCheck, // 1: verified
|
||||||
|
ShieldCheck, // 2: verified (alternative)
|
||||||
|
Landmark, // 3: account_balance
|
||||||
|
Palette, // 4: palette
|
||||||
|
Code, // 5: code
|
||||||
|
Drama // 6: masks
|
||||||
|
]
|
||||||
|
|
||||||
|
// Color mapping based on verification type
|
||||||
|
const verificationColors = [
|
||||||
|
"#14b8a6", // teal
|
||||||
|
"#03a9f4", // lightBlue
|
||||||
|
"#3f51b5", // indigo
|
||||||
|
"#f44336", // red
|
||||||
|
"#ff9800", // orange
|
||||||
|
"#2196f3", // blue
|
||||||
|
"#448aff" // blueAccent
|
||||||
|
]
|
||||||
|
|
||||||
|
const verificationIcon = computed(() => {
|
||||||
|
const type = props.mark.type
|
||||||
|
return type >= 0 && type < verificationIcons.length
|
||||||
|
? verificationIcons[type]
|
||||||
|
: BadgeCheck
|
||||||
|
})
|
||||||
|
|
||||||
|
const verificationColor = computed(() => {
|
||||||
|
const type = props.mark.type
|
||||||
|
return type >= 0 && type < verificationColors.length
|
||||||
|
? verificationColors[type]
|
||||||
|
: "#2196f3"
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.verification-card {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -40,7 +40,7 @@ export const usePostList = (params: PostListParams = {}) => {
|
|||||||
total: 0
|
total: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
const isLoading = computed(() => state.value.loading)
|
const loading = computed(() => state.value.loading)
|
||||||
const hasError = computed(() => state.value.error !== null)
|
const hasError = computed(() => state.value.error !== null)
|
||||||
const posts = computed(() => state.value.posts)
|
const posts = computed(() => state.value.posts)
|
||||||
const hasMore = computed(() => state.value.hasMore)
|
const hasMore = computed(() => state.value.hasMore)
|
||||||
@@ -153,7 +153,7 @@ export const usePostList = (params: PostListParams = {}) => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
posts,
|
posts,
|
||||||
isLoading,
|
loading,
|
||||||
hasError,
|
hasError,
|
||||||
hasMore,
|
hasMore,
|
||||||
error: computed(() => state.value.error),
|
error: computed(() => state.value.error),
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { keysToCamel, keysToSnake } from "~/utils/transformKeys"
|
|||||||
|
|
||||||
export const useSolarNetwork = () => {
|
export const useSolarNetwork = () => {
|
||||||
const apiBase = useSolarNetworkUrl()
|
const apiBase = useSolarNetworkUrl()
|
||||||
|
const devToken = useRuntimeConfig().public.devToken
|
||||||
|
|
||||||
// Forward cookies from the incoming request
|
// Forward cookies from the incoming request
|
||||||
const headers: HeadersInit = import.meta.server
|
const headers: HeadersInit = import.meta.server
|
||||||
@@ -18,6 +19,12 @@ export const useSolarNetwork = () => {
|
|||||||
const side = import.meta.server ? "SERVER" : "CLIENT"
|
const side = import.meta.server ? "SERVER" : "CLIENT"
|
||||||
console.log(`[useSolarNetwork] onRequest for ${request} on ${side}`)
|
console.log(`[useSolarNetwork] onRequest for ${request} on ${side}`)
|
||||||
|
|
||||||
|
if (devToken) {
|
||||||
|
console.log("[useSolarNetwork] Using dev token...")
|
||||||
|
options.headers.delete("Cookie")
|
||||||
|
options.headers.set("Authorization", `Bearer ${devToken}`)
|
||||||
|
}
|
||||||
|
|
||||||
// Transform request data from camelCase to snake_case
|
// Transform request data from camelCase to snake_case
|
||||||
if (options.body && typeof options.body === "object") {
|
if (options.body && typeof options.body === "object") {
|
||||||
options.body = keysToSnake(options.body)
|
options.body = keysToSnake(options.body)
|
||||||
|
|||||||
@@ -3,40 +3,35 @@
|
|||||||
<header
|
<header
|
||||||
class="navbar bg-transparent shadow-lg fixed top-0 left-0 right-0 backdrop-blur-2xl z-1000 h-[64px]"
|
class="navbar bg-transparent shadow-lg fixed top-0 left-0 right-0 backdrop-blur-2xl z-1000 h-[64px]"
|
||||||
>
|
>
|
||||||
<div class="container mx-auto flex items-center">
|
<div class="container mx-auto flex items-center justify-between px-5">
|
||||||
<img
|
<div class="flex gap-2">
|
||||||
:src="IconLight"
|
<div class="flex items-center justify-center w-[40px]">
|
||||||
width="32"
|
<img :src="IconLight" alt="The Solar Network" class="fit-cover" />
|
||||||
height="32"
|
</div>
|
||||||
class="mr-4"
|
|
||||||
alt="The Solar Network"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<n-menu
|
<n-menu
|
||||||
v-model:value="activeKey"
|
v-model:value="activeKey"
|
||||||
mode="horizontal"
|
mode="horizontal"
|
||||||
:options="menuOptions"
|
:options="menuOptions"
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
<div class="grow" />
|
|
||||||
|
|
||||||
<n-dropdown :options="dropdownOptions" @select="handleDropdownSelect">
|
<n-dropdown :options="dropdownOptions" @select="handleDropdownSelect">
|
||||||
<n-avatar
|
<n-avatar
|
||||||
round
|
:size="32"
|
||||||
class="mr-4 cursor-pointer"
|
|
||||||
:src="
|
:src="
|
||||||
user?.profile.picture
|
user?.profile.picture
|
||||||
? `${apiBase}/drive/files/${user?.profile.picture?.id}`
|
? `${apiBase}/drive/files/${user?.profile.picture?.id}`
|
||||||
: undefined
|
: undefined
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<n-icon :component="UserCircleIcon" />
|
<n-icon :component="UserIcon" :size="20" />
|
||||||
</n-avatar>
|
</n-avatar>
|
||||||
</n-dropdown>
|
</n-dropdown>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main class="grow container mx-auto py-4 mt-[64px]">
|
<main class="grow mt-[64px]">
|
||||||
<slot />
|
<slot />
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
@@ -46,9 +41,16 @@
|
|||||||
import IconLight from "~/assets/images/cloudy-lamb.png"
|
import IconLight from "~/assets/images/cloudy-lamb.png"
|
||||||
|
|
||||||
import type { MenuOption } from "naive-ui"
|
import type { MenuOption } from "naive-ui"
|
||||||
|
import { NIcon } from "naive-ui"
|
||||||
import { computed, h } from "vue"
|
import { computed, h } from "vue"
|
||||||
import { useRouter, useRoute } from "vue-router"
|
import { useRouter, useRoute, RouterLink } from "vue-router"
|
||||||
import { CompassIcon, UserCircleIcon } from "lucide-vue-next"
|
import {
|
||||||
|
CompassIcon,
|
||||||
|
LayoutDashboardIcon,
|
||||||
|
LogInIcon,
|
||||||
|
UserIcon,
|
||||||
|
UserPlusIcon
|
||||||
|
} from "lucide-vue-next"
|
||||||
|
|
||||||
const apiBase = useSolarNetworkUrl()
|
const apiBase = useSolarNetworkUrl()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -63,17 +65,18 @@ const activeKey = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function renderIcon(icon: any) {
|
function renderIcon(icon: any) {
|
||||||
return () => h(NIcon, null, { default: () => icon })
|
return () => h(NIcon, null, { default: () => h(icon) })
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderLabel(label: string, route: string) {
|
||||||
|
return () => h(RouterLink, { to: route }, { default: () => label })
|
||||||
}
|
}
|
||||||
|
|
||||||
const menuOptions: MenuOption[] = [
|
const menuOptions: MenuOption[] = [
|
||||||
{
|
{
|
||||||
label: "Explore",
|
label: renderLabel("Explore", "/"),
|
||||||
key: "explore",
|
key: "explore",
|
||||||
icon: renderIcon(h(CompassIcon)),
|
icon: renderIcon(CompassIcon)
|
||||||
props: {
|
|
||||||
onClick: () => router.push("/")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -83,7 +86,7 @@ const dropdownOptions = computed(() => {
|
|||||||
{
|
{
|
||||||
label: "Dashboard",
|
label: "Dashboard",
|
||||||
key: "/accounts/me",
|
key: "/accounts/me",
|
||||||
icon: () => h("span", { class: "mdi mdi-view-dashboard" })
|
icon: renderIcon(LayoutDashboardIcon)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
@@ -91,12 +94,12 @@ const dropdownOptions = computed(() => {
|
|||||||
{
|
{
|
||||||
label: "Login",
|
label: "Login",
|
||||||
key: "/auth/login",
|
key: "/auth/login",
|
||||||
icon: () => h("span", { class: "mdi mdi-login" })
|
icon: renderIcon(LogInIcon)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Create Account",
|
label: "Create Account",
|
||||||
key: "/auth/create-account",
|
key: "/auth/create-account",
|
||||||
icon: () => h("span", { class: "mdi mdi-account-plus" })
|
icon: renderIcon(UserPlusIcon)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,121 +1,133 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="user">
|
<div>
|
||||||
|
<div class="fixed inset-0 blur-md" :style="pageStyle" />
|
||||||
<img
|
<img
|
||||||
:src="userBackground"
|
:src="userBackground"
|
||||||
class="object-cover w-full max-h-48 mb-8"
|
class="w-full max-h-48 object-cover object-top"
|
||||||
style="aspect-ratio: 16/7"
|
:style="{ aspectRatio: '16/7', opacity: headerOpacity }"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="container mx-auto px-8 pb-8">
|
<div v-if="user" class="relative min-h-layout">
|
||||||
<div class="flex items-center gap-6 mb-8">
|
<div class="container mx-auto p-8 pt-12">
|
||||||
<v-avatar size="80" rounded="circle" :image="userPicture" />
|
<div class="flex items-center gap-6 mb-8">
|
||||||
<div>
|
<n-avatar :size="80" round :src="userPicture" />
|
||||||
<div class="text-2xl font-bold">
|
<div>
|
||||||
{{ user.nick || user.name }}
|
<div class="text-2xl font-bold">
|
||||||
|
{{ user.nick || user.name }}
|
||||||
|
</div>
|
||||||
|
<div class="text-sm opacity-80">@{{ user.name }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-body-2 text-medium-emphasis">@{{ user.name }}</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<v-card
|
<n-card
|
||||||
title="Info"
|
title="Info"
|
||||||
prepend-icon="mdi-information"
|
size="small"
|
||||||
density="comfortable"
|
:class="cardClass"
|
||||||
>
|
:style="cardStyle"
|
||||||
<v-card-text class="flex flex-col gap-2">
|
:content-style="cardContentStyle"
|
||||||
<div v-if="user?.profile?.timeZone" class="flex gap-2">
|
>
|
||||||
<span class="flex items-center gap-2 grow">
|
<template #header-extra>
|
||||||
<v-icon>mdi-clock-outline</v-icon>
|
<n-icon :component="Info" />
|
||||||
Time Zone
|
</template>
|
||||||
</span>
|
<div class="flex flex-col gap-2">
|
||||||
<span class="flex gap-2">
|
<div v-if="user?.profile?.timeZone" class="flex gap-2">
|
||||||
|
<span class="flex items-center gap-2 grow">
|
||||||
|
<n-icon :component="Clock" />
|
||||||
|
Time Zone
|
||||||
|
</span>
|
||||||
|
<span class="flex gap-2">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
new Date().toLocaleTimeString(void 0, {
|
||||||
|
timeZone: user.profile.timeZone
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
<span class="font-bold">·</span>
|
||||||
|
<span>{{ getOffsetUTCString(user.profile.timeZone) }}</span>
|
||||||
|
<span class="font-bold">·</span>
|
||||||
|
<span>{{ user.profile.timeZone }}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div v-if="user?.profile?.location" class="flex gap-2">
|
||||||
|
<span class="flex items-center gap-2 grow">
|
||||||
|
<n-icon :component="MapPin" />
|
||||||
|
Location
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
{{ user.profile.location }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="user?.profile?.firstName || user?.profile?.lastName"
|
||||||
|
class="flex gap-2"
|
||||||
|
>
|
||||||
|
<span class="flex items-center gap-2 grow">
|
||||||
|
<n-icon :component="UserPen" />
|
||||||
|
Name
|
||||||
|
</span>
|
||||||
<span>
|
<span>
|
||||||
{{
|
{{
|
||||||
new Date().toLocaleTimeString(void 0, {
|
[
|
||||||
timeZone: user.profile.timeZone
|
user.profile.firstName,
|
||||||
})
|
user.profile.middleName,
|
||||||
|
user.profile.lastName
|
||||||
|
]
|
||||||
|
.filter(Boolean)
|
||||||
|
.join(" ")
|
||||||
}}
|
}}
|
||||||
</span>
|
</span>
|
||||||
<span class="font-bold">·</span>
|
</div>
|
||||||
<span>{{ getOffsetUTCString(user.profile.timeZone) }}</span>
|
<div
|
||||||
<span class="font-bold">·</span>
|
v-if="user?.profile?.gender || user?.profile?.pronouns"
|
||||||
<span>{{ user.profile.timeZone }}</span>
|
class="flex gap-2"
|
||||||
</span>
|
>
|
||||||
</div>
|
<span class="flex items-center gap-2 grow">
|
||||||
<div v-if="user?.profile?.location" class="flex gap-2">
|
<n-icon :component="User" />
|
||||||
<span class="flex items-center gap-2 grow">
|
Gender
|
||||||
<v-icon>mdi-map-marker-outline</v-icon>
|
</span>
|
||||||
Location
|
<span class="flex gap-2">
|
||||||
</span>
|
<span>{{ user.profile.gender || "Unspecified" }}</span>
|
||||||
<span>
|
<span class="font-bold">·</span>
|
||||||
{{ user.profile.location }}
|
<span>{{ user.profile.pronouns || "Unspecified" }}</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div class="flex gap-2">
|
||||||
v-if="user?.profile?.firstName || user?.profile?.lastName"
|
<span class="flex items-center gap-2 grow">
|
||||||
class="flex gap-2"
|
<n-icon :component="Calendar" />
|
||||||
>
|
Joined at
|
||||||
<span class="flex items-center gap-2 grow">
|
</span>
|
||||||
<v-icon>mdi-account-edit-outline</v-icon>
|
|
||||||
Name
|
|
||||||
</span>
|
|
||||||
<span>
|
|
||||||
{{
|
|
||||||
[
|
|
||||||
user.profile.firstName,
|
|
||||||
user.profile.middleName,
|
|
||||||
user.profile.lastName
|
|
||||||
]
|
|
||||||
.filter(Boolean)
|
|
||||||
.join(" ")
|
|
||||||
}}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
v-if="user?.profile?.gender || user?.profile?.pronouns"
|
|
||||||
class="flex gap-2"
|
|
||||||
>
|
|
||||||
<span class="flex items-center gap-2 grow">
|
|
||||||
<v-icon>mdi-account-circle</v-icon>
|
|
||||||
Gender
|
|
||||||
</span>
|
|
||||||
<span class="flex gap-2">
|
|
||||||
<span>{{ user.profile.gender || "Unspecified" }}</span>
|
|
||||||
<span class="font-bold">·</span>
|
|
||||||
<span>{{ user.profile.pronouns || "Unspecified" }}</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex gap-2">
|
|
||||||
<span class="flex items-center gap-2 grow">
|
|
||||||
<v-icon>mdi-calendar-month-outline</v-icon>
|
|
||||||
Joined at
|
|
||||||
</span>
|
|
||||||
<span>{{
|
|
||||||
user ? new Date(user.createdAt).toLocaleDateString() : ""
|
|
||||||
}}</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="user?.profile?.birthday" class="flex gap-2">
|
|
||||||
<span class="flex items-center gap-2 grow">
|
|
||||||
<v-icon>mdi-cake-variant-outline</v-icon>
|
|
||||||
Birthday
|
|
||||||
</span>
|
|
||||||
<span class="flex gap-2">
|
|
||||||
<span
|
|
||||||
>{{ calculateAge(new Date(user.profile.birthday)) }} yrs
|
|
||||||
old</span
|
|
||||||
>
|
|
||||||
<span class="font-bold">·</span>
|
|
||||||
<span>{{
|
<span>{{
|
||||||
new Date(user.profile.birthday).toLocaleDateString()
|
user ? new Date(user.createdAt).toLocaleDateString() : ""
|
||||||
}}</span>
|
}}</span>
|
||||||
</span>
|
</div>
|
||||||
|
<div v-if="user?.profile?.birthday" class="flex gap-2">
|
||||||
|
<span class="flex items-center gap-2 grow">
|
||||||
|
<n-icon :component="Cake" />
|
||||||
|
Birthday
|
||||||
|
</span>
|
||||||
|
<span class="flex gap-2">
|
||||||
|
<span
|
||||||
|
>{{ calculateAge(new Date(user.profile.birthday)) }} yrs
|
||||||
|
old</span
|
||||||
|
>
|
||||||
|
<span class="font-bold">·</span>
|
||||||
|
<span>{{
|
||||||
|
new Date(user.profile.birthday).toLocaleDateString()
|
||||||
|
}}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</v-card-text>
|
</n-card>
|
||||||
</v-card>
|
<n-card
|
||||||
<v-card v-if="user?.perkSubscription">
|
v-if="user?.perkSubscription"
|
||||||
<v-card-text>
|
size="small"
|
||||||
|
:class="cardClass"
|
||||||
|
:style="cardStyle"
|
||||||
|
:content-style="cardContentStyle"
|
||||||
|
>
|
||||||
<div class="flex justify-between items-center">
|
<div class="flex justify-between items-center">
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<div class="text-xl font-bold">
|
<div class="text-xl font-bold">
|
||||||
@@ -127,62 +139,103 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="text-sm">Stellar Program Member</div>
|
<div class="text-sm">Stellar Program Member</div>
|
||||||
</div>
|
</div>
|
||||||
<v-icon
|
<n-icon
|
||||||
size="48"
|
:size="48"
|
||||||
:color="
|
:color="
|
||||||
perkSubscriptionNames[user.perkSubscription.identifier]
|
perkSubscriptionNames[user.perkSubscription.identifier]
|
||||||
?.color || '#2196f3'
|
?.color || '#2196f3'
|
||||||
"
|
"
|
||||||
>
|
:component="Star"
|
||||||
mdi-star-circle
|
/>
|
||||||
</v-icon>
|
|
||||||
</div>
|
</div>
|
||||||
</v-card-text>
|
</n-card>
|
||||||
</v-card>
|
<n-card
|
||||||
<v-card>
|
size="small"
|
||||||
<v-card-text>
|
:class="cardClass"
|
||||||
|
:style="cardStyle"
|
||||||
|
:content-style="cardContentStyle"
|
||||||
|
>
|
||||||
<div class="flex justify-between items-center mb-2">
|
<div class="flex justify-between items-center mb-2">
|
||||||
<div>Level {{ user?.profile?.level || 0 }}</div>
|
<div>Level {{ user?.profile?.level || 0 }}</div>
|
||||||
<div>{{ user?.profile?.experience || 0 }} XP</div>
|
<div>{{ user?.profile?.experience || 0 }} XP</div>
|
||||||
</div>
|
</div>
|
||||||
<v-progress-linear
|
<n-progress
|
||||||
:model-value="user?.profile?.levelingProgress || 0"
|
type="line"
|
||||||
color="success"
|
:percentage="user?.profile?.levelingProgress || 0"
|
||||||
class="mb-0"
|
status="success"
|
||||||
rounded
|
:show-indicator="false"
|
||||||
/>
|
/>
|
||||||
</v-card-text>
|
</n-card>
|
||||||
</v-card>
|
|
||||||
</div>
|
<n-card
|
||||||
<div>
|
v-if="user?.profile?.verification"
|
||||||
<v-card v-if="htmlBio" title="Bio" prepend-icon="mdi-pencil">
|
size="small"
|
||||||
<v-card-text>
|
:class="cardClass"
|
||||||
|
:style="cardStyle"
|
||||||
|
:content-style="cardContentStyle"
|
||||||
|
>
|
||||||
|
<verification-status-card :mark="user.profile.verification" />
|
||||||
|
</n-card>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<n-card
|
||||||
|
v-if="htmlBio"
|
||||||
|
title="Bio"
|
||||||
|
size="small"
|
||||||
|
:class="cardClass"
|
||||||
|
:style="cardStyle"
|
||||||
|
:content-style="cardContentStyle"
|
||||||
|
>
|
||||||
|
<template #header-extra>
|
||||||
|
<n-icon :component="PenLine" />
|
||||||
|
</template>
|
||||||
<article
|
<article
|
||||||
class="bio-prose prose prose-sm dark:prose-invert prose-slate"
|
class="bio-prose prose prose-sm dark:prose-invert prose-slate"
|
||||||
v-html="htmlBio"
|
v-html="htmlBio"
|
||||||
></article>
|
></article>
|
||||||
</v-card-text>
|
</n-card>
|
||||||
</v-card>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div
|
||||||
<div v-else-if="notFound" class="flex justify-center items-center h-full">
|
v-else-if="notFound"
|
||||||
<v-empty-state
|
class="relative flex justify-center items-center h-full"
|
||||||
icon="mdi-account-off"
|
>
|
||||||
title="User not found"
|
<n-empty
|
||||||
text="The user profile you're trying to access is not found."
|
description="The user profile you're trying to access is not found."
|
||||||
/>
|
>
|
||||||
</div>
|
<template #icon>
|
||||||
<div v-else class="flex justify-center items-center h-full">
|
<n-icon :component="UserX" />
|
||||||
<v-progress-circular indeterminate size="64" color="primary" />
|
</template>
|
||||||
|
<template #extra>
|
||||||
|
<div class="text-lg font-bold">User not found</div>
|
||||||
|
</template>
|
||||||
|
</n-empty>
|
||||||
|
</div>
|
||||||
|
<div v-else class="relative flex justify-center items-center h-full">
|
||||||
|
<n-spin size="large" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref, watch } from "vue"
|
import { computed, ref, watch } from "vue"
|
||||||
|
import { useWindowScroll } from "@vueuse/core"
|
||||||
import { useMarkdownProcessor } from "~/composables/useMarkdownProcessor"
|
import { useMarkdownProcessor } from "~/composables/useMarkdownProcessor"
|
||||||
import type { SnAccount } from "~/types/api"
|
import type { SnAccount } from "~/types/api"
|
||||||
|
import {
|
||||||
|
Info,
|
||||||
|
Clock,
|
||||||
|
MapPin,
|
||||||
|
UserPen,
|
||||||
|
User,
|
||||||
|
Calendar,
|
||||||
|
Cake,
|
||||||
|
Star,
|
||||||
|
PenLine,
|
||||||
|
UserX
|
||||||
|
} from "lucide-vue-next"
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
@@ -209,7 +262,7 @@ try {
|
|||||||
console.error("Failed to fetch user:", error.value)
|
console.error("Failed to fetch user:", error.value)
|
||||||
notFound.value = true
|
notFound.value = true
|
||||||
} else if (data.value) {
|
} else if (data.value) {
|
||||||
user.value = data.value
|
user.value = keysToCamel(data.value)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Failed to fetch user:", err)
|
console.error("Failed to fetch user:", err)
|
||||||
@@ -247,9 +300,7 @@ const htmlBio = ref<string | undefined>(undefined)
|
|||||||
watch(
|
watch(
|
||||||
user,
|
user,
|
||||||
(value) => {
|
(value) => {
|
||||||
htmlBio.value = value?.profile.bio
|
htmlBio.value = value?.profile.bio ? render(value.profile.bio) : undefined
|
||||||
? render(value.profile.bio)
|
|
||||||
: undefined
|
|
||||||
},
|
},
|
||||||
{ immediate: true, deep: true }
|
{ immediate: true, deep: true }
|
||||||
)
|
)
|
||||||
@@ -259,12 +310,48 @@ const userBackground = computed(() => {
|
|||||||
? `${apiBase}/drive/files/${user.value.profile.background.id}?original=true`
|
? `${apiBase}/drive/files/${user.value.profile.background.id}?original=true`
|
||||||
: undefined
|
: undefined
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { y: scrollY } = useWindowScroll()
|
||||||
|
const scrollThreshold = 192 // max-h-48 is 12rem = 192px
|
||||||
|
|
||||||
|
const backgroundOpacity = computed(() => {
|
||||||
|
return Math.max(0, Math.min(scrollY.value / scrollThreshold, 1))
|
||||||
|
})
|
||||||
|
|
||||||
|
const headerOpacity = computed(() => {
|
||||||
|
return 1 - backgroundOpacity.value
|
||||||
|
})
|
||||||
|
|
||||||
|
const pageStyle = computed(() => {
|
||||||
|
if (!userBackground.value) return {}
|
||||||
|
return {
|
||||||
|
backgroundImage: `linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url('${userBackground.value}')`,
|
||||||
|
backgroundSize: "cover",
|
||||||
|
backgroundPosition: "center",
|
||||||
|
backgroundRepeat: "no-repeat",
|
||||||
|
backgroundAttachment: "fixed",
|
||||||
|
opacity: backgroundOpacity.value
|
||||||
|
}
|
||||||
|
})
|
||||||
const userPicture = computed(() => {
|
const userPicture = computed(() => {
|
||||||
return user.value?.profile.picture
|
return user.value?.profile.picture
|
||||||
? `${apiBase}/drive/files/${user.value.profile.picture.id}`
|
? `${apiBase}/drive/files/${user.value.profile.picture.id}`
|
||||||
: undefined
|
: undefined
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const cardClass = computed(() => ({
|
||||||
|
"backdrop-blur-2xl": !!userBackground.value,
|
||||||
|
"shadow-xl": !!userBackground.value
|
||||||
|
}))
|
||||||
|
|
||||||
|
const cardStyle = computed(() =>
|
||||||
|
userBackground.value ? "background-color: rgba(255, 255, 255, 0.1)" : ""
|
||||||
|
)
|
||||||
|
|
||||||
|
const cardContentStyle = computed(() =>
|
||||||
|
userBackground.value ? "background-color: transparent" : ""
|
||||||
|
)
|
||||||
|
|
||||||
function calculateAge(birthday: Date) {
|
function calculateAge(birthday: Date) {
|
||||||
const birthDate = new Date(birthday)
|
const birthDate = new Date(birthday)
|
||||||
const today = new Date()
|
const today = new Date()
|
||||||
@@ -328,6 +415,7 @@ useHead({
|
|||||||
|
|
||||||
defineOgImage({
|
defineOgImage({
|
||||||
component: "ImageCard",
|
component: "ImageCard",
|
||||||
|
// @ts-ignore
|
||||||
title: computed(() =>
|
title: computed(() =>
|
||||||
user.value ? user.value.nick || user.value.name : "User Profile"
|
user.value ? user.value.nick || user.value.name : "User Profile"
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,110 +1,17 @@
|
|||||||
<template>
|
|
||||||
<v-container class="d-flex align-center justify-center fill-height">
|
|
||||||
<v-card max-width="1000" rounded="lg" width="100%">
|
|
||||||
<div v-if="isLoading" class="d-flex justify-center mb-4">
|
|
||||||
<v-progress-linear indeterminate color="primary" height="4" />
|
|
||||||
</div>
|
|
||||||
<div class="pa-8">
|
|
||||||
<div class="mb-4">
|
|
||||||
<img :src="IconLight" alt="CloudyLamb" height="60" width="60" />
|
|
||||||
</div>
|
|
||||||
<v-row>
|
|
||||||
<v-col cols="12" lg="6" class="d-flex align-start justify-start">
|
|
||||||
<div class="md:text-left h-auto">
|
|
||||||
<h2 class="text-2xl font-bold mb-1">Authorize Application</h2>
|
|
||||||
<p class="text-lg">Grant access to your Solar Network account</p>
|
|
||||||
</div>
|
|
||||||
</v-col>
|
|
||||||
<v-col cols="12" lg="6" class="d-flex align-center justify-stretch">
|
|
||||||
<div class="w-full d-flex flex-column md:text-right">
|
|
||||||
<div v-if="error" class="mb-4">
|
|
||||||
<v-alert
|
|
||||||
type="error"
|
|
||||||
closable
|
|
||||||
@update:model-value="error = null"
|
|
||||||
>
|
|
||||||
{{ error }}
|
|
||||||
</v-alert>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- App Info Section -->
|
|
||||||
<div v-if="clientInfo" class="mb-6">
|
|
||||||
<div class="d-flex align-center mb-4 text-left">
|
|
||||||
<div>
|
|
||||||
<h3 class="text-xl font-semibold">
|
|
||||||
{{ clientInfo.clientName || "Unknown Application" }}
|
|
||||||
</h3>
|
|
||||||
<p class="text-base">
|
|
||||||
{{
|
|
||||||
isNewApp
|
|
||||||
? "wants to access your Solar Network account"
|
|
||||||
: "wants to access your account"
|
|
||||||
}}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Requested Permissions -->
|
|
||||||
<v-card variant="outlined" class="pa-4 mb-4 text-left">
|
|
||||||
<h4 class="font-medium mb-2">
|
|
||||||
This will allow
|
|
||||||
{{ clientInfo.clientName || "the app" }} to
|
|
||||||
</h4>
|
|
||||||
<ul class="space-y-1">
|
|
||||||
<li
|
|
||||||
v-for="scope in requestedScopes"
|
|
||||||
:key="scope"
|
|
||||||
class="d-flex align-start"
|
|
||||||
>
|
|
||||||
<v-icon class="mt-1 mr-2" color="success" size="18"
|
|
||||||
>mdi-check</v-icon
|
|
||||||
>
|
|
||||||
<span>{{ scope }}</span>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</v-card>
|
|
||||||
|
|
||||||
<!-- Buttons -->
|
|
||||||
<div class="d-flex gap-3 mt-4">
|
|
||||||
<v-btn
|
|
||||||
color="primary"
|
|
||||||
:loading="isAuthorizing"
|
|
||||||
class="grow"
|
|
||||||
size="large"
|
|
||||||
@click="handleAuthorize"
|
|
||||||
>
|
|
||||||
Authorize
|
|
||||||
</v-btn>
|
|
||||||
<v-btn
|
|
||||||
variant="outlined"
|
|
||||||
:disabled="isAuthorizing"
|
|
||||||
class="grow"
|
|
||||||
size="large"
|
|
||||||
@click="handleDeny"
|
|
||||||
>
|
|
||||||
Deny
|
|
||||||
</v-btn>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</div>
|
|
||||||
</v-card>
|
|
||||||
<footer-compact />
|
|
||||||
</v-container>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted } from "vue"
|
import { ref, computed, onMounted } from "vue"
|
||||||
import { useRoute } from "vue-router"
|
import { useRoute } from "vue-router"
|
||||||
import { useSolarNetwork } from "~/composables/useSolarNetwork"
|
import { useSolarNetwork } from "~/composables/useSolarNetwork"
|
||||||
|
import { CheckIcon, PlugIcon } from "lucide-vue-next"
|
||||||
|
|
||||||
import IconLight from "~/assets/images/cloudy-lamb.png"
|
import IconLight from "~/assets/images/cloudy-lamb.png"
|
||||||
|
import type { SnCloudFile } from "~/types/api/post"
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const api = useSolarNetwork()
|
const api = useSolarNetwork()
|
||||||
|
|
||||||
|
const message = useMessage()
|
||||||
|
|
||||||
useHead({
|
useHead({
|
||||||
title: "Authorize Application"
|
title: "Authorize Application"
|
||||||
})
|
})
|
||||||
@@ -112,11 +19,11 @@ useHead({
|
|||||||
// State
|
// State
|
||||||
const isLoading = ref(true)
|
const isLoading = ref(true)
|
||||||
const isAuthorizing = ref(false)
|
const isAuthorizing = ref(false)
|
||||||
const error = ref<string | null>(null)
|
|
||||||
const clientInfo = ref<{
|
const clientInfo = ref<{
|
||||||
clientName?: string
|
clientName?: string
|
||||||
homeUri?: string
|
homeUri?: string
|
||||||
picture?: { url: string }
|
picture?: SnCloudFile
|
||||||
|
background?: SnCloudFile
|
||||||
scopes?: string[]
|
scopes?: string[]
|
||||||
} | null>(null)
|
} | null>(null)
|
||||||
const isNewApp = ref(false)
|
const isNewApp = ref(false)
|
||||||
@@ -133,9 +40,7 @@ async function fetchClientInfo() {
|
|||||||
clientInfo.value = await api(`/id/auth/open/authorize?${queryString}`)
|
clientInfo.value = await api(`/id/auth/open/authorize?${queryString}`)
|
||||||
checkIfNewApp()
|
checkIfNewApp()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error.value =
|
message.error(err instanceof Error ? err.message : String(err))
|
||||||
(err instanceof Error ? err.message : String(err)) ||
|
|
||||||
"An error occurred while loading the authorization request"
|
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
}
|
}
|
||||||
@@ -165,9 +70,7 @@ async function handleAuthorize(authorize = true) {
|
|||||||
window.location.href = data.redirectUri
|
window.location.href = data.redirectUri
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error.value =
|
message.error(err instanceof Error ? err.message : String(err))
|
||||||
(err instanceof Error ? err.message : String(err)) ||
|
|
||||||
"An error occurred during authorization"
|
|
||||||
} finally {
|
} finally {
|
||||||
isAuthorizing.value = false
|
isAuthorizing.value = false
|
||||||
}
|
}
|
||||||
@@ -185,8 +88,137 @@ onMounted(() => {
|
|||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: "auth"
|
middleware: "auth"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const apiBase = useSolarNetworkUrl()
|
||||||
|
const clientAvatar = computed(() =>
|
||||||
|
clientInfo.value?.picture
|
||||||
|
? `${apiBase}/drive/files/${clientInfo.value.picture.id}`
|
||||||
|
: undefined
|
||||||
|
)
|
||||||
|
const clientBackground = computed(() =>
|
||||||
|
clientInfo.value?.background
|
||||||
|
? `${apiBase}/drive/files/${clientInfo.value.background.id}?original=true`
|
||||||
|
: undefined
|
||||||
|
)
|
||||||
|
|
||||||
|
const pageStyle = computed(() => {
|
||||||
|
if (!clientBackground.value) return {}
|
||||||
|
return {
|
||||||
|
backgroundImage: `linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url('${clientBackground.value}')`,
|
||||||
|
backgroundSize: "cover",
|
||||||
|
backgroundPosition: "center",
|
||||||
|
backgroundRepeat: "no-repeat"
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<template>
|
||||||
/* Add any custom styles here */
|
<div class="fixed inset-0 transition-all duration-500" :style="pageStyle" />
|
||||||
</style>
|
<div class="relative flex items-center justify-center min-h-layout px-4">
|
||||||
|
<n-card
|
||||||
|
:class="[
|
||||||
|
'w-full',
|
||||||
|
'max-w-[1000px]',
|
||||||
|
{ 'backdrop-blur-2xl': clientBackground },
|
||||||
|
{ 'shadow-xl': clientBackground }
|
||||||
|
]"
|
||||||
|
size="large"
|
||||||
|
:style="
|
||||||
|
clientBackground ? 'background-color: rgba(255, 255, 255, 0.1)' : ''
|
||||||
|
"
|
||||||
|
:content-style="clientBackground ? 'background-color: transparent' : ''"
|
||||||
|
>
|
||||||
|
<div v-if="isLoading" class="flex justify-center p-8">
|
||||||
|
<n-spin size="large" />
|
||||||
|
</div>
|
||||||
|
<div v-else class="p-4 md:p-8">
|
||||||
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
|
||||||
|
<!-- Left Column: Title -->
|
||||||
|
<div class="flex flex-col items-start justify-start">
|
||||||
|
<div class="mb-4">
|
||||||
|
<img :src="IconLight" alt="CloudyLamb" height="60" width="60" />
|
||||||
|
</div>
|
||||||
|
<div class="text-left h-auto">
|
||||||
|
<h2 class="text-2xl font-bold mb-1">Authorize Application</h2>
|
||||||
|
<p class="text-lg">Grant access to your Solar Network account</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Right Column: Content -->
|
||||||
|
<div class="flex flex-col items-end justify-stretch">
|
||||||
|
<div class="w-full flex flex-col md:text-right">
|
||||||
|
<div class="mb-3 h-[60px] px-[4px] pt-[8px]">
|
||||||
|
<n-avatar :src="clientAvatar" :size="52">
|
||||||
|
<n-icon :component="PlugIcon" :size="28" />
|
||||||
|
</n-avatar>
|
||||||
|
</div>
|
||||||
|
<!-- App Info Section -->
|
||||||
|
<div v-if="clientInfo" class="mb-6">
|
||||||
|
<div class="flex flex-col items-end mb-4">
|
||||||
|
<h3 class="text-xl font-semibold">
|
||||||
|
{{ clientInfo.clientName || "Unknown Application" }}
|
||||||
|
</h3>
|
||||||
|
<p class="text-base">
|
||||||
|
{{
|
||||||
|
isNewApp
|
||||||
|
? "wants to access your Solar Network account"
|
||||||
|
: "wants to access your account"
|
||||||
|
}}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Requested Permissions -->
|
||||||
|
<n-card embedded class="mb-4 text-left">
|
||||||
|
<h4 class="font-medium mb-2">
|
||||||
|
This will allow
|
||||||
|
{{ clientInfo.clientName || "the app" }} to
|
||||||
|
</h4>
|
||||||
|
<n-list style="background-color: transparent" size="small">
|
||||||
|
<n-list-item
|
||||||
|
v-for="scope in requestedScopes"
|
||||||
|
:key="scope"
|
||||||
|
class="bg-transparent"
|
||||||
|
style="padding: 0"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<n-icon
|
||||||
|
class="mt-1 mr-2"
|
||||||
|
color="#18a058"
|
||||||
|
:size="16"
|
||||||
|
:component="CheckIcon"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<span>{{ scope }}</span>
|
||||||
|
</n-list-item>
|
||||||
|
</n-list>
|
||||||
|
</n-card>
|
||||||
|
|
||||||
|
<!-- Buttons -->
|
||||||
|
<div class="flex gap-3 mt-4">
|
||||||
|
<n-button
|
||||||
|
type="primary"
|
||||||
|
:loading="isAuthorizing"
|
||||||
|
class="grow"
|
||||||
|
size="large"
|
||||||
|
@click="handleAuthorize(true)"
|
||||||
|
>
|
||||||
|
Authorize
|
||||||
|
</n-button>
|
||||||
|
<n-button
|
||||||
|
secondary
|
||||||
|
:disabled="isAuthorizing"
|
||||||
|
class="grow"
|
||||||
|
size="large"
|
||||||
|
@click="handleDeny"
|
||||||
|
>
|
||||||
|
Deny
|
||||||
|
</n-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</n-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="d-flex align-center justify-center fill-height">
|
<div class="flex items-center justify-center h-compact-layout">
|
||||||
<v-card class="pa-6 text-center" max-width="400">
|
<n-result
|
||||||
<v-card-text>
|
status="info"
|
||||||
<v-progress-circular indeterminate color="primary" class="mb-4" />
|
title="Almost There"
|
||||||
<h2 class="text-xl font-bold">Redirecting...</h2>
|
description="Please wait while we redirect you, it won't take too long..."
|
||||||
<p class="opacity-80">Please wait while we redirect you.</p>
|
>
|
||||||
</v-card-text>
|
<template #icon>
|
||||||
</v-card>
|
<span class="loading loading-spinner loading-xl"></span>
|
||||||
|
</template>
|
||||||
|
</n-result>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="d-flex align-center justify-center fill-height">
|
<div class="flex items-center justify-center h-compact-layout">
|
||||||
<v-card class="pa-6 text-center" max-width="400">
|
<n-result
|
||||||
<v-card-text>
|
status="success"
|
||||||
<v-icon size="64" color="success" class="mb-4">mdi-check-circle</v-icon>
|
title="Auth Completed"
|
||||||
<h2 class="text-xl font-bold">Auth completed</h2>
|
description="Now you can close this tab safely."
|
||||||
<p class="opacity-80">Now you can close this tab</p>
|
></n-result>
|
||||||
</v-card-text>
|
|
||||||
</v-card>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +1,27 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="d-flex align-center justify-center fill-height">
|
<div class="flex flex-col items-center justify-center h-compact-layout">
|
||||||
<v-card
|
<div class="mb-4">
|
||||||
class="pa-6 text-center"
|
<client-only>
|
||||||
max-width="600"
|
<captcha-widget @verified="onCaptchaVerified" />
|
||||||
title="Captcha Verification"
|
</client-only>
|
||||||
>
|
</div>
|
||||||
<v-card-text>
|
<div class="text-center">
|
||||||
<div class="mb-8 mt-4">
|
<div class="text-sm font-bold">Solar Network Anti-Robot</div>
|
||||||
<client-only>
|
<p class="opacity-80 text-sm mb-2">
|
||||||
<captcha-widget @verified="onCaptchaVerified" />
|
You might need to wait a while before the puzzle fully loaded.
|
||||||
</client-only>
|
</p>
|
||||||
</div>
|
<div class="opacity-80 text-xs">
|
||||||
<div>
|
Hosted by
|
||||||
<div class="text-sm font-bold mb-1">Solar Network Anti-Robot</div>
|
<a
|
||||||
<div class="opacity-80 text-xs">
|
href="https://github.com/Solsynth/DysonNetwork"
|
||||||
Hosted by
|
class="text-primary"
|
||||||
<a
|
target="_blank"
|
||||||
href="https://github.com/Solsynth/DysonNetwork"
|
rel="noopener noreferrer"
|
||||||
class="text-primary"
|
>
|
||||||
target="_blank"
|
DysonNetwork.Sphere
|
||||||
rel="noopener noreferrer"
|
</a>
|
||||||
>
|
</div>
|
||||||
DysonNetwork.Sphere
|
</div>
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</v-card-text>
|
|
||||||
</v-card>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -1,146 +1,191 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-container class="d-flex align-center justify-center fill-height">
|
<div class="flex items-center justify-center h-layout px-4">
|
||||||
<v-card max-width="1000" rounded="lg" width="100%">
|
<n-card class="w-full max-w-[1000px]" size="large">
|
||||||
<div v-if="isLoading" class="d-flex justify-center mb-4">
|
<div class="p-4 md:p-8">
|
||||||
<v-progress-linear indeterminate color="primary" height="4" />
|
|
||||||
</div>
|
|
||||||
<div class="pa-8">
|
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<img :src="IconLight" alt="CloudyLamb" height="60" width="60" />
|
<img :src="IconLight" alt="CloudyLamb" height="60" width="60" />
|
||||||
</div>
|
</div>
|
||||||
<v-row>
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
|
||||||
<v-col cols="12" lg="6" class="d-flex align-start justify-start">
|
<div class="flex flex-col items-start justify-between">
|
||||||
<div class="md:text-left h-auto">
|
<div class="text-left h-auto">
|
||||||
<div v-if="stage === 'username-nick'">
|
<Transition mode="out-in" name="slide-fade">
|
||||||
<h2 class="text-2xl font-bold mb-1">Create your account</h2>
|
<div v-if="stage === 'username-nick'" key="username-nick">
|
||||||
<p class="text-lg">Start with your username and nickname</p>
|
<h2 class="text-2xl font-bold mb-1">Create your account</h2>
|
||||||
</div>
|
<p class="text-lg">Start with your username and nickname</p>
|
||||||
<div v-if="stage === 'email'">
|
</div>
|
||||||
<h2 class="text-2xl font-bold mb-1">Add your email</h2>
|
<div v-else-if="stage === 'email'" key="email">
|
||||||
<p class="text-lg">We'll use this for account verification</p>
|
<h2 class="text-2xl font-bold mb-1">Add your email</h2>
|
||||||
</div>
|
<p class="text-lg">We'll use this for account verification</p>
|
||||||
<div v-if="stage === 'password'">
|
</div>
|
||||||
<h2 class="text-2xl font-bold mb-1">Set your password</h2>
|
<div v-else-if="stage === 'password'" key="password">
|
||||||
<p class="text-lg">Choose a strong password for your account</p>
|
<h2 class="text-2xl font-bold mb-1">Set your password</h2>
|
||||||
</div>
|
<p class="text-lg">
|
||||||
<div v-if="stage === 'captcha'">
|
Choose a strong password for your account
|
||||||
<h2 class="text-2xl font-bold mb-1">Verify you're human</h2>
|
</p>
|
||||||
<p class="text-lg">
|
</div>
|
||||||
Complete the captcha to create your account
|
<div v-else-if="stage === 'captcha'" key="captcha">
|
||||||
</p>
|
<h2 class="text-2xl font-bold mb-1">Verify you're human</h2>
|
||||||
</div>
|
<p class="text-lg">
|
||||||
|
Complete the captcha to create your account
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="stage === 'terms'" key="terms">
|
||||||
|
<h2 class="text-2xl font-bold mb-1">Review Terms</h2>
|
||||||
|
<p class="text-lg">
|
||||||
|
Please review our terms and conditions before creating your
|
||||||
|
account.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</Transition>
|
||||||
</div>
|
</div>
|
||||||
</v-col>
|
<div v-if="isLoading" class="mb-4">
|
||||||
<v-col cols="12" lg="6" class="d-flex align-center justify-stretch">
|
<span class="loading loading-spinner loading-xl"></span>
|
||||||
<div class="w-full d-flex flex-column md:text-right">
|
</div>
|
||||||
<v-window
|
</div>
|
||||||
v-model="activeStageIndex"
|
<div class="flex items-center justify-stretch">
|
||||||
class="align-self-stretch pt-2"
|
<div class="w-full flex flex-col md:text-right">
|
||||||
|
<n-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formModel"
|
||||||
|
:rules="rules"
|
||||||
|
label-placement="top"
|
||||||
|
class="w-full"
|
||||||
>
|
>
|
||||||
<!-- Stage 1: Username and Nickname -->
|
<!-- Stage 1: Username and Nickname -->
|
||||||
<v-window-item :value="0">
|
<Transition mode="out-in" name="slide-fade">
|
||||||
<v-text-field
|
<div v-if="stage === 'username-nick'" key="username-nick">
|
||||||
v-model="formModel.name"
|
<n-form-item label="Username" path="name">
|
||||||
label="Username"
|
<n-input
|
||||||
variant="outlined"
|
size="large"
|
||||||
:rules="nameRules"
|
v-model:value="formModel.name"
|
||||||
class="mb-2"
|
placeholder="Username"
|
||||||
@keydown.enter="handleNext"
|
class="text-left"
|
||||||
/>
|
@keydown.enter.prevent="handleNext"
|
||||||
<v-text-field
|
/>
|
||||||
v-model="formModel.nick"
|
</n-form-item>
|
||||||
label="Nickname"
|
<n-form-item label="Nickname" path="nick">
|
||||||
variant="outlined"
|
<n-input
|
||||||
:rules="nickRules"
|
size="large"
|
||||||
class="mb-2"
|
v-model:value="formModel.nick"
|
||||||
@keydown.enter="handleNext"
|
placeholder="Nickname"
|
||||||
/>
|
class="text-left"
|
||||||
<div class="d-flex justify-space-between align-center mt-6">
|
@keydown.enter.prevent="handleNext"
|
||||||
<v-btn
|
/>
|
||||||
variant="text"
|
</n-form-item>
|
||||||
class="text-capitalize"
|
<div class="flex justify-between items-center mt-6">
|
||||||
to="/auth/login"
|
<n-button text to="/auth/login">Login</n-button>
|
||||||
>
|
<n-button type="primary" size="large" @click="handleNext">
|
||||||
Login
|
Next
|
||||||
</v-btn>
|
</n-button>
|
||||||
<v-btn color="primary" size="large" @click="handleNext">
|
</div>
|
||||||
Next
|
|
||||||
</v-btn>
|
|
||||||
</div>
|
</div>
|
||||||
</v-window-item>
|
|
||||||
|
|
||||||
<!-- Stage 2: Email -->
|
<!-- Stage 2: Email -->
|
||||||
<v-window-item :value="1">
|
<div v-else-if="stage === 'email'" key="email">
|
||||||
<v-text-field
|
<n-form-item label="Email" path="email">
|
||||||
v-model="formModel.email"
|
<n-input
|
||||||
label="Email"
|
v-model:value="formModel.email"
|
||||||
placeholder="your@email.com"
|
placeholder="your@email.com"
|
||||||
variant="outlined"
|
size="large"
|
||||||
:rules="emailRules"
|
class="text-left"
|
||||||
class="mb-2"
|
@keydown.enter.prevent="handleNext"
|
||||||
@keydown.enter="handleNext"
|
/>
|
||||||
/>
|
</n-form-item>
|
||||||
<div class="d-flex justify-space-between align-center mt-6">
|
<div class="flex justify-between items-center mt-6">
|
||||||
<v-spacer />
|
<div />
|
||||||
<v-btn color="primary" size="large" @click="handleNext">
|
<n-button type="primary" size="large" @click="handleNext">
|
||||||
Next
|
Next
|
||||||
</v-btn>
|
</n-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</v-window-item>
|
|
||||||
|
|
||||||
<!-- Stage 3: Password -->
|
<!-- Stage 3: Password -->
|
||||||
<v-window-item :value="2">
|
<div v-else-if="stage === 'password'" key="password">
|
||||||
<v-text-field
|
<n-form-item label="Password" path="password">
|
||||||
v-model="formModel.password"
|
<n-input
|
||||||
label="Password"
|
v-model:value="formModel.password"
|
||||||
type="password"
|
type="password"
|
||||||
placeholder="Enter your password"
|
show-password-on="click"
|
||||||
variant="outlined"
|
placeholder="Enter your password"
|
||||||
:rules="passwordRules"
|
class="text-left"
|
||||||
class="mb-2"
|
size="large"
|
||||||
@keydown.enter="handleNext"
|
@keydown.enter.prevent="handleNext"
|
||||||
/>
|
/>
|
||||||
<div class="d-flex justify-space-between align-center mt-6">
|
</n-form-item>
|
||||||
<v-spacer />
|
<div class="flex justify-between items-center mt-6">
|
||||||
<v-btn color="primary" size="large" @click="handleNext">
|
<div />
|
||||||
Next
|
<n-button type="primary" size="large" @click="handleNext">
|
||||||
</v-btn>
|
Next
|
||||||
|
</n-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</v-window-item>
|
|
||||||
|
|
||||||
<!-- Stage 4: Captcha -->
|
<!-- Stage 4: Captcha -->
|
||||||
<v-window-item :value="3">
|
<div v-else-if="stage === 'captcha'" key="captcha">
|
||||||
<div class="d-flex justify-center mb-4">
|
<div class="flex justify-center mb-4">
|
||||||
<client-only>
|
<client-only>
|
||||||
<captcha-widget @verified="onCaptchaVerified" />
|
<captcha-widget @verified="onCaptchaVerified" />
|
||||||
</client-only>
|
</client-only>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</v-window-item>
|
|
||||||
</v-window>
|
|
||||||
|
|
||||||
<v-alert
|
<!-- Stage 5: Terms -->
|
||||||
v-if="error"
|
<div v-else-if="stage === 'terms'" key="terms">
|
||||||
type="error"
|
<n-alert type="info" title="Things you need to know">
|
||||||
closable
|
<ul class="list-decimal flex flex-col gap-1">
|
||||||
class="mt-2"
|
<li>
|
||||||
@update:model-value="error = null"
|
You can't have multiple accounts on the Solar Network,
|
||||||
>
|
that violates our Terms of Service.
|
||||||
{{ error }}
|
</li>
|
||||||
</v-alert>
|
<li>
|
||||||
|
You need go to your email to confirm your
|
||||||
|
registeration before you have permissions to do
|
||||||
|
something.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Feel free to contact our customer service at
|
||||||
|
<address>lily@solsynth.dev</address>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Make sure you agreed to our Terms and Service,
|
||||||
|
<nuxt-link
|
||||||
|
class="underline font-bold"
|
||||||
|
href="https://solsynth.dev/terms"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
check it out
|
||||||
|
</nuxt-link>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</n-alert>
|
||||||
|
|
||||||
|
<div class="flex justify-between items-center mt-6">
|
||||||
|
<n-button text @click="stage = 'captcha'">Back</n-button>
|
||||||
|
<n-button
|
||||||
|
type="primary"
|
||||||
|
size="large"
|
||||||
|
@click="handleCreateAccount"
|
||||||
|
>
|
||||||
|
Create Account
|
||||||
|
</n-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Transition>
|
||||||
|
</n-form>
|
||||||
</div>
|
</div>
|
||||||
</v-col>
|
</div>
|
||||||
</v-row>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</v-card>
|
</n-card>
|
||||||
<footer-compact />
|
</div>
|
||||||
</v-container>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, computed } from "vue"
|
import { ref, reactive, onMounted } from "vue"
|
||||||
import { useRouter } from "vue-router"
|
import { useRouter } from "vue-router"
|
||||||
import { useSolarNetwork } from "~/composables/useSolarNetwork"
|
import { useSolarNetwork } from "~/composables/useSolarNetwork"
|
||||||
import CaptchaWidget from "~/components/CaptchaWidget.vue"
|
import CaptchaWidget from "~/components/CaptchaWidget.vue"
|
||||||
|
import type { FormInst, FormRules } from "naive-ui"
|
||||||
|
|
||||||
import IconLight from "~/assets/images/cloudy-lamb.png"
|
import IconLight from "~/assets/images/cloudy-lamb.png"
|
||||||
|
|
||||||
@@ -151,27 +196,11 @@ useHead({
|
|||||||
title: "Create Account"
|
title: "Create Account"
|
||||||
})
|
})
|
||||||
|
|
||||||
const stage = ref<"username-nick" | "email" | "password" | "captcha">(
|
const stage = ref<"username-nick" | "email" | "password" | "captcha" | "terms">(
|
||||||
"username-nick"
|
"username-nick"
|
||||||
)
|
)
|
||||||
const isLoading = ref(false)
|
const isLoading = ref(false)
|
||||||
const error = ref<string | null>(null)
|
const formRef = ref<FormInst | null>(null)
|
||||||
|
|
||||||
// Computed for v-window active index
|
|
||||||
const activeStageIndex = computed(() => {
|
|
||||||
switch (stage.value) {
|
|
||||||
case "username-nick":
|
|
||||||
return 0
|
|
||||||
case "email":
|
|
||||||
return 1
|
|
||||||
case "password":
|
|
||||||
return 2
|
|
||||||
case "captcha":
|
|
||||||
return 3
|
|
||||||
default:
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const formModel = reactive({
|
const formModel = reactive({
|
||||||
name: "",
|
name: "",
|
||||||
@@ -186,105 +215,150 @@ onMounted(() => {
|
|||||||
formModel.language = navigator.language
|
formModel.language = navigator.language
|
||||||
})
|
})
|
||||||
|
|
||||||
const nameRules = [
|
const message = useMessage()
|
||||||
(v: string) => !!v || "Name is required",
|
const dialog = useDialog()
|
||||||
(v: string) => v.length >= 2 || "Name must be at least 2 characters long",
|
|
||||||
(v: string) => v.length <= 256 || "Name must be at most 256 characters long",
|
|
||||||
(v: string) =>
|
|
||||||
/^[A-Za-z0-9_-]+$/.test(v) ||
|
|
||||||
"Name can only contain letters, numbers, underscores, and hyphens."
|
|
||||||
]
|
|
||||||
|
|
||||||
const nickRules = [
|
const rules: FormRules = {
|
||||||
(v: string) => !!v || "Nick is required",
|
name: [
|
||||||
(v: string) => v.length <= 256 || "Nick must be at most 256 characters long"
|
{
|
||||||
]
|
key: "name",
|
||||||
|
required: true,
|
||||||
const emailRules = [
|
message: "Name is required",
|
||||||
(v: string) => !!v || "Email is required",
|
trigger: ["input", "blur"]
|
||||||
(v: string) =>
|
},
|
||||||
v.length <= 1024 || "Email must be at most 1024 characters long",
|
{
|
||||||
(v: string) =>
|
key: "name",
|
||||||
/^[^+]+@[^@]+\.[^@]+$/.test(v) ||
|
min: 2,
|
||||||
"Email address cannot contain '+' symbol.",
|
message: "Name must be at least 2 characters long",
|
||||||
(v: string) => /.+@.+\..+/.test(v) || "Please enter a valid email address"
|
trigger: ["input", "blur"]
|
||||||
]
|
},
|
||||||
|
{
|
||||||
const passwordRules = [
|
key: "name",
|
||||||
(v: string) => !!v || "Password is required",
|
max: 256,
|
||||||
(v: string) => v.length >= 4 || "Password must be at least 4 characters long",
|
message: "Name must be at most 256 characters long",
|
||||||
(v: string) =>
|
trigger: ["input", "blur"]
|
||||||
v.length <= 128 || "Password must be at most 128 characters long"
|
},
|
||||||
]
|
{
|
||||||
|
key: "name",
|
||||||
|
pattern: /^[A-Za-z0-9_-]+$/,
|
||||||
|
message:
|
||||||
|
"Name can only contain letters, numbers, underscores, and hyphens.",
|
||||||
|
trigger: ["input", "blur"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
nick: [
|
||||||
|
{
|
||||||
|
key: "nick",
|
||||||
|
required: true,
|
||||||
|
message: "Nick is required",
|
||||||
|
trigger: ["input", "blur"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "nick",
|
||||||
|
max: 256,
|
||||||
|
message: "Nick must be at most 256 characters long",
|
||||||
|
trigger: ["input", "blur"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
email: [
|
||||||
|
{
|
||||||
|
key: "email",
|
||||||
|
required: true,
|
||||||
|
message: "Email is required",
|
||||||
|
trigger: ["input", "blur"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "email",
|
||||||
|
max: 1024,
|
||||||
|
message: "Email must be at most 1024 characters long",
|
||||||
|
trigger: ["input", "blur"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "email",
|
||||||
|
validator: (_rule, value: string) => {
|
||||||
|
if (value.includes("+")) {
|
||||||
|
return new Error("Email address cannot contain '+' symbol.")
|
||||||
|
}
|
||||||
|
if (!/.+@.+\..+/.test(value)) {
|
||||||
|
return new Error("Please enter a valid email address")
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
trigger: ["input", "blur"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
password: [
|
||||||
|
{
|
||||||
|
key: "password",
|
||||||
|
required: true,
|
||||||
|
message: "Password is required",
|
||||||
|
trigger: ["input", "blur"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "password",
|
||||||
|
min: 4,
|
||||||
|
message: "Password must be at least 4 characters long",
|
||||||
|
trigger: ["input", "blur"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "password",
|
||||||
|
max: 128,
|
||||||
|
message: "Password must be at most 128 characters long",
|
||||||
|
trigger: ["input", "blur"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
const onCaptchaVerified = (token: string) => {
|
const onCaptchaVerified = (token: string) => {
|
||||||
formModel.captchaToken = token
|
formModel.captchaToken = token
|
||||||
handleCreateAccount()
|
stage.value = "terms"
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleNext() {
|
async function handleNext() {
|
||||||
error.value = null
|
if (!formRef.value) return
|
||||||
if (stage.value === "username-nick") {
|
|
||||||
if (!formModel.name || !formModel.nick) {
|
try {
|
||||||
error.value = "Please fill in username and nickname"
|
if (stage.value === "username-nick") {
|
||||||
return
|
await new Promise<void>((resolve, reject) => {
|
||||||
|
formRef.value?.validate(
|
||||||
|
(errors) => {
|
||||||
|
if (errors) reject(new Error("Validation failed"))
|
||||||
|
else resolve()
|
||||||
|
},
|
||||||
|
(rule) => rule.key === "name" || rule.key === "nick"
|
||||||
|
)
|
||||||
|
})
|
||||||
|
stage.value = "email"
|
||||||
|
} else if (stage.value === "email") {
|
||||||
|
await new Promise<void>((resolve, reject) => {
|
||||||
|
formRef.value?.validate(
|
||||||
|
(errors) => {
|
||||||
|
if (errors) reject(new Error("Validation failed"))
|
||||||
|
else resolve()
|
||||||
|
},
|
||||||
|
(rule) => rule.key === "email"
|
||||||
|
)
|
||||||
|
})
|
||||||
|
stage.value = "password"
|
||||||
|
} else if (stage.value === "password") {
|
||||||
|
await new Promise<void>((resolve, reject) => {
|
||||||
|
formRef.value?.validate(
|
||||||
|
(errors) => {
|
||||||
|
if (errors) reject(new Error("Validation failed"))
|
||||||
|
else resolve()
|
||||||
|
},
|
||||||
|
(rule) => rule.key === "password"
|
||||||
|
)
|
||||||
|
})
|
||||||
|
stage.value = "captcha"
|
||||||
}
|
}
|
||||||
if (
|
} catch {
|
||||||
!nameRules.every(
|
// Validation error, do nothing
|
||||||
(rule) =>
|
|
||||||
typeof rule(formModel.name) === "boolean" && rule(formModel.name)
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
error.value = "Invalid username"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
!nickRules.every(
|
|
||||||
(rule) =>
|
|
||||||
typeof rule(formModel.nick) === "boolean" && rule(formModel.nick)
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
error.value = "Invalid nickname"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
stage.value = "email"
|
|
||||||
} else if (stage.value === "email") {
|
|
||||||
if (!formModel.email) {
|
|
||||||
error.value = "Please enter your email"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
!emailRules.every(
|
|
||||||
(rule) =>
|
|
||||||
typeof rule(formModel.email) === "boolean" && rule(formModel.email)
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
error.value = "Invalid email"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
stage.value = "password"
|
|
||||||
} else if (stage.value === "password") {
|
|
||||||
if (!formModel.password) {
|
|
||||||
error.value = "Please enter your password"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
!passwordRules.every(
|
|
||||||
(rule) =>
|
|
||||||
typeof rule(formModel.password) === "boolean" &&
|
|
||||||
rule(formModel.password)
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
error.value = "Invalid password"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
stage.value = "captcha"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleCreateAccount() {
|
async function handleCreateAccount() {
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
error.value = null
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await api("/id/accounts", {
|
await api("/id/accounts", {
|
||||||
@@ -300,14 +374,35 @@ async function handleCreateAccount() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// On success, redirect to login page
|
// On success, redirect to login page
|
||||||
alert(
|
dialog.success({
|
||||||
"Welcome to Solar Network! Your account has been created successfully. Don't forget to check your email for activation instructions."
|
title: "Registration Completed",
|
||||||
)
|
content:
|
||||||
router.push("/auth/login")
|
"Welcome to Solar Network! Your account has been created successfully. Don't forget to check your email for activation instructions.",
|
||||||
|
onPositiveClick: () => {
|
||||||
|
router.push("/auth/login")
|
||||||
|
}
|
||||||
|
})
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
error.value = e instanceof Error ? e.message : "An error occurred"
|
message.error(e instanceof Error ? e.message : "An error occurred")
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.slide-fade-enter-active,
|
||||||
|
.slide-fade-leave-active {
|
||||||
|
transition: all 0.2s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slide-fade-enter-from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.slide-fade-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(-10px);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import { useRoute, useRouter } from "vue-router"
|
|||||||
import { useUserStore } from "~/stores/user"
|
import { useUserStore } from "~/stores/user"
|
||||||
import { useSolarNetwork } from "~/composables/useSolarNetwork"
|
import { useSolarNetwork } from "~/composables/useSolarNetwork"
|
||||||
import type { SnAuthChallenge, SnAuthFactor } from "~/types/api"
|
import type { SnAuthChallenge, SnAuthFactor } from "~/types/api"
|
||||||
|
import { useMessage } from "naive-ui"
|
||||||
|
|
||||||
import FingerprintJS from "@fingerprintjs/fingerprintjs"
|
import FingerprintJS from "@fingerprintjs/fingerprintjs"
|
||||||
|
|
||||||
import IconLight from "~/assets/images/cloudy-lamb.png"
|
import IconLight from "~/assets/images/cloudy-lamb.png"
|
||||||
import IconDark from "~/assets/images/cloudy-lamb@dark.png"
|
|
||||||
|
|
||||||
// State management
|
// State management
|
||||||
useHead({
|
useHead({
|
||||||
@@ -19,23 +19,7 @@ const stage = ref<
|
|||||||
"find-account" | "select-factor" | "enter-code" | "token-exchange"
|
"find-account" | "select-factor" | "enter-code" | "token-exchange"
|
||||||
>("find-account")
|
>("find-account")
|
||||||
const isLoading = ref(false)
|
const isLoading = ref(false)
|
||||||
const error = ref<string | null>(null)
|
const message = useMessage()
|
||||||
|
|
||||||
// Computed for v-window active index
|
|
||||||
const activeStageIndex = computed(() => {
|
|
||||||
switch (stage.value) {
|
|
||||||
case "find-account":
|
|
||||||
return 0
|
|
||||||
case "select-factor":
|
|
||||||
return 1
|
|
||||||
case "enter-code":
|
|
||||||
return 2
|
|
||||||
case "token-exchange":
|
|
||||||
return 3
|
|
||||||
default:
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Stage 1: Find Account
|
// Stage 1: Find Account
|
||||||
const accountIdentifier = ref("")
|
const accountIdentifier = ref("")
|
||||||
@@ -64,11 +48,10 @@ const selectedFactor = computed(() => {
|
|||||||
|
|
||||||
async function handleFindAccount() {
|
async function handleFindAccount() {
|
||||||
if (!accountIdentifier.value) {
|
if (!accountIdentifier.value) {
|
||||||
error.value = "Please enter your email or username."
|
message.error("Please enter your email or username.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
error.value = null
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
challenge.value = await api("/id/auth/challenge", {
|
challenge.value = await api("/id/auth/challenge", {
|
||||||
@@ -83,7 +66,7 @@ async function handleFindAccount() {
|
|||||||
await getFactors()
|
await getFactors()
|
||||||
stage.value = "select-factor"
|
stage.value = "select-factor"
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
error.value = e instanceof Error ? e.message : "An error occurred"
|
message.error(e instanceof Error ? e.message : "An error occurred")
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
}
|
}
|
||||||
@@ -93,7 +76,6 @@ async function getFactors() {
|
|||||||
if (!challenge.value) return
|
if (!challenge.value) return
|
||||||
|
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
error.value = null
|
|
||||||
try {
|
try {
|
||||||
const availableFactors = await api<SnAuthFactor[]>(
|
const availableFactors = await api<SnAuthFactor[]>(
|
||||||
`/id/auth/challenge/${challenge.value.id}/factors`
|
`/id/auth/challenge/${challenge.value.id}/factors`
|
||||||
@@ -104,11 +86,12 @@ async function getFactors() {
|
|||||||
if (factors.value.length > 0) {
|
if (factors.value.length > 0) {
|
||||||
selectedFactorId.value = null // Let user choose
|
selectedFactorId.value = null // Let user choose
|
||||||
} else if (challenge.value.stepRemain > 0) {
|
} else if (challenge.value.stepRemain > 0) {
|
||||||
error.value =
|
message.error(
|
||||||
"No more available authentication factors, but authentication is not complete. Please contact support."
|
"No more available authentication factors, but authentication is not complete. Please contact support."
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
error.value = e instanceof Error ? e.message : "An error occurred"
|
message.error(e instanceof Error ? e.message : "An error occurred")
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
}
|
}
|
||||||
@@ -119,7 +102,6 @@ async function requestVerificationCode() {
|
|||||||
|
|
||||||
const isResend = stage.value === "enter-code"
|
const isResend = stage.value === "enter-code"
|
||||||
if (isResend) isLoading.value = true
|
if (isResend) isLoading.value = true
|
||||||
error.value = null
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await api(
|
await api(
|
||||||
@@ -127,7 +109,7 @@ async function requestVerificationCode() {
|
|||||||
{ method: "POST" }
|
{ method: "POST" }
|
||||||
)
|
)
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
error.value = e instanceof Error ? e.message : "An error occurred"
|
message.error(e instanceof Error ? e.message : "An error occurred")
|
||||||
throw e // Rethrow to be handled by caller
|
throw e // Rethrow to be handled by caller
|
||||||
} finally {
|
} finally {
|
||||||
if (isResend) isLoading.value = false
|
if (isResend) isLoading.value = false
|
||||||
@@ -136,7 +118,7 @@ async function requestVerificationCode() {
|
|||||||
|
|
||||||
async function handleFactorSelected() {
|
async function handleFactorSelected() {
|
||||||
if (!selectedFactor.value) {
|
if (!selectedFactor.value) {
|
||||||
error.value = "Please select an authentication method."
|
message.error("Please select an authentication method.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +131,6 @@ async function handleFactorSelected() {
|
|||||||
// For code-based factors (1, 2, 3, 4), send the code first
|
// For code-based factors (1, 2, 3, 4), send the code first
|
||||||
if ([1, 2, 3, 4].includes(selectedFactor.value.type)) {
|
if ([1, 2, 3, 4].includes(selectedFactor.value.type)) {
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
error.value = null
|
|
||||||
try {
|
try {
|
||||||
await requestVerificationCode()
|
await requestVerificationCode()
|
||||||
stage.value = "enter-code"
|
stage.value = "enter-code"
|
||||||
@@ -163,11 +144,10 @@ async function handleFactorSelected() {
|
|||||||
|
|
||||||
async function handleVerifyFactor() {
|
async function handleVerifyFactor() {
|
||||||
if (!selectedFactorId.value || !password.value || !challenge.value) {
|
if (!selectedFactorId.value || !password.value || !challenge.value) {
|
||||||
error.value = "Please enter your password/code."
|
message.error("Please enter your password/code.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
error.value = null
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
challenge.value = await api(`/id/auth/challenge/${challenge.value.id}`, {
|
challenge.value = await api(`/id/auth/challenge/${challenge.value.id}`, {
|
||||||
@@ -188,7 +168,7 @@ async function handleVerifyFactor() {
|
|||||||
stage.value = "select-factor" // MFA step
|
stage.value = "select-factor" // MFA step
|
||||||
}
|
}
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
error.value = e instanceof Error ? e.message : "An error occurred"
|
message.error(e instanceof Error ? e.message : "An error occurred")
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
}
|
}
|
||||||
@@ -199,7 +179,6 @@ const route = useRoute()
|
|||||||
|
|
||||||
async function exchangeToken() {
|
async function exchangeToken() {
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
error.value = null
|
|
||||||
try {
|
try {
|
||||||
// The token endpoint gives the Set-Cookie header
|
// The token endpoint gives the Set-Cookie header
|
||||||
await api<{ token: string }>("/id/auth/token", {
|
await api<{ token: string }>("/id/auth/token", {
|
||||||
@@ -212,14 +191,14 @@ async function exchangeToken() {
|
|||||||
|
|
||||||
await userStore.fetchUser()
|
await userStore.fetchUser()
|
||||||
|
|
||||||
const redirectUri = route.query.redirect_uri as string
|
const redirectUri = route.query.redirect as string
|
||||||
if (redirectUri) {
|
if (redirectUri) {
|
||||||
window.location.href = redirectUri
|
window.location.href = decodeURIComponent(redirectUri)
|
||||||
} else {
|
} else {
|
||||||
await router.push("/")
|
await router.push("/")
|
||||||
}
|
}
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
error.value = e instanceof Error ? e.message : "An error occurred"
|
message.error(e instanceof Error ? e.message : "An error occurred")
|
||||||
stage.value = "select-factor" // Go back if token exchange fails
|
stage.value = "select-factor" // Go back if token exchange fails
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
@@ -242,209 +221,250 @@ function getFactorName(factorType: number) {
|
|||||||
return "Unknown Factor"
|
return "Unknown Factor"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getFactorIcon(factorType: number) {
|
||||||
|
switch (factorType) {
|
||||||
|
case 0:
|
||||||
|
return "mdi mdi-lock"
|
||||||
|
case 1:
|
||||||
|
return "mdi mdi-email"
|
||||||
|
case 2:
|
||||||
|
return "mdi mdi-cellphone"
|
||||||
|
case 3:
|
||||||
|
return "mdi mdi-clock"
|
||||||
|
case 4:
|
||||||
|
return "mdi mdi-numeric"
|
||||||
|
default:
|
||||||
|
return "mdi mdi-shield-key"
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.slide-fade-enter-active,
|
||||||
|
.slide-fade-leave-active {
|
||||||
|
transition: all 0.2s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slide-fade-enter-from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.slide-fade-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(-10px);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<v-container class="d-flex align-center justify-center fill-height">
|
<div class="flex flex-col gap-3 items-center justify-center h-layout px-4">
|
||||||
<v-card max-width="1000" rounded="lg" width="100%">
|
<n-card class="w-full max-w-[1000px]" size="large">
|
||||||
<div v-if="isLoading" class="d-flex justify-center mb-4">
|
<div class="p-4 md:p-8">
|
||||||
<v-progress-linear indeterminate color="primary" height="4" />
|
|
||||||
</div>
|
|
||||||
<div class="pa-8">
|
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<img :src="IconLight" alt="CloudyLamb" height="60" width="60" />
|
<img :src="IconLight" alt="CloudyLamb" height="60" width="60" />
|
||||||
</div>
|
</div>
|
||||||
<v-row>
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
|
||||||
<v-col cols="12" lg="6" class="d-flex align-start justify-start">
|
<div class="flex flex-col items-start justify-between">
|
||||||
<div class="md:text-left h-auto">
|
<div class="text-left h-auto">
|
||||||
<div v-if="stage === 'find-account'">
|
<div class="text-left h-auto">
|
||||||
<h2 class="text-2xl font-bold mb-1">Sign in</h2>
|
<Transition mode="out-in" name="slide-fade">
|
||||||
<p class="text-lg">Use your Solarpass</p>
|
<div v-if="stage === 'find-account'" key="find-account">
|
||||||
</div>
|
<h2 class="text-2xl font-bold mb-1">Sign in</h2>
|
||||||
<div v-if="stage === 'select-factor'">
|
<p class="text-lg">Use your Solarpass</p>
|
||||||
<h2 class="text-2xl font-bold mb-1">Choose how to sign in</h2>
|
</div>
|
||||||
<p class="text-lg">
|
<div
|
||||||
Select your preferred authentication method
|
v-else-if="stage === 'select-factor'"
|
||||||
</p>
|
key="select-factor"
|
||||||
</div>
|
|
||||||
<div v-if="stage === 'enter-code' && selectedFactor">
|
|
||||||
<h2 class="text-2xl font-bold mb-1">
|
|
||||||
Enter your
|
|
||||||
{{
|
|
||||||
selectedFactor.type === 0 ? "password" : "verification code"
|
|
||||||
}}
|
|
||||||
</h2>
|
|
||||||
<p v-if="selectedFactor.type === 1" class="text-lg">
|
|
||||||
A code has been sent to
|
|
||||||
{{ selectedFactor.contact || "your email" }}.
|
|
||||||
</p>
|
|
||||||
<p v-if="selectedFactor.type === 2" class="text-lg">
|
|
||||||
Enter the code from your in-app authenticator.
|
|
||||||
</p>
|
|
||||||
<p v-if="selectedFactor.type === 3" class="text-lg">
|
|
||||||
Enter the timed verification code.
|
|
||||||
</p>
|
|
||||||
<p v-if="selectedFactor.type === 4" class="text-lg">
|
|
||||||
Enter your PIN code.
|
|
||||||
</p>
|
|
||||||
<p v-if="selectedFactor.type === 0" class="text-lg">
|
|
||||||
Enter your password to continue.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div v-if="stage === 'token-exchange'">
|
|
||||||
<h2 class="text-2xl font-bold mb-1">Finalizing Login</h2>
|
|
||||||
<p class="text-lg">
|
|
||||||
Please wait while we complete your sign in.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</v-col>
|
|
||||||
<v-col cols="12" lg="6" class="d-flex align-center justify-stretch">
|
|
||||||
<div class="w-full d-flex flex-column md:text-right">
|
|
||||||
<v-window
|
|
||||||
v-model="activeStageIndex"
|
|
||||||
class="align-self-stretch pt-2"
|
|
||||||
>
|
|
||||||
<!-- Stage 1: Find Account -->
|
|
||||||
<v-window-item :value="0">
|
|
||||||
<v-text-field
|
|
||||||
v-model="accountIdentifier"
|
|
||||||
label="Email or username"
|
|
||||||
variant="outlined"
|
|
||||||
class="mb-2"
|
|
||||||
@keydown.enter="handleFindAccount"
|
|
||||||
/>
|
|
||||||
<v-btn
|
|
||||||
slim
|
|
||||||
variant="text"
|
|
||||||
class="text-capitalize"
|
|
||||||
color="primary"
|
|
||||||
>Forgot password?</v-btn
|
|
||||||
>
|
>
|
||||||
|
<h2 class="text-2xl font-bold mb-1">
|
||||||
<div class="d-flex justify-end">
|
Choose how to sign in
|
||||||
<p class="mt-4 mb-6 text-sm max-w-96">
|
</h2>
|
||||||
Not your computer? Remember to use Private Browsing
|
<p class="text-lg">
|
||||||
windows to sign in.
|
Select your preferred authentication method
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
v-else-if="stage === 'enter-code' && selectedFactor"
|
||||||
|
key="enter-code"
|
||||||
|
>
|
||||||
|
<h2 class="text-2xl font-bold mb-1">
|
||||||
|
Enter your
|
||||||
|
{{
|
||||||
|
selectedFactor.type === 0
|
||||||
|
? "password"
|
||||||
|
: "verification code"
|
||||||
|
}}
|
||||||
|
</h2>
|
||||||
|
<p v-if="selectedFactor.type === 1" class="text-lg">
|
||||||
|
A code has been sent to
|
||||||
|
{{ selectedFactor.contact || "your email" }}.
|
||||||
|
</p>
|
||||||
|
<p v-if="selectedFactor.type === 2" class="text-lg">
|
||||||
|
Enter the code from your in-app authenticator.
|
||||||
|
</p>
|
||||||
|
<p v-if="selectedFactor.type === 3" class="text-lg">
|
||||||
|
Enter the timed verification code.
|
||||||
|
</p>
|
||||||
|
<p v-if="selectedFactor.type === 4" class="text-lg">
|
||||||
|
Enter your PIN code.
|
||||||
|
</p>
|
||||||
|
<p v-if="selectedFactor.type === 0" class="text-lg">
|
||||||
|
Enter your password to continue.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-else-if="stage === 'token-exchange'"
|
||||||
|
key="token-exchange"
|
||||||
|
>
|
||||||
|
<h2 class="text-2xl font-bold mb-1">Finalizing Login</h2>
|
||||||
|
<p class="text-lg">
|
||||||
|
Please wait while we complete your sign in.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</Transition>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="isLoading" class="mb-4">
|
||||||
|
<span class="loading loading-spinner loading-xl"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center justify-stretch">
|
||||||
|
<div class="w-full flex flex-col md:text-right">
|
||||||
|
<Transition mode="out-in" name="slide-fade">
|
||||||
|
<!-- Stage 1: Find Account -->
|
||||||
|
<div v-if="stage === 'find-account'" key="find-account">
|
||||||
|
<n-input
|
||||||
|
size="large"
|
||||||
|
v-model:value="accountIdentifier"
|
||||||
|
placeholder="Email or username"
|
||||||
|
class="text-left"
|
||||||
|
@keydown.enter.prevent="handleFindAccount"
|
||||||
|
/>
|
||||||
|
<div class="mr-3 mt-4">
|
||||||
|
<n-button text type="primary" size="small">
|
||||||
|
Forgot Password?
|
||||||
|
</n-button>
|
||||||
|
|
||||||
<div class="d-flex justify-space-between align-center mt-8">
|
<div class="flex justify-end">
|
||||||
<v-btn
|
<p class="mt-4 mb-6 text-sm max-w-96">
|
||||||
variant="text"
|
Not your computer? Remember to use Private Browsing
|
||||||
class="text-capitalize"
|
windows to sign in.
|
||||||
to="/auth/create-account"
|
</p>
|
||||||
>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex justify-between items-center mt-8">
|
||||||
|
<n-button text tag="a" href="/auth/create-account">
|
||||||
Create account
|
Create account
|
||||||
</v-btn>
|
</n-button>
|
||||||
<v-btn
|
<n-button
|
||||||
color="primary"
|
type="primary"
|
||||||
size="large"
|
size="large"
|
||||||
@click="handleFindAccount"
|
@click="handleFindAccount"
|
||||||
>
|
>
|
||||||
Next
|
Next
|
||||||
</v-btn>
|
</n-button>
|
||||||
</div>
|
</div>
|
||||||
</v-window-item>
|
</div>
|
||||||
|
|
||||||
<!-- Stage 2: Select Factor -->
|
<!-- Stage 2: Select Factor -->
|
||||||
<v-window-item :value="1">
|
<div v-else-if="stage === 'select-factor'" key="select-factor">
|
||||||
<v-radio-group v-model="selectedFactorId">
|
<n-radio-group
|
||||||
<v-list>
|
v-model:value="selectedFactorId"
|
||||||
<v-list-item v-for="factor in factors" :key="factor.id">
|
class="w-full"
|
||||||
<v-list-item-action>
|
>
|
||||||
<v-radio
|
<div class="flex flex-col gap-2">
|
||||||
:value="factor.id"
|
<div
|
||||||
:label="getFactorName(factor.type)"
|
v-for="factor in factors"
|
||||||
/>
|
:key="factor.id"
|
||||||
</v-list-item-action>
|
class="flex items-center justify-between p-3 border rounded cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800"
|
||||||
<template #append>
|
@click="selectedFactorId = factor.id"
|
||||||
<v-icon>{{
|
>
|
||||||
factor.type === 0
|
<n-radio
|
||||||
? "mdi-lock"
|
:value="factor.id"
|
||||||
: factor.type === 1
|
:label="getFactorName(factor.type)"
|
||||||
? "mdi-email"
|
/>
|
||||||
: factor.type === 2
|
<n-icon size="24">
|
||||||
? "mdi-cellphone"
|
<span :class="getFactorIcon(factor.type)" />
|
||||||
: factor.type === 3
|
</n-icon>
|
||||||
? "mdi-clock"
|
</div>
|
||||||
: factor.type === 4
|
</div>
|
||||||
? "mdi-numeric"
|
</n-radio-group>
|
||||||
: "mdi-shield-key"
|
<div class="flex justify-end mt-6">
|
||||||
}}</v-icon>
|
<n-button
|
||||||
</template>
|
type="primary"
|
||||||
</v-list-item>
|
|
||||||
</v-list>
|
|
||||||
</v-radio-group>
|
|
||||||
<div class="d-flex justify-end mt-6">
|
|
||||||
<v-btn
|
|
||||||
color="primary"
|
|
||||||
size="large"
|
size="large"
|
||||||
:disabled="!selectedFactorId"
|
:disabled="!selectedFactorId"
|
||||||
@click="handleFactorSelected"
|
@click="handleFactorSelected"
|
||||||
>
|
>
|
||||||
Next
|
Next
|
||||||
</v-btn>
|
</n-button>
|
||||||
</div>
|
</div>
|
||||||
</v-window-item>
|
</div>
|
||||||
|
|
||||||
<!-- Stage 3: Enter Code -->
|
<!-- Stage 3: Enter Code -->
|
||||||
<v-window-item :value="2">
|
<div v-else-if="stage === 'enter-code'" key="enter-code">
|
||||||
<v-text-field
|
<n-input
|
||||||
v-model="password"
|
v-model:value="password"
|
||||||
:type="selectedFactor?.type === 0 ? 'password' : 'text'"
|
:type="selectedFactor?.type === 0 ? 'password' : 'text'"
|
||||||
:label="selectedFactor?.type === 0 ? 'Password' : 'Code'"
|
:placeholder="
|
||||||
variant="outlined"
|
selectedFactor?.type === 0 ? 'Password' : 'Code'
|
||||||
class="mb-2"
|
"
|
||||||
@keydown.enter="handleVerifyFactor"
|
show-password-on="click"
|
||||||
|
class="mb-2 text-left"
|
||||||
|
@keydown.enter.prevent="handleVerifyFactor"
|
||||||
/>
|
/>
|
||||||
<div class="d-flex justify-space-between align-center mt-6">
|
<div class="flex justify-between items-center mt-6">
|
||||||
<v-btn
|
<n-button
|
||||||
v-if="selectedFactor?.type === 1"
|
v-if="selectedFactor?.type === 1"
|
||||||
variant="text"
|
text
|
||||||
class="text-capitalize pl-0"
|
type="primary"
|
||||||
color="primary"
|
|
||||||
@click="requestVerificationCode"
|
@click="requestVerificationCode"
|
||||||
>
|
>
|
||||||
Resend Code
|
Resend Code
|
||||||
</v-btn>
|
</n-button>
|
||||||
<v-spacer v-else />
|
<div v-else />
|
||||||
<v-btn
|
<n-button
|
||||||
color="primary"
|
type="primary"
|
||||||
size="large"
|
size="large"
|
||||||
@click="handleVerifyFactor"
|
@click="handleVerifyFactor"
|
||||||
>
|
>
|
||||||
Verify
|
Verify
|
||||||
</v-btn>
|
</n-button>
|
||||||
</div>
|
</div>
|
||||||
</v-window-item>
|
</div>
|
||||||
|
|
||||||
<!-- Stage 4: Token Exchange -->
|
<!-- Stage 4: Token Exchange -->
|
||||||
<v-window-item :value="3">
|
<div
|
||||||
<div class="d-flex justify-center">
|
v-else-if="stage === 'token-exchange'"
|
||||||
<v-progress-circular
|
key="token-exchange"
|
||||||
indeterminate
|
>
|
||||||
size="64"
|
<div class="flex justify-center">
|
||||||
color="primary"
|
<n-spin size="large" />
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</v-window-item>
|
</div>
|
||||||
</v-window>
|
</Transition>
|
||||||
|
|
||||||
<v-alert
|
|
||||||
v-if="error"
|
|
||||||
type="error"
|
|
||||||
closable
|
|
||||||
class="mt-2"
|
|
||||||
@update:model-value="error = null"
|
|
||||||
>
|
|
||||||
{{ error }}
|
|
||||||
</v-alert>
|
|
||||||
</div>
|
</div>
|
||||||
</v-col>
|
</div>
|
||||||
</v-row>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</v-card>
|
</n-card>
|
||||||
<footer-compact />
|
|
||||||
</v-container>
|
<n-alert
|
||||||
|
v-if="route.query.redirect"
|
||||||
|
class="w-full max-w-[1000px]"
|
||||||
|
type="info"
|
||||||
|
title="Login before you continue"
|
||||||
|
size="large"
|
||||||
|
>
|
||||||
|
<div class="flex flex-col gap-1">
|
||||||
|
<p>
|
||||||
|
You're requesting a page that requires authorization to access, please
|
||||||
|
login with your Solarpass and then we will redirect you to:
|
||||||
|
</p>
|
||||||
|
<n-code class="text-xs">{{ route.query.redirect }}</n-code>
|
||||||
|
</div>
|
||||||
|
</n-alert>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,91 +1,65 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="lightbox-container">
|
<div class="lightbox-container h-compact-layout">
|
||||||
<!-- Top Toolbar -->
|
<!-- Top Toolbar -->
|
||||||
<v-app-bar v-if="fileInfo" class="top-toolbar" flat height="56">
|
<header v-if="fileInfo" class="top-toolbar bg-neutral-900/50 text-white">
|
||||||
<v-container fluid>
|
<div class="container mx-auto px-4 h-full">
|
||||||
<v-row align="center" class="pa-2">
|
<div class="flex items-center h-full">
|
||||||
<v-col cols="12" md="4">
|
<div class="flex items-center gap-2 w-full md:w-1/3">
|
||||||
<div class="d-flex align-center gap-2">
|
<n-tooltip trigger="hover">
|
||||||
<v-tooltip location="bottom" :text="fileInfo.mimeType">
|
<template #trigger>
|
||||||
<template #activator="{ props }">
|
<n-icon :component="fileIcon" />
|
||||||
<v-icon v-bind="props" :icon="fileIcon"></v-icon>
|
</template>
|
||||||
</template>
|
{{ fileInfo.mimeType }}
|
||||||
</v-tooltip>
|
</n-tooltip>
|
||||||
<v-tooltip location="bottom" :text="fileInfo.name || 'File'">
|
<n-tooltip trigger="hover">
|
||||||
<template #activator="{ props }">
|
<template #trigger>
|
||||||
<span class="line-clamp-1" v-bind="props">
|
<span class="line-clamp-1">
|
||||||
{{ fileInfo.name || "File" }}
|
{{ fileInfo.name || "File" }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</v-tooltip>
|
{{ fileInfo.name || "File" }}
|
||||||
<!-- Action buttons on mobile -->
|
</n-tooltip>
|
||||||
<div class="d-flex d-md-none gap-2 ml-auto">
|
<!-- Action buttons on mobile -->
|
||||||
<v-btn
|
<div class="flex md:hidden gap-2 ml-auto">
|
||||||
icon
|
<n-button text style="font-size: 20px" @click="handleDownload">
|
||||||
size="small"
|
<n-icon :component="Download" />
|
||||||
density="compact"
|
</n-button>
|
||||||
@click="handleDownload"
|
<n-button text style="font-size: 20px" @click="infoDialog = true">
|
||||||
>
|
<n-icon :component="Info" />
|
||||||
<v-icon>mdi-download</v-icon>
|
</n-button>
|
||||||
</v-btn>
|
|
||||||
<v-btn
|
|
||||||
icon
|
|
||||||
size="small"
|
|
||||||
density="compact"
|
|
||||||
@click="infoDialog = true"
|
|
||||||
>
|
|
||||||
<v-icon>mdi-information</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</v-col>
|
</div>
|
||||||
<v-col cols="12" md="8" class="d-none d-md-block">
|
<div class="hidden md:flex items-center justify-end gap-4 w-2/3">
|
||||||
<div class="d-flex align-center justify-end gap-4">
|
<span>{{ formatBytes(fileInfo.size) }}</span>
|
||||||
<span>{{ formatBytes(fileInfo.size) }}</span>
|
<span>{{ new Date(fileInfo.createdAt).toLocaleString() }}</span>
|
||||||
<span>{{ new Date(fileInfo.createdAt).toLocaleString() }}</span>
|
<n-button text style="font-size: 20px" @click="handleDownload">
|
||||||
<v-btn
|
<n-icon :component="Download" />
|
||||||
icon
|
</n-button>
|
||||||
size="small"
|
<n-button text style="font-size: 20px" @click="infoDialog = true">
|
||||||
density="compact"
|
<n-icon :component="Info" />
|
||||||
@click="handleDownload"
|
</n-button>
|
||||||
>
|
</div>
|
||||||
<v-icon>mdi-download</v-icon>
|
</div>
|
||||||
</v-btn>
|
</div>
|
||||||
<v-btn
|
</header>
|
||||||
icon
|
|
||||||
size="small"
|
|
||||||
density="compact"
|
|
||||||
@click="infoDialog = true"
|
|
||||||
>
|
|
||||||
<v-icon>mdi-information</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
</div>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</v-container>
|
|
||||||
</v-app-bar>
|
|
||||||
|
|
||||||
<!-- Main Content - File Preview -->
|
<!-- Main Content - File Preview -->
|
||||||
<div class="preview-container">
|
<div class="preview-container">
|
||||||
<v-progress-circular
|
<n-spin v-if="!fileInfo && !error" size="large" />
|
||||||
v-if="!fileInfo && !error"
|
<n-alert
|
||||||
indeterminate
|
|
||||||
size="64"
|
|
||||||
class="loading-spinner"
|
|
||||||
></v-progress-circular>
|
|
||||||
<v-alert
|
|
||||||
v-else-if="error"
|
v-else-if="error"
|
||||||
type="error"
|
type="error"
|
||||||
title="No file was found"
|
title="No file was found"
|
||||||
:text="error"
|
class="max-w-md"
|
||||||
class="error-alert"
|
>
|
||||||
></v-alert>
|
{{ error }}
|
||||||
|
</n-alert>
|
||||||
<div v-else class="preview-content">
|
<div v-else class="preview-content">
|
||||||
<div v-if="fileInfo?.isEncrypted" class="encrypted-notice">
|
<div v-if="fileInfo?.isEncrypted" class="max-w-md">
|
||||||
<v-alert type="info" title="Encrypted file" class="mb-4">
|
<n-alert type="info" title="Encrypted file" class="mb-4">
|
||||||
The file has been encrypted. Preview not available. Please enter the
|
The file has been encrypted. Preview not available. Please enter the
|
||||||
password to download it.
|
password to download it.
|
||||||
</v-alert>
|
</n-alert>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-else
|
v-else
|
||||||
@@ -94,13 +68,22 @@
|
|||||||
@touchstart="handleTouchStart"
|
@touchstart="handleTouchStart"
|
||||||
@touchmove="handleTouchMove"
|
@touchmove="handleTouchMove"
|
||||||
@touchend="handleTouchEnd"
|
@touchend="handleTouchEnd"
|
||||||
|
@mousedown="handleMouseDown"
|
||||||
|
@mousemove="handleMouseMove"
|
||||||
|
@mouseup="handleMouseUp"
|
||||||
|
@mouseleave="handleMouseUp"
|
||||||
@dblclick="handleDoubleClick"
|
@dblclick="handleDoubleClick"
|
||||||
>
|
>
|
||||||
<v-img
|
<img
|
||||||
v-if="fileType === 'image'"
|
v-if="fileType === 'image'"
|
||||||
:src="fileSource"
|
:src="fileSource"
|
||||||
class="preview-image"
|
class="preview-image"
|
||||||
:style="{ transform: `scale(${zoomLevel})` }"
|
:style="{
|
||||||
|
transform: `translate(${translateX}px, ${translateY}px) scale(${zoomLevel})`,
|
||||||
|
cursor:
|
||||||
|
zoomLevel > 1 ? (isDragging ? 'grabbing' : 'grab') : 'default'
|
||||||
|
}"
|
||||||
|
alt="Image preview"
|
||||||
/>
|
/>
|
||||||
<video
|
<video
|
||||||
v-else-if="fileType === 'video'"
|
v-else-if="fileType === 'video'"
|
||||||
@@ -114,102 +97,113 @@
|
|||||||
controls
|
controls
|
||||||
class="preview-audio"
|
class="preview-audio"
|
||||||
/>
|
/>
|
||||||
<v-alert
|
<n-alert
|
||||||
v-else
|
v-else
|
||||||
type="warning"
|
type="warning"
|
||||||
title="Preview Unavailable"
|
title="Preview Unavailable"
|
||||||
text="How can you preview this file?"
|
class="max-w-md"
|
||||||
class="preview-unavailable"
|
>
|
||||||
/>
|
A preview for this file type is not available.
|
||||||
|
</n-alert>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Password Dialog -->
|
<!-- Password Dialog -->
|
||||||
<v-dialog v-model="secretDialog" max-width="400">
|
<n-modal v-model:show="secretDialog">
|
||||||
<v-card>
|
<n-card
|
||||||
<v-card-title>
|
style="width: 400px"
|
||||||
<v-icon left>mdi-lock</v-icon>
|
title="Enter Password"
|
||||||
Enter Password
|
:bordered="false"
|
||||||
</v-card-title>
|
size="huge"
|
||||||
<v-card-text>
|
role="dialog"
|
||||||
<v-text-field
|
aria-modal="true"
|
||||||
v-model="dialogPassword"
|
>
|
||||||
label="Password"
|
<n-input
|
||||||
type="password"
|
v-model:value="dialogPassword"
|
||||||
variant="outlined"
|
type="password"
|
||||||
autofocus
|
show-password-on="click"
|
||||||
@keyup.enter="confirmDownload"
|
placeholder="Password"
|
||||||
/>
|
autofocus
|
||||||
</v-card-text>
|
@keyup.enter="confirmDownload"
|
||||||
<v-card-actions>
|
/>
|
||||||
<v-spacer></v-spacer>
|
<template #footer>
|
||||||
<v-btn @click="secretDialog = false">Cancel</v-btn>
|
<div class="flex justify-end gap-2">
|
||||||
<v-btn color="primary" @click="confirmDownload">Download</v-btn>
|
<n-button @click="secretDialog = false">Cancel</n-button>
|
||||||
</v-card-actions>
|
<n-button type="primary" @click="confirmDownload"
|
||||||
</v-card>
|
>Download</n-button
|
||||||
</v-dialog>
|
>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</n-card>
|
||||||
|
</n-modal>
|
||||||
|
|
||||||
<!-- Technical Details Dialog -->
|
<!-- Technical Details Dialog -->
|
||||||
<v-dialog v-model="infoDialog" max-width="640">
|
<n-drawer
|
||||||
<v-card title="File Information" prepend-icon="mdi-information">
|
v-model:show="infoDialog"
|
||||||
<v-card-text>
|
:width="breakpoints.isGreaterOrEqual('md') ? '40vw' : '100vw'"
|
||||||
<v-row>
|
>
|
||||||
<v-col cols="12" md="6">
|
<n-drawer-content>
|
||||||
<div class="mb-4">
|
<template #header>
|
||||||
<strong>File ID</strong>
|
<div class="flex items-center justify-between gap-2">
|
||||||
<div class="text-xs">#{{ fileInfo?.id }}</div>
|
<div>File Information</div>
|
||||||
</div>
|
<n-button text size="small" @click="infoDialog = false">
|
||||||
<div class="mb-4">
|
<template #icon>
|
||||||
<strong>File Name</strong>
|
<n-icon :component="XIcon" />
|
||||||
<div class="text-xs">{{ fileInfo?.name || "N/A" }}</div>
|
</template>
|
||||||
</div>
|
</n-button>
|
||||||
<div class="mb-4">
|
|
||||||
<strong>MIME Type</strong>
|
|
||||||
<div class="text-xs">{{ fileInfo?.mimeType || "N/A" }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="mb-4">
|
|
||||||
<strong>File Size</strong>
|
|
||||||
<div class="text-xs">
|
|
||||||
{{ fileInfo?.size ? formatBytes(fileInfo.size) : "N/A" }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</v-col>
|
|
||||||
<v-col cols="12" md="6">
|
|
||||||
<div class="mb-4">
|
|
||||||
<strong>Created At</strong>
|
|
||||||
<div class="text-xs">
|
|
||||||
{{
|
|
||||||
fileInfo?.createdAt
|
|
||||||
? new Date(fileInfo.createdAt).toLocaleString()
|
|
||||||
: "N/A"
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="mb-4">
|
|
||||||
<strong>Encrypted</strong>
|
|
||||||
<div class="text-xs">
|
|
||||||
{{ fileInfo?.isEncrypted ? "Yes" : "No" }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
<div class="mb-4">
|
|
||||||
<strong>Metadata:</strong>
|
|
||||||
</div>
|
</div>
|
||||||
<v-card variant="outlined" class="pa-2">
|
</template>
|
||||||
<pre
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 text-sm">
|
||||||
class="overflow-x-auto"
|
<div class="flex flex-col gap-4">
|
||||||
style="font-size: 14px"
|
<div>
|
||||||
><code>{{ JSON.stringify(fileInfo?.fileMeta, null, 2) }}</code></pre>
|
<strong class="font-semibold">File ID</strong>
|
||||||
</v-card>
|
<div class="opacity-80">#{{ fileInfo?.id }}</div>
|
||||||
</v-card-text>
|
</div>
|
||||||
<v-card-actions>
|
<div>
|
||||||
<v-spacer></v-spacer>
|
<strong class="font-semibold">File Name</strong>
|
||||||
<v-btn @click="infoDialog = false">Close</v-btn>
|
<div class="opacity-80">{{ fileInfo?.name || "N/A" }}</div>
|
||||||
</v-card-actions>
|
</div>
|
||||||
</v-card>
|
<div>
|
||||||
</v-dialog>
|
<strong class="font-semibold">MIME Type</strong>
|
||||||
|
<div class="opacity-80">{{ fileInfo?.mimeType || "N/A" }}</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<strong class="font-semibold">File Size</strong>
|
||||||
|
<div class="opacity-80">
|
||||||
|
{{ fileInfo?.size ? formatBytes(fileInfo.size) : "N/A" }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col gap-4">
|
||||||
|
<div>
|
||||||
|
<strong class="font-semibold">Created At</strong>
|
||||||
|
<div class="opacity-80">
|
||||||
|
{{
|
||||||
|
fileInfo?.createdAt
|
||||||
|
? new Date(fileInfo.createdAt).toLocaleString()
|
||||||
|
: "N/A"
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<strong class="font-semibold">Encrypted</strong>
|
||||||
|
<div class="opacity-80">
|
||||||
|
{{ fileInfo?.isEncrypted ? "Yes" : "No" }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mt-4">
|
||||||
|
<strong class="font-semibold">Metadata:</strong>
|
||||||
|
</div>
|
||||||
|
<n-card :bordered="true" class="mt-2">
|
||||||
|
<pre
|
||||||
|
class="overflow-x-auto text-xs"
|
||||||
|
><code>{{ JSON.stringify(fileInfo?.fileMeta, null, 2) }}</code></pre>
|
||||||
|
</n-card>
|
||||||
|
</n-drawer-content>
|
||||||
|
</n-drawer>
|
||||||
|
|
||||||
<!-- View Transition Overlay -->
|
<!-- View Transition Overlay -->
|
||||||
<div
|
<div
|
||||||
@@ -228,11 +222,24 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useRoute } from "vue-router"
|
import { useRoute } from "vue-router"
|
||||||
import { computed, onMounted, ref } from "vue"
|
import { computed, onMounted, ref, type Component } from "vue"
|
||||||
|
import {
|
||||||
|
Download,
|
||||||
|
Info,
|
||||||
|
Lock,
|
||||||
|
File,
|
||||||
|
FileImage,
|
||||||
|
FileVideo,
|
||||||
|
FileMusic,
|
||||||
|
FileText,
|
||||||
|
FileCode,
|
||||||
|
FileArchive,
|
||||||
|
XIcon
|
||||||
|
} from "lucide-vue-next"
|
||||||
import { downloadAndDecryptFile } from "./secure"
|
import { downloadAndDecryptFile } from "./secure"
|
||||||
import { formatBytes } from "./format"
|
import { formatBytes } from "./format"
|
||||||
import type { SnCloudFile } from "~/types/api/post"
|
import type { SnCloudFile } from "~/types/api/post"
|
||||||
|
import { breakpointsTailwind, useBreakpoints } from "@vueuse/core"
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
@@ -252,6 +259,13 @@ const zoomLevel = ref<number>(1)
|
|||||||
const initialDistance = ref<number>(0)
|
const initialDistance = ref<number>(0)
|
||||||
const isPinching = ref<boolean>(false)
|
const isPinching = ref<boolean>(false)
|
||||||
|
|
||||||
|
// Drag functionality
|
||||||
|
const translateX = ref(0)
|
||||||
|
const translateY = ref(0)
|
||||||
|
const isDragging = ref(false)
|
||||||
|
const startX = ref(0)
|
||||||
|
const startY = ref(0)
|
||||||
|
|
||||||
// View transition state
|
// View transition state
|
||||||
const isTransitioning = ref<boolean>(false)
|
const isTransitioning = ref<boolean>(false)
|
||||||
const transitionImage = ref<string>("")
|
const transitionImage = ref<string>("")
|
||||||
@@ -289,7 +303,6 @@ function checkForTransition() {
|
|||||||
isTransitioning.value = true
|
isTransitioning.value = true
|
||||||
transitionImage.value = data.src
|
transitionImage.value = data.src
|
||||||
|
|
||||||
// Calculate final position (centered in viewport)
|
|
||||||
const viewportWidth = window.innerWidth
|
const viewportWidth = window.innerWidth
|
||||||
const viewportHeight = window.innerHeight
|
const viewportHeight = window.innerHeight
|
||||||
const finalWidth = Math.min(
|
const finalWidth = Math.min(
|
||||||
@@ -300,7 +313,6 @@ function checkForTransition() {
|
|||||||
const finalX = (viewportWidth - finalWidth) / 2
|
const finalX = (viewportWidth - finalWidth) / 2
|
||||||
const finalY = (viewportHeight - finalHeight) / 2
|
const finalY = (viewportHeight - finalHeight) / 2
|
||||||
|
|
||||||
// Set initial position (from original image location)
|
|
||||||
transitionStyle.value = {
|
transitionStyle.value = {
|
||||||
position: "fixed",
|
position: "fixed",
|
||||||
top: `${data.y}px`,
|
top: `${data.y}px`,
|
||||||
@@ -311,7 +323,6 @@ function checkForTransition() {
|
|||||||
transition: "all 0.3s ease-out"
|
transition: "all 0.3s ease-out"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Animate to final position
|
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
transitionStyle.value = {
|
transitionStyle.value = {
|
||||||
...transitionStyle.value,
|
...transitionStyle.value,
|
||||||
@@ -320,8 +331,6 @@ function checkForTransition() {
|
|||||||
width: `${finalWidth}px`,
|
width: `${finalWidth}px`,
|
||||||
height: `${finalHeight}px`
|
height: `${finalHeight}px`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide transition after animation
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
isTransitioning.value = false
|
isTransitioning.value = false
|
||||||
sessionStorage.removeItem("imageTransition")
|
sessionStorage.removeItem("imageTransition")
|
||||||
@@ -345,38 +354,38 @@ const fileType = computed(() => {
|
|||||||
if (!fileInfo.value) return "unknown"
|
if (!fileInfo.value) return "unknown"
|
||||||
return fileInfo.value.mimeType?.split("/")[0] || "unknown"
|
return fileInfo.value.mimeType?.split("/")[0] || "unknown"
|
||||||
})
|
})
|
||||||
const fileIcon = computed(() => {
|
const fileIcon = computed<Component>(() => {
|
||||||
if (!fileInfo.value?.mimeType) return "mdi-file"
|
if (!fileInfo.value?.mimeType) return File
|
||||||
|
|
||||||
const mime = fileInfo.value.mimeType.toLowerCase()
|
const mime = fileInfo.value.mimeType.toLowerCase()
|
||||||
|
|
||||||
if (mime.startsWith("image/")) return "mdi-file-image"
|
if (mime.startsWith("image/")) return FileImage
|
||||||
if (mime.startsWith("video/")) return "mdi-file-video"
|
if (mime.startsWith("video/")) return FileVideo
|
||||||
if (mime.startsWith("audio/")) return "mdi-file-music"
|
if (mime.startsWith("audio/")) return FileMusic
|
||||||
if (mime === "application/pdf") return "mdi-file-pdf"
|
if (mime === "application/pdf") return FileText
|
||||||
if (
|
if (
|
||||||
mime.startsWith("text/") ||
|
mime.startsWith("text/") ||
|
||||||
mime.includes("javascript") ||
|
mime.includes("javascript") ||
|
||||||
mime.includes("json") ||
|
mime.includes("json") ||
|
||||||
mime.includes("xml")
|
mime.includes("xml")
|
||||||
)
|
)
|
||||||
return "mdi-file-code"
|
return FileCode
|
||||||
if (mime.includes("zip") || mime.includes("rar") || mime.includes("tar"))
|
if (mime.includes("zip") || mime.includes("rar") || mime.includes("tar"))
|
||||||
return "mdi-zip-box"
|
return FileArchive
|
||||||
if (
|
if (
|
||||||
mime.includes("document") ||
|
mime.includes("document") ||
|
||||||
mime.includes("word") ||
|
mime.includes("word") ||
|
||||||
mime.includes("excel") ||
|
mime.includes("excel") ||
|
||||||
mime.includes("powerpoint")
|
mime.includes("powerpoint")
|
||||||
)
|
)
|
||||||
return "mdi-file-document"
|
return FileText
|
||||||
|
|
||||||
return "mdi-file"
|
return File
|
||||||
})
|
})
|
||||||
const fileSource = computed(() => {
|
const fileSource = computed(() => {
|
||||||
let url = `${apiBase}/drive/files/${fileId}?original=true`
|
let url = `${apiBase}/drive/files/${fileId}?original=true`
|
||||||
if (passcode) {
|
if (passcode) {
|
||||||
url += `?passcode=${passcode}`
|
url += `&passcode=${passcode}`
|
||||||
}
|
}
|
||||||
return url
|
return url
|
||||||
})
|
})
|
||||||
@@ -403,55 +412,111 @@ function handleZoom(event: WheelEvent) {
|
|||||||
|
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
const delta = event.deltaY > 0 ? -0.1 : 0.1
|
const delta = event.deltaY > 0 ? -0.1 : 0.1
|
||||||
zoomLevel.value = Math.max(0.1, Math.min(5, zoomLevel.value + delta))
|
const newZoom = Math.max(0.1, Math.min(5, zoomLevel.value + delta))
|
||||||
|
|
||||||
|
if (newZoom <= 1) {
|
||||||
|
translateX.value = 0
|
||||||
|
translateY.value = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
zoomLevel.value = newZoom
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleTouchStart(event: TouchEvent) {
|
function handleTouchStart(event: TouchEvent) {
|
||||||
if (fileType.value !== "image" || event.touches.length !== 2) return
|
if (fileType.value !== "image") return
|
||||||
|
|
||||||
event.preventDefault()
|
if (event.touches.length === 2) {
|
||||||
isPinching.value = true
|
event.preventDefault()
|
||||||
const touch1 = event.touches[0]!
|
isPinching.value = true
|
||||||
const touch2 = event.touches[1]!
|
const touch1 = event.touches[0]!
|
||||||
initialDistance.value = Math.sqrt(
|
const touch2 = event.touches[1]!
|
||||||
Math.pow(touch2.clientX - touch1.clientX, 2) +
|
initialDistance.value = Math.sqrt(
|
||||||
Math.pow(touch2.clientY - touch1.clientY, 2)
|
Math.pow(touch2.clientX - touch1.clientX, 2) +
|
||||||
)
|
Math.pow(touch2.clientY - touch1.clientY, 2)
|
||||||
|
)
|
||||||
|
} else if (event.touches.length === 1 && zoomLevel.value > 1) {
|
||||||
|
isDragging.value = true
|
||||||
|
startX.value = event.touches[0]!.clientX - translateX.value
|
||||||
|
startY.value = event.touches[0]!.clientY - translateY.value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleTouchMove(event: TouchEvent) {
|
function handleTouchMove(event: TouchEvent) {
|
||||||
if (
|
if (fileType.value !== "image") return
|
||||||
fileType.value !== "image" ||
|
|
||||||
!isPinching.value ||
|
|
||||||
event.touches.length !== 2
|
|
||||||
)
|
|
||||||
return
|
|
||||||
|
|
||||||
event.preventDefault()
|
if (isPinching.value && event.touches.length === 2) {
|
||||||
const touch1 = event.touches[0]!
|
event.preventDefault()
|
||||||
const touch2 = event.touches[1]!
|
const touch1 = event.touches[0]!
|
||||||
const currentDistance = Math.sqrt(
|
const touch2 = event.touches[1]!
|
||||||
Math.pow(touch2.clientX - touch1.clientX, 2) +
|
const currentDistance = Math.sqrt(
|
||||||
Math.pow(touch2.clientY - touch1.clientY, 2)
|
Math.pow(touch2.clientX - touch1.clientX, 2) +
|
||||||
)
|
Math.pow(touch2.clientY - touch1.clientY, 2)
|
||||||
|
)
|
||||||
|
|
||||||
const scale = currentDistance / initialDistance.value
|
const scale = currentDistance / initialDistance.value
|
||||||
zoomLevel.value = Math.max(0.1, Math.min(5, scale))
|
const newZoom = Math.max(0.1, Math.min(5, zoomLevel.value * scale))
|
||||||
|
|
||||||
|
if (newZoom <= 1) {
|
||||||
|
translateX.value = 0
|
||||||
|
translateY.value = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
zoomLevel.value = newZoom
|
||||||
|
} else if (isDragging.value && event.touches.length === 1) {
|
||||||
|
event.preventDefault()
|
||||||
|
translateX.value = event.touches[0]!.clientX - startX.value
|
||||||
|
translateY.value = event.touches[0]!.clientY - startY.value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleTouchEnd(_event: TouchEvent) {
|
function handleTouchEnd(_event: TouchEvent) {
|
||||||
if (fileType.value !== "image") return
|
if (fileType.value !== "image") return
|
||||||
|
|
||||||
isPinching.value = false
|
isPinching.value = false
|
||||||
|
isDragging.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMouseDown(event: MouseEvent) {
|
||||||
|
if (fileType.value !== "image" || zoomLevel.value <= 1) return
|
||||||
|
|
||||||
|
event.preventDefault()
|
||||||
|
isDragging.value = true
|
||||||
|
startX.value = event.clientX - translateX.value
|
||||||
|
startY.value = event.clientY - translateY.value
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMouseMove(event: MouseEvent) {
|
||||||
|
if (!isDragging.value) return
|
||||||
|
|
||||||
|
event.preventDefault()
|
||||||
|
translateX.value = event.clientX - startX.value
|
||||||
|
translateY.value = event.clientY - startY.value
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMouseUp() {
|
||||||
|
isDragging.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDoubleClick() {
|
function handleDoubleClick() {
|
||||||
if (fileType.value !== "image") return
|
if (fileType.value !== "image") return
|
||||||
|
|
||||||
zoomLevel.value = zoomLevel.value > 1 ? 1 : 2
|
if (zoomLevel.value > 1) {
|
||||||
|
zoomLevel.value = 1
|
||||||
|
translateX.value = 0
|
||||||
|
translateY.value = 0
|
||||||
|
} else {
|
||||||
|
zoomLevel.value = 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const breakpoints = useBreakpoints(breakpointsTailwind)
|
||||||
|
const message = useMessage()
|
||||||
|
|
||||||
async function performDownload(password: string) {
|
async function performDownload(password: string) {
|
||||||
|
const progressMessage = message.loading("Downloading file...", {
|
||||||
|
duration: 0
|
||||||
|
})
|
||||||
|
|
||||||
if (fileInfo.value!.isEncrypted) {
|
if (fileInfo.value!.isEncrypted) {
|
||||||
downloadAndDecryptFile(
|
downloadAndDecryptFile(
|
||||||
fileSource.value,
|
fileSource.value,
|
||||||
@@ -503,6 +568,9 @@ async function performDownload(password: string) {
|
|||||||
a.click()
|
a.click()
|
||||||
a.remove()
|
a.remove()
|
||||||
window.URL.revokeObjectURL(blobUrl)
|
window.URL.revokeObjectURL(blobUrl)
|
||||||
|
|
||||||
|
progressMessage.destroy()
|
||||||
|
message.success("File has been downloaded successfully.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,11 +581,7 @@ definePageMeta({
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.lightbox-container {
|
.lightbox-container {
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100vh;
|
|
||||||
background: rgba(0, 0, 0, 0.9);
|
background: rgba(0, 0, 0, 0.9);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -525,6 +589,7 @@ definePageMeta({
|
|||||||
}
|
}
|
||||||
|
|
||||||
.top-toolbar {
|
.top-toolbar {
|
||||||
|
height: 56px;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1001;
|
z-index: 1001;
|
||||||
}
|
}
|
||||||
@@ -536,6 +601,7 @@ definePageMeta({
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
min-height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview-content {
|
.preview-content {
|
||||||
@@ -549,21 +615,17 @@ definePageMeta({
|
|||||||
.file-preview {
|
.file-preview {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
max-width: calc(100vw - 40px);
|
|
||||||
max-height: calc(
|
|
||||||
100vh - 88px
|
|
||||||
); /* Account for top toolbar (48px) + padding (40px) */
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview-image {
|
.preview-image {
|
||||||
width: 100%;
|
max-width: 100%;
|
||||||
height: 100%;
|
max-height: 100%;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
transition: all 0.3s ease-in-out;
|
transition: transform 0.2s ease-out;
|
||||||
will-change: contents;
|
will-change: transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview-video,
|
.preview-video,
|
||||||
@@ -572,27 +634,6 @@ definePageMeta({
|
|||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview-unavailable {
|
|
||||||
max-width: 500px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-spinner {
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-alert {
|
|
||||||
max-width: 500px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.encrypted-notice {
|
|
||||||
max-width: 500px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Ensure toolbar doesn't interfere with content */
|
|
||||||
.top-toolbar :deep(.v-app-bar__content) {
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* View transition styles */
|
/* View transition styles */
|
||||||
.transition-overlay {
|
.transition-overlay {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="container mx-auto px-5">
|
<div class="container mx-auto px-5">
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<div class="main">
|
<div class="main pt-4">
|
||||||
<n-infinite-scroll
|
<n-infinite-scroll
|
||||||
style="overflow: auto"
|
style="overflow: auto"
|
||||||
:distance="0"
|
:distance="0"
|
||||||
@@ -13,10 +13,17 @@
|
|||||||
:item="activity.data"
|
:item="activity.data"
|
||||||
@click="router.push('/posts/' + activity.id)"
|
@click="router.push('/posts/' + activity.id)"
|
||||||
/>
|
/>
|
||||||
|
<n-card v-else>
|
||||||
|
<n-alert type="info" title="Unknown Activity">
|
||||||
|
Sorry, the FloatingIsland do not support
|
||||||
|
{{ activity.type }} right now. You can check this over the
|
||||||
|
Solian.
|
||||||
|
</n-alert>
|
||||||
|
</n-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="loading" class="flex justify-center py-4">
|
<div v-if="loading" class="flex justify-center py-4">
|
||||||
<n-spin size="large" />
|
<span class="loading loading-spinner loading-lg"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@@ -30,7 +37,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</n-infinite-scroll>
|
</n-infinite-scroll>
|
||||||
</div>
|
</div>
|
||||||
<div class="sidebar flex flex-col gap-3">
|
<div class="sidebar flex flex-col gap-3 pt-4">
|
||||||
<div v-if="!userStore.isAuthenticated">
|
<div v-if="!userStore.isAuthenticated">
|
||||||
<n-card>
|
<n-card>
|
||||||
<h2 class="card-title">About</h2>
|
<h2 class="card-title">About</h2>
|
||||||
@@ -47,11 +54,9 @@
|
|||||||
</p>
|
</p>
|
||||||
</n-card>
|
</n-card>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="card w-full bg-base-100 shadow-xl">
|
<n-card v-else class="w-full">
|
||||||
<div class="card-body">
|
<post-editor @posted="refreshActivities" />
|
||||||
<post-editor @posted="refreshActivities" />
|
</n-card>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<sidebar-footer class="max-lg:hidden" />
|
<sidebar-footer class="max-lg:hidden" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -80,6 +85,7 @@ useHead({
|
|||||||
})
|
})
|
||||||
|
|
||||||
defineOgImage({
|
defineOgImage({
|
||||||
|
// @ts-ignore
|
||||||
title: "Explore",
|
title: "Explore",
|
||||||
description: "The open social network. Friendly to everyone."
|
description: "The open social network. Friendly to everyone."
|
||||||
})
|
})
|
||||||
@@ -172,7 +178,7 @@ async function refreshActivities() {
|
|||||||
@media (min-width: 1280px) {
|
@media (min-width: 1280px) {
|
||||||
.sidebar {
|
.sidebar {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: calc(68px + 8px);
|
top: calc(64px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,68 +1,63 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="d-flex align-center justify-center fill-height">
|
<div class="flex items-center justify-center min-h-screen">
|
||||||
<v-card
|
<n-card title="Order Payment" class="max-w-sm">
|
||||||
max-width="400"
|
<template #header-icon>
|
||||||
title="Order Payment"
|
<n-icon :component="Wallet" />
|
||||||
prepend-icon="mdi-cash"
|
</template>
|
||||||
class="pa-2"
|
<n-alert v-if="done" type="success" class="mb-4">
|
||||||
>
|
The order has been paid successfully. You can now close this tab and
|
||||||
<v-card-text>
|
return to Solar Network!
|
||||||
<v-alert v-if="done" type="success" class="mb-4">
|
</n-alert>
|
||||||
The order has been paid successfully. Now you can close this tab and
|
<n-alert
|
||||||
back to the Solar Network!
|
v-else-if="!!error"
|
||||||
</v-alert>
|
type="error"
|
||||||
<v-alert
|
title="Something went wrong"
|
||||||
v-else-if="!!error"
|
class="mb-4"
|
||||||
type="error"
|
>
|
||||||
title="Something went wrong"
|
{{ error }}
|
||||||
class="mb-4"
|
</n-alert>
|
||||||
>{{ error }}</v-alert
|
<div v-else-if="!!order" class="flex flex-col gap-2">
|
||||||
>
|
<p>Order for {{ order.productIdentifier ?? "unknown" }}</p>
|
||||||
<div v-else-if="!!order">
|
<div class="flex items-center gap-2">
|
||||||
<p class="mb-2">
|
<n-icon :component="Tag" />
|
||||||
Order for {{ order.productIdentifier ?? "unknown" }}
|
<strong>{{ order.remarks }}</strong>
|
||||||
</p>
|
|
||||||
<div class="d-flex align-center gap-2 mb-2">
|
|
||||||
<v-icon size="18">mdi-tag</v-icon>
|
|
||||||
<strong>{{ order.remarks }}</strong>
|
|
||||||
</div>
|
|
||||||
<div class="d-flex align-center gap-2 mb-2">
|
|
||||||
<v-icon size="18">mdi-cash</v-icon>
|
|
||||||
<span>Amount</span>
|
|
||||||
<strong>{{ order.amount }} {{ order.currency }}</strong>
|
|
||||||
</div>
|
|
||||||
<div v-if="order.expiredAt" class="d-flex align-center gap-2 mb-4">
|
|
||||||
<v-icon size="18">mdi-calendar</v-icon>
|
|
||||||
<span>Until</span>
|
|
||||||
<strong>{{ new Date(order.expiredAt).toLocaleString() }}</strong>
|
|
||||||
</div>
|
|
||||||
<div class="mt-4">
|
|
||||||
<v-otp-input
|
|
||||||
v-model="pinCode"
|
|
||||||
label="Pin Code"
|
|
||||||
length="6"
|
|
||||||
type="password"
|
|
||||||
density="comfortable"
|
|
||||||
></v-otp-input>
|
|
||||||
<v-btn
|
|
||||||
color="primary"
|
|
||||||
:loading="submitting"
|
|
||||||
class="mt-4"
|
|
||||||
@click="pay"
|
|
||||||
>
|
|
||||||
<v-icon left>mdi-check</v-icon>
|
|
||||||
Pay
|
|
||||||
</v-btn>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<v-progress-circular
|
<div class="flex items-center gap-2">
|
||||||
v-else
|
<n-icon :component="CircleDollarSign" />
|
||||||
indeterminate
|
<span>Amount</span>
|
||||||
size="32"
|
<strong>{{ order.amount }} {{ order.currency }}</strong>
|
||||||
class="mt-4"
|
</div>
|
||||||
></v-progress-circular>
|
<div v-if="order.expiredAt" class="flex items-center gap-2">
|
||||||
</v-card-text>
|
<n-icon :component="Calendar" />
|
||||||
</v-card>
|
<span>Until</span>
|
||||||
|
<strong>{{ new Date(order.expiredAt).toLocaleString() }}</strong>
|
||||||
|
</div>
|
||||||
|
<div class="mt-4">
|
||||||
|
<n-input
|
||||||
|
v-model:value="pinCode"
|
||||||
|
type="password"
|
||||||
|
show-password-on="click"
|
||||||
|
placeholder="6-digit PIN"
|
||||||
|
maxlength="6"
|
||||||
|
:input-props="{ autocomplete: 'one-time-code' }"
|
||||||
|
/>
|
||||||
|
<n-button
|
||||||
|
type="primary"
|
||||||
|
:loading="submitting"
|
||||||
|
class="mt-4 w-full"
|
||||||
|
@click="pay"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<n-icon :component="Check" />
|
||||||
|
</template>
|
||||||
|
Pay
|
||||||
|
</n-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else class="flex justify-center p-8">
|
||||||
|
<n-spin size="medium" />
|
||||||
|
</div>
|
||||||
|
</n-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -70,6 +65,13 @@
|
|||||||
import { onMounted, ref } from "vue"
|
import { onMounted, ref } from "vue"
|
||||||
import { useRoute } from "vue-router"
|
import { useRoute } from "vue-router"
|
||||||
import type { SnWalletOrder } from "~/types/api/order"
|
import type { SnWalletOrder } from "~/types/api/order"
|
||||||
|
import {
|
||||||
|
Wallet,
|
||||||
|
Tag,
|
||||||
|
CircleDollarSign,
|
||||||
|
Calendar,
|
||||||
|
Check
|
||||||
|
} from "lucide-vue-next"
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
@@ -99,6 +101,7 @@ async function fetchOrder() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function pay() {
|
async function pay() {
|
||||||
|
if (submitting.value) return
|
||||||
submitting.value = true
|
submitting.value = true
|
||||||
try {
|
try {
|
||||||
await api(`/id/orders/${encodeURIComponent(orderId)}/pay`, {
|
await api(`/id/orders/${encodeURIComponent(orderId)}/pay`, {
|
||||||
@@ -109,6 +112,8 @@ async function pay() {
|
|||||||
done.value = true
|
done.value = true
|
||||||
} catch (err: unknown) {
|
} catch (err: unknown) {
|
||||||
error.value = err instanceof Error ? err.message : String(err)
|
error.value = err instanceof Error ? err.message : String(err)
|
||||||
|
} finally {
|
||||||
|
submitting.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,5 +123,4 @@ definePageMeta({
|
|||||||
middleware: ["auth"],
|
middleware: ["auth"],
|
||||||
title: "Solarpay"
|
title: "Solarpay"
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="py-6">
|
<div class="py-6 px-5">
|
||||||
<div v-if="pending" class="text-center py-12">
|
<div v-if="pending" class="text-center py-12">
|
||||||
<n-spin size="large" />
|
<n-spin size="large" />
|
||||||
<p class="mt-4">Loading post...</p>
|
<p class="mt-4">Loading post...</p>
|
||||||
|
|||||||
@@ -1,195 +1,186 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="user">
|
<div>
|
||||||
|
<div class="fixed inset-0 blur-md" :style="pageStyle" />
|
||||||
<img
|
<img
|
||||||
:src="userBackground"
|
:src="userBackground"
|
||||||
class="object-cover w-full max-h-48 mb-8"
|
class="w-full max-h-48 object-cover object-top"
|
||||||
style="aspect-ratio: 16/7"
|
:style="{ aspectRatio: '16/7', opacity: headerOpacity }"
|
||||||
/>
|
/>
|
||||||
|
<div v-if="user" class="relative min-h-layout">
|
||||||
<v-container>
|
<div class="container mx-auto p-4 sm:p-8">
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<div class="main">
|
<div class="sidebar flex flex-col gap-3">
|
||||||
<!-- Filter Section -->
|
<n-card
|
||||||
<v-card class="mb-4">
|
:class="cardClass"
|
||||||
<v-tabs
|
:style="cardStyle"
|
||||||
v-model="activeCategoryTab"
|
:content-style="cardContentStyle"
|
||||||
color="primary"
|
|
||||||
class="mb-2"
|
|
||||||
grow
|
|
||||||
>
|
>
|
||||||
<v-tab value="all">All</v-tab>
|
|
||||||
<v-tab value="posts">Posts</v-tab>
|
|
||||||
<v-tab value="articles">Articles</v-tab>
|
|
||||||
</v-tabs>
|
|
||||||
|
|
||||||
<v-row>
|
|
||||||
<v-col cols="12" sm="6">
|
|
||||||
<v-checkbox
|
|
||||||
:model-value="includeReplies"
|
|
||||||
label="Include replies"
|
|
||||||
:indeterminate="includeReplies === null"
|
|
||||||
density="compact"
|
|
||||||
prepend-icon="mdi-reply"
|
|
||||||
hide-details
|
|
||||||
class="px-4"
|
|
||||||
@update:model-value="cycleIncludeReplies"
|
|
||||||
/>
|
|
||||||
</v-col>
|
|
||||||
<v-col cols="12" sm="6">
|
|
||||||
<v-checkbox
|
|
||||||
v-model="mediaOnly"
|
|
||||||
label="Media only"
|
|
||||||
density="compact"
|
|
||||||
hide-details
|
|
||||||
class="px-4"
|
|
||||||
prepend-icon="mdi-attachment"
|
|
||||||
/>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<v-checkbox
|
|
||||||
v-model="orderDesc"
|
|
||||||
label="Descending order"
|
|
||||||
density="compact"
|
|
||||||
prepend-icon="mdi-sort"
|
|
||||||
class="px-4"
|
|
||||||
hide-details
|
|
||||||
/>
|
|
||||||
|
|
||||||
<v-divider class="my-1" />
|
|
||||||
|
|
||||||
<v-list-item
|
|
||||||
title="Advanced filters"
|
|
||||||
prepend-icon="mdi-filter-variant"
|
|
||||||
@click="showAdvancedFilters = !showAdvancedFilters"
|
|
||||||
>
|
|
||||||
<template #append>
|
|
||||||
<v-icon>
|
|
||||||
{{
|
|
||||||
showAdvancedFilters ? "mdi-chevron-up" : "mdi-chevron-down"
|
|
||||||
}}
|
|
||||||
</v-icon>
|
|
||||||
</template>
|
|
||||||
</v-list-item>
|
|
||||||
|
|
||||||
<v-expand-transition>
|
|
||||||
<div v-if="showAdvancedFilters" class="my-3 px-4">
|
|
||||||
<v-text-field
|
|
||||||
v-model="queryTerm"
|
|
||||||
hide-details
|
|
||||||
label="Search"
|
|
||||||
placeholder="Search posts"
|
|
||||||
prepend-inner-icon="mdi-magnify"
|
|
||||||
variant="outlined"
|
|
||||||
density="comfortable"
|
|
||||||
class="mb-3"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<v-select
|
|
||||||
v-model="order"
|
|
||||||
hide-details
|
|
||||||
label="Sort by"
|
|
||||||
:items="[
|
|
||||||
{ title: 'Date', value: 'date' },
|
|
||||||
{ title: 'Popularity', value: 'popularity' }
|
|
||||||
]"
|
|
||||||
variant="outlined"
|
|
||||||
density="comfortable"
|
|
||||||
class="mb-3"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<v-row>
|
|
||||||
<v-col cols="12" sm="6">
|
|
||||||
<v-text-field
|
|
||||||
:model-value="periodStartFormatted"
|
|
||||||
hide-details
|
|
||||||
label="From date"
|
|
||||||
prepend-inner-icon="mdi-calendar"
|
|
||||||
variant="outlined"
|
|
||||||
density="comfortable"
|
|
||||||
readonly
|
|
||||||
@click="openDatePicker('start')"
|
|
||||||
/>
|
|
||||||
</v-col>
|
|
||||||
<v-col cols="12" sm="6">
|
|
||||||
<v-text-field
|
|
||||||
:model-value="periodEndFormatted"
|
|
||||||
hide-details
|
|
||||||
label="To date"
|
|
||||||
prepend-inner-icon="mdi-calendar"
|
|
||||||
variant="outlined"
|
|
||||||
density="comfortable"
|
|
||||||
readonly
|
|
||||||
@click="openDatePicker('end')"
|
|
||||||
/>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</div>
|
|
||||||
</v-expand-transition>
|
|
||||||
</v-card>
|
|
||||||
|
|
||||||
<post-list :key="filterKey" :params="postListParams" />
|
|
||||||
|
|
||||||
<!-- Date Picker Dialog -->
|
|
||||||
<v-dialog v-model="datePickerDialog" max-width="400">
|
|
||||||
<v-card>
|
|
||||||
<v-card-title>{{
|
|
||||||
datePickerType === "start" ? "From date" : "To date"
|
|
||||||
}}</v-card-title>
|
|
||||||
<v-card-text>
|
|
||||||
<v-date-picker
|
|
||||||
v-model="tempDate"
|
|
||||||
:max="new Date().toISOString().split('T')[0]"
|
|
||||||
/>
|
|
||||||
</v-card-text>
|
|
||||||
<v-card-actions>
|
|
||||||
<v-spacer />
|
|
||||||
<v-btn @click="datePickerDialog = false">Cancel</v-btn>
|
|
||||||
<v-btn color="primary" @click="confirmDatePicker">OK</v-btn>
|
|
||||||
</v-card-actions>
|
|
||||||
</v-card>
|
|
||||||
</v-dialog>
|
|
||||||
</div>
|
|
||||||
<div class="sidebar flex flex-col gap-3">
|
|
||||||
<v-card class="w-full">
|
|
||||||
<v-card-text>
|
|
||||||
<div class="flex items-center gap-4 mb-4">
|
<div class="flex items-center gap-4 mb-4">
|
||||||
<v-avatar size="60" rounded="circle" :image="userPicture" />
|
<n-avatar size="large" round :src="userPicture" />
|
||||||
<div>
|
<div>
|
||||||
<div class="text-xl font-bold">
|
<div class="text-xl font-bold">
|
||||||
{{ user.nick || user.name }}
|
{{ user.nick || user.name }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-body-2 text-medium-emphasis">
|
<div class="text-sm opacity-80">@{{ user.name }}</div>
|
||||||
@{{ user.name }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="htmlBio" class="bio-prose" v-html="htmlBio"></div>
|
<article
|
||||||
</v-card-text>
|
v-if="htmlBio"
|
||||||
</v-card>
|
class="bio-prose prose prose-sm dark:prose-invert prose-slate"
|
||||||
|
v-html="htmlBio"
|
||||||
|
></article>
|
||||||
|
</n-card>
|
||||||
|
|
||||||
|
<n-card
|
||||||
|
v-if="user.verification"
|
||||||
|
:class="cardClass"
|
||||||
|
:style="cardStyle"
|
||||||
|
:content-style="cardContentStyle"
|
||||||
|
>
|
||||||
|
<verification-status-card :mark="user.verification" />
|
||||||
|
</n-card>
|
||||||
|
</div>
|
||||||
|
<div class="main">
|
||||||
|
<!-- Filter Section -->
|
||||||
|
<n-card
|
||||||
|
class="mb-4"
|
||||||
|
:class="cardClass"
|
||||||
|
:style="cardStyle"
|
||||||
|
:content-style="cardContentStyle"
|
||||||
|
>
|
||||||
|
<n-tabs v-model:value="activeCategoryTab" type="segment">
|
||||||
|
<n-tab name="all">All</n-tab>
|
||||||
|
<n-tab name="posts">Posts</n-tab>
|
||||||
|
<n-tab name="articles">Articles</n-tab>
|
||||||
|
</n-tabs>
|
||||||
|
|
||||||
|
<div class="mx-4">
|
||||||
|
<div
|
||||||
|
class="grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-2 mt-4"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="flex items-center gap-2 cursor-pointer"
|
||||||
|
@click="cycleIncludeReplies"
|
||||||
|
>
|
||||||
|
<n-icon :component="Reply" />
|
||||||
|
<n-checkbox
|
||||||
|
:checked="includeReplies !== false"
|
||||||
|
:indeterminate="includeReplies === null"
|
||||||
|
@update:checked="cycleIncludeReplies"
|
||||||
|
>
|
||||||
|
Include replies
|
||||||
|
</n-checkbox>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<n-icon :component="Paperclip" />
|
||||||
|
<n-checkbox v-model:checked="mediaOnly">
|
||||||
|
Media only
|
||||||
|
</n-checkbox>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<n-icon :component="ArrowUpDown" />
|
||||||
|
<n-checkbox v-model:checked="orderDesc">
|
||||||
|
Descending order
|
||||||
|
</n-checkbox>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="flex items-center cursor-pointer mt-4"
|
||||||
|
@click="showAdvancedFilters = !showAdvancedFilters"
|
||||||
|
>
|
||||||
|
<n-icon :component="Filter" />
|
||||||
|
<span class="ml-2 font-medium">Advanced filters</span>
|
||||||
|
<n-icon class="ml-auto">
|
||||||
|
<ChevronDown v-if="!showAdvancedFilters" />
|
||||||
|
<ChevronUp v-else />
|
||||||
|
</n-icon>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<n-collapse-transition :show="showAdvancedFilters">
|
||||||
|
<div class="mt-4 flex flex-col gap-3">
|
||||||
|
<n-input
|
||||||
|
v-model:value="queryTerm"
|
||||||
|
placeholder="Search posts"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<n-icon :component="Search" />
|
||||||
|
</template>
|
||||||
|
</n-input>
|
||||||
|
|
||||||
|
<!-- the select only takes the common border radius somehow -->
|
||||||
|
<n-config-provider
|
||||||
|
:theme-overrides="{ common: { borderRadius: '8px' } }"
|
||||||
|
>
|
||||||
|
<n-select
|
||||||
|
v-model:value="order"
|
||||||
|
placeholder="Sort by"
|
||||||
|
:options="[
|
||||||
|
{ label: 'Date', value: 'date' },
|
||||||
|
{ label: 'Popularity', value: 'popularity' }
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</n-config-provider>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
||||||
|
<n-date-picker
|
||||||
|
v-model:value="periodStart"
|
||||||
|
type="date"
|
||||||
|
placeholder="From date"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
<n-date-picker
|
||||||
|
v-model:value="periodEnd"
|
||||||
|
type="date"
|
||||||
|
placeholder="To date"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</n-collapse-transition>
|
||||||
|
</div>
|
||||||
|
</n-card>
|
||||||
|
|
||||||
|
<post-list :key="filterKey" :params="postListParams" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</v-container>
|
</div>
|
||||||
</div>
|
<div
|
||||||
<div v-else-if="notFound" class="flex justify-center items-center h-full">
|
v-else-if="notFound"
|
||||||
<v-empty-state
|
class="relative flex justify-center items-center h-full"
|
||||||
icon="mdi-account-off"
|
>
|
||||||
title="User not found"
|
<n-empty
|
||||||
text="The user profile you're trying to access is not found."
|
description="The publisher profile you're trying to access is not found."
|
||||||
/>
|
>
|
||||||
</div>
|
<template #icon>
|
||||||
<div v-else class="flex justify-center items-center h-full">
|
<n-icon :component="UserX" />
|
||||||
<v-progress-circular indeterminate size="64" color="primary" />
|
</template>
|
||||||
|
</n-empty>
|
||||||
|
</div>
|
||||||
|
<div v-else class="relative flex justify-center items-center h-full">
|
||||||
|
<n-spin size="large" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref, watch } from "vue"
|
import { computed, ref, watch } from "vue"
|
||||||
|
import { useWindowScroll } from "@vueuse/core"
|
||||||
import { useMarkdownProcessor } from "~/composables/useMarkdownProcessor"
|
import { useMarkdownProcessor } from "~/composables/useMarkdownProcessor"
|
||||||
import type { SnPublisher } from "~/types/api"
|
import type { SnPublisher } from "~/types/api"
|
||||||
import type { PostListParams } from "~/composables/usePostList"
|
import type { PostListParams } from "~/composables/usePostList"
|
||||||
|
|
||||||
import PostList from "~/components/Post/PostList.vue"
|
import PostList from "~/components/Post/PostList.vue"
|
||||||
|
import {
|
||||||
|
Reply,
|
||||||
|
Paperclip,
|
||||||
|
ArrowUpDown,
|
||||||
|
Filter,
|
||||||
|
Search,
|
||||||
|
ChevronDown,
|
||||||
|
ChevronUp,
|
||||||
|
UserX
|
||||||
|
} from "lucide-vue-next"
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
@@ -202,7 +193,6 @@ const username = computed(() => {
|
|||||||
return nameStr
|
return nameStr
|
||||||
})
|
})
|
||||||
|
|
||||||
// Use useFetch with the correct API URL to avoid router conflicts
|
|
||||||
const apiBase = useSolarNetworkUrl()
|
const apiBase = useSolarNetworkUrl()
|
||||||
const apiBaseServer = useSolarNetworkUrl()
|
const apiBaseServer = useSolarNetworkUrl()
|
||||||
|
|
||||||
@@ -246,6 +236,44 @@ const userPicture = computed(() => {
|
|||||||
: undefined
|
: undefined
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { y: scrollY } = useWindowScroll()
|
||||||
|
const scrollThreshold = 192 // max-h-48 is 12rem = 192px
|
||||||
|
|
||||||
|
const backgroundOpacity = computed(() => {
|
||||||
|
return Math.max(0, Math.min(scrollY.value / scrollThreshold, 1))
|
||||||
|
})
|
||||||
|
|
||||||
|
const headerOpacity = computed(() => {
|
||||||
|
return 1 - backgroundOpacity.value
|
||||||
|
})
|
||||||
|
|
||||||
|
const pageStyle = computed(() => {
|
||||||
|
if (!userBackground.value) return {}
|
||||||
|
return {
|
||||||
|
backgroundImage: `linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url('${userBackground.value}')`,
|
||||||
|
backgroundSize: "cover",
|
||||||
|
backgroundPosition: "center",
|
||||||
|
backgroundRepeat: "no-repeat",
|
||||||
|
backgroundAttachment: "fixed",
|
||||||
|
opacity: backgroundOpacity.value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const cardClass = computed(() => ({
|
||||||
|
"backdrop-blur-2xl": !!userBackground.value,
|
||||||
|
"shadow-xl": !!userBackground.value
|
||||||
|
}))
|
||||||
|
|
||||||
|
const cardStyle = computed(() =>
|
||||||
|
userBackground.value
|
||||||
|
? "background-color: var(--n-color-modal)"
|
||||||
|
: "background-color: var(--n-color)"
|
||||||
|
)
|
||||||
|
|
||||||
|
const cardContentStyle = computed(() =>
|
||||||
|
userBackground.value ? "background-color: transparent" : ""
|
||||||
|
)
|
||||||
|
|
||||||
// Filter state
|
// Filter state
|
||||||
const activeCategoryTab = ref("all")
|
const activeCategoryTab = ref("all")
|
||||||
const includeReplies = ref<boolean | null>(null)
|
const includeReplies = ref<boolean | null>(null)
|
||||||
@@ -253,14 +281,9 @@ const mediaOnly = ref(false)
|
|||||||
const orderDesc = ref(true)
|
const orderDesc = ref(true)
|
||||||
const showAdvancedFilters = ref(false)
|
const showAdvancedFilters = ref(false)
|
||||||
const queryTerm = ref("")
|
const queryTerm = ref("")
|
||||||
const order = ref<string | undefined>(undefined)
|
const order = ref<string | null>(null)
|
||||||
const periodStart = ref<number | undefined>(undefined)
|
const periodStart = ref<number | null>(null)
|
||||||
const periodEnd = ref<number | undefined>(undefined)
|
const periodEnd = ref<number | null>(null)
|
||||||
|
|
||||||
// Date picker dialog
|
|
||||||
const datePickerDialog = ref(false)
|
|
||||||
const datePickerType = ref<"start" | "end">("start")
|
|
||||||
const tempDate = ref<Date | undefined>(undefined)
|
|
||||||
|
|
||||||
const postListParams = computed<PostListParams>(() => {
|
const postListParams = computed<PostListParams>(() => {
|
||||||
const params: PostListParams = {
|
const params: PostListParams = {
|
||||||
@@ -269,74 +292,36 @@ const postListParams = computed<PostListParams>(() => {
|
|||||||
mediaOnly: mediaOnly.value,
|
mediaOnly: mediaOnly.value,
|
||||||
orderDesc: orderDesc.value,
|
orderDesc: orderDesc.value,
|
||||||
queryTerm: queryTerm.value || undefined,
|
queryTerm: queryTerm.value || undefined,
|
||||||
order: order.value,
|
order: order.value ?? undefined,
|
||||||
periodStart: periodStart.value,
|
periodStart: periodStart.value
|
||||||
periodEnd: periodEnd.value
|
? Math.floor(periodStart.value / 1000)
|
||||||
|
: undefined,
|
||||||
|
periodEnd: periodEnd.value ? Math.floor(periodEnd.value / 1000) : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set type based on active tab
|
|
||||||
if (activeCategoryTab.value === "posts") {
|
if (activeCategoryTab.value === "posts") {
|
||||||
params.type = 0 // Assuming 0 is for posts
|
params.type = 0
|
||||||
} else if (activeCategoryTab.value === "articles") {
|
} else if (activeCategoryTab.value === "articles") {
|
||||||
params.type = 1 // Assuming 1 is for articles
|
params.type = 1
|
||||||
}
|
}
|
||||||
// 'all' means no type filter
|
|
||||||
|
|
||||||
return params
|
return params
|
||||||
})
|
})
|
||||||
|
|
||||||
const periodStartFormatted = computed(() => {
|
|
||||||
return periodStart.value
|
|
||||||
? new Date(periodStart.value * 1000).toISOString().split("T")[0]
|
|
||||||
: ""
|
|
||||||
})
|
|
||||||
|
|
||||||
const periodEndFormatted = computed(() => {
|
|
||||||
return periodEnd.value
|
|
||||||
? new Date(periodEnd.value * 1000).toISOString().split("T")[0]
|
|
||||||
: ""
|
|
||||||
})
|
|
||||||
|
|
||||||
// Create a key that changes when filters change to force PostList re-mount
|
|
||||||
const filterKey = computed(() => {
|
const filterKey = computed(() => {
|
||||||
return JSON.stringify(postListParams.value)
|
return JSON.stringify(postListParams.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
const cycleIncludeReplies = () => {
|
const cycleIncludeReplies = () => {
|
||||||
if (includeReplies.value === null) {
|
if (includeReplies.value === null) {
|
||||||
includeReplies.value = false
|
|
||||||
} else if (includeReplies.value === false) {
|
|
||||||
includeReplies.value = true
|
includeReplies.value = true
|
||||||
|
} else if (includeReplies.value === true) {
|
||||||
|
includeReplies.value = false
|
||||||
} else {
|
} else {
|
||||||
includeReplies.value = null
|
includeReplies.value = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const openDatePicker = (type: "start" | "end") => {
|
|
||||||
datePickerType.value = type
|
|
||||||
tempDate.value =
|
|
||||||
type === "start"
|
|
||||||
? periodStart.value
|
|
||||||
? new Date(periodStart.value * 1000)
|
|
||||||
: new Date()
|
|
||||||
: periodEnd.value
|
|
||||||
? new Date(periodEnd.value * 1000)
|
|
||||||
: new Date()
|
|
||||||
datePickerDialog.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
const confirmDatePicker = () => {
|
|
||||||
if (tempDate.value) {
|
|
||||||
const timestamp = Math.floor(tempDate.value.getTime() / 1000)
|
|
||||||
if (datePickerType.value === "start") {
|
|
||||||
periodStart.value = timestamp
|
|
||||||
} else {
|
|
||||||
periodEnd.value = timestamp
|
|
||||||
}
|
|
||||||
}
|
|
||||||
datePickerDialog.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
alias: ["/p/:name()"]
|
alias: ["/p/:name()"]
|
||||||
})
|
})
|
||||||
@@ -344,12 +329,12 @@ definePageMeta({
|
|||||||
useHead({
|
useHead({
|
||||||
title: computed(() => {
|
title: computed(() => {
|
||||||
if (notFound.value) {
|
if (notFound.value) {
|
||||||
return "User not found"
|
return "Publisher not found"
|
||||||
}
|
}
|
||||||
if (user.value) {
|
if (user.value) {
|
||||||
return user.value.nick || user.value.name
|
return user.value.nick || user.value.name
|
||||||
}
|
}
|
||||||
return "Loading user..."
|
return "Loading publisher..."
|
||||||
}),
|
}),
|
||||||
meta: computed(() => {
|
meta: computed(() => {
|
||||||
if (user.value) {
|
if (user.value) {
|
||||||
@@ -364,6 +349,7 @@ useHead({
|
|||||||
|
|
||||||
defineOgImage({
|
defineOgImage({
|
||||||
component: "ImageCard",
|
component: "ImageCard",
|
||||||
|
// @ts-ignore
|
||||||
title: computed(() =>
|
title: computed(() =>
|
||||||
user.value ? user.value.nick || user.value.name : "Publisher Profile"
|
user.value ? user.value.nick || user.value.name : "Publisher Profile"
|
||||||
),
|
),
|
||||||
@@ -398,14 +384,12 @@ defineOgImage({
|
|||||||
|
|
||||||
.sidebar {
|
.sidebar {
|
||||||
order: 1;
|
order: 1;
|
||||||
overflow-y: auto;
|
|
||||||
height: auto;
|
height: auto;
|
||||||
max-height: 100vh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 960px) {
|
@media (min-width: 960px) {
|
||||||
.layout {
|
.layout {
|
||||||
grid-template-columns: 2fr 1fr;
|
grid-template-columns: 1fr 2fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main {
|
.main {
|
||||||
@@ -420,7 +404,8 @@ defineOgImage({
|
|||||||
@media (min-width: 1280px) {
|
@media (min-width: 1280px) {
|
||||||
.sidebar {
|
.sidebar {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: calc(68px + 8px);
|
top: calc(var(--header-height) + 8px);
|
||||||
|
align-self: start;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
595
app/pages/realms/[slug].vue
Normal file
595
app/pages/realms/[slug].vue
Normal file
@@ -0,0 +1,595 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<!-- Invite Variant: Centered Card -->
|
||||||
|
<div v-if="isInviteMode">
|
||||||
|
<div
|
||||||
|
class="fixed inset-0 transition-all duration-500"
|
||||||
|
:style="pageStyle"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="relative flex items-center justify-center min-h-layout overflow-auto p-4"
|
||||||
|
>
|
||||||
|
<n-card
|
||||||
|
:class="[
|
||||||
|
'w-full',
|
||||||
|
'max-w-[480px]',
|
||||||
|
{ 'backdrop-blur-2xl': realmBackground },
|
||||||
|
{ 'shadow-xl': realmBackground }
|
||||||
|
]"
|
||||||
|
size="large"
|
||||||
|
:style="
|
||||||
|
realmBackground ? 'background-color: rgba(255, 255, 255, 0.1)' : ''
|
||||||
|
"
|
||||||
|
:content-style="
|
||||||
|
realmBackground ? 'background-color: transparent' : ''
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<div v-if="realm" class="p-4">
|
||||||
|
<div class="flex flex-col items-center text-center">
|
||||||
|
<n-avatar :src="realmPicture" :size="80" class="mb-4">
|
||||||
|
<n-icon v-if="!realmPicture" :component="Users" :size="40" />
|
||||||
|
</n-avatar>
|
||||||
|
|
||||||
|
<div class="flex gap-2 items-center">
|
||||||
|
<h2 class="text-2xl font-bold mb-2">{{ realm.name }}</h2>
|
||||||
|
<verification-mark
|
||||||
|
v-if="realm.verification"
|
||||||
|
:mark="realm.verification"
|
||||||
|
:size="20"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<p v-if="realm.description" class="text-base mb-4 opacity-80">
|
||||||
|
{{ realm.description }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="flex gap-2 mb-6">
|
||||||
|
<n-tag :bordered="false" type="info">
|
||||||
|
{{ realm.isCommunity ? "Community" : "Organization" }}
|
||||||
|
</n-tag>
|
||||||
|
<n-tag
|
||||||
|
:bordered="false"
|
||||||
|
:type="realm.isPublic ? 'success' : 'warning'"
|
||||||
|
>
|
||||||
|
{{ realm.isPublic ? "Public" : "Private" }}
|
||||||
|
</n-tag>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<n-card
|
||||||
|
v-if="realm.verification"
|
||||||
|
class="text-left mb-4 w-full"
|
||||||
|
:style="
|
||||||
|
realmBackground
|
||||||
|
? 'background-color: rgba(255, 255, 255, 0.1)'
|
||||||
|
: ''
|
||||||
|
"
|
||||||
|
:content-style="
|
||||||
|
realmBackground ? 'background-color: transparent' : ''
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<verification-status-card :mark="realm.verification" />
|
||||||
|
</n-card>
|
||||||
|
|
||||||
|
<n-button
|
||||||
|
text-color="white"
|
||||||
|
type="primary"
|
||||||
|
block
|
||||||
|
size="large"
|
||||||
|
:loading="isJoining"
|
||||||
|
:disabled="isMember"
|
||||||
|
@click="handleJoin"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<n-icon :component="UserPlus" />
|
||||||
|
</template>
|
||||||
|
Join Realm
|
||||||
|
</n-button>
|
||||||
|
|
||||||
|
<n-alert
|
||||||
|
v-if="isMember"
|
||||||
|
type="info"
|
||||||
|
title="Already Joined"
|
||||||
|
class="mt-4"
|
||||||
|
>
|
||||||
|
You already joined this realm,
|
||||||
|
<nuxt-link
|
||||||
|
:to="`/realms/${route.params.slug}`"
|
||||||
|
class="underline font-bold"
|
||||||
|
>
|
||||||
|
go to the realm page instead.
|
||||||
|
</nuxt-link>
|
||||||
|
</n-alert>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="notFound" class="flex justify-center p-8">
|
||||||
|
<n-empty description="Realm not found">
|
||||||
|
<template #icon>
|
||||||
|
<n-icon :component="Users" />
|
||||||
|
</template>
|
||||||
|
</n-empty>
|
||||||
|
</div>
|
||||||
|
<div v-else class="flex justify-center p-8">
|
||||||
|
<n-spin size="large" />
|
||||||
|
</div>
|
||||||
|
</n-card>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Regular View: Full Realm Page -->
|
||||||
|
<div v-else>
|
||||||
|
<div class="fixed inset-0 blur-md" :style="pageStyle" />
|
||||||
|
<img
|
||||||
|
:src="realmBackground"
|
||||||
|
class="w-full max-h-48 object-cover object-top"
|
||||||
|
:style="{ aspectRatio: '16/7', opacity: headerOpacity }"
|
||||||
|
/>
|
||||||
|
<div v-if="realm" class="relative min-h-layout">
|
||||||
|
<div class="container mx-auto p-4 sm:p-8">
|
||||||
|
<div class="layout">
|
||||||
|
<div class="sidebar flex flex-col gap-3">
|
||||||
|
<n-card
|
||||||
|
:class="cardClass"
|
||||||
|
:style="cardStyle"
|
||||||
|
:content-style="cardContentStyle"
|
||||||
|
>
|
||||||
|
<div class="flex items-center gap-4 mb-4">
|
||||||
|
<n-avatar size="large" round :src="realmPicture">
|
||||||
|
<n-icon
|
||||||
|
v-if="!realmPicture"
|
||||||
|
:component="Users"
|
||||||
|
:size="28"
|
||||||
|
/>
|
||||||
|
</n-avatar>
|
||||||
|
<div>
|
||||||
|
<div class="flex gap-2 items-center">
|
||||||
|
<div class="text-xl font-bold">
|
||||||
|
{{ realm.name }}
|
||||||
|
</div>
|
||||||
|
<verification-mark
|
||||||
|
v-if="realm.verification"
|
||||||
|
:mark="realm.verification"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-sm opacity-80">@{{ realm.slug }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p v-if="realm.description" class="text-sm mb-4">
|
||||||
|
{{ realm.description }}
|
||||||
|
</p>
|
||||||
|
<div class="flex flex-wrap gap-2">
|
||||||
|
<n-tag :bordered="false" type="info">
|
||||||
|
{{ realm.isCommunity ? "Community" : "Organization" }}
|
||||||
|
</n-tag>
|
||||||
|
<n-tag
|
||||||
|
:bordered="false"
|
||||||
|
:type="realm.isPublic ? 'success' : 'warning'"
|
||||||
|
>
|
||||||
|
{{ realm.isPublic ? "Public" : "Private" }}
|
||||||
|
</n-tag>
|
||||||
|
</div>
|
||||||
|
</n-card>
|
||||||
|
|
||||||
|
<n-card
|
||||||
|
v-if="realm.verification"
|
||||||
|
:class="cardClass"
|
||||||
|
:style="cardStyle"
|
||||||
|
:content-style="cardContentStyle"
|
||||||
|
>
|
||||||
|
<verification-status-card :mark="realm.verification" />
|
||||||
|
</n-card>
|
||||||
|
|
||||||
|
<div v-if="realm.isPublic && !isMember">
|
||||||
|
<n-button
|
||||||
|
type="primary"
|
||||||
|
block
|
||||||
|
size="large"
|
||||||
|
:loading="isJoining"
|
||||||
|
@click="handleJoin"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<n-icon :component="UserPlus" />
|
||||||
|
</template>
|
||||||
|
Join Realm
|
||||||
|
</n-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="main">
|
||||||
|
<!-- Filter Section -->
|
||||||
|
<n-card
|
||||||
|
class="mb-4"
|
||||||
|
:class="cardClass"
|
||||||
|
:style="cardStyle"
|
||||||
|
:content-style="cardContentStyle"
|
||||||
|
>
|
||||||
|
<n-tabs v-model:value="activeCategoryTab" type="segment">
|
||||||
|
<n-tab name="all">All</n-tab>
|
||||||
|
<n-tab name="posts">Posts</n-tab>
|
||||||
|
<n-tab name="articles">Articles</n-tab>
|
||||||
|
</n-tabs>
|
||||||
|
|
||||||
|
<div class="mx-4">
|
||||||
|
<div
|
||||||
|
class="grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-2 mt-4"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="flex items-center gap-2 cursor-pointer"
|
||||||
|
@click="cycleIncludeReplies"
|
||||||
|
>
|
||||||
|
<n-icon :component="Reply" />
|
||||||
|
<n-checkbox
|
||||||
|
:checked="includeReplies !== false"
|
||||||
|
:indeterminate="includeReplies === null"
|
||||||
|
@update:checked="cycleIncludeReplies"
|
||||||
|
>
|
||||||
|
Include replies
|
||||||
|
</n-checkbox>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<n-icon :component="Paperclip" />
|
||||||
|
<n-checkbox v-model:checked="mediaOnly">
|
||||||
|
Media only
|
||||||
|
</n-checkbox>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<n-icon :component="ArrowUpDown" />
|
||||||
|
<n-checkbox v-model:checked="orderDesc">
|
||||||
|
Descending order
|
||||||
|
</n-checkbox>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="flex items-center cursor-pointer mt-4"
|
||||||
|
@click="showAdvancedFilters = !showAdvancedFilters"
|
||||||
|
>
|
||||||
|
<n-icon :component="Filter" />
|
||||||
|
<span class="ml-2 font-medium">Advanced filters</span>
|
||||||
|
<n-icon class="ml-auto">
|
||||||
|
<ChevronDown v-if="!showAdvancedFilters" />
|
||||||
|
<ChevronUp v-else />
|
||||||
|
</n-icon>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<n-collapse-transition :show="showAdvancedFilters">
|
||||||
|
<div class="mt-4 flex flex-col gap-3">
|
||||||
|
<n-input
|
||||||
|
v-model:value="queryTerm"
|
||||||
|
placeholder="Search posts"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<n-icon :component="Search" />
|
||||||
|
</template>
|
||||||
|
</n-input>
|
||||||
|
|
||||||
|
<n-config-provider
|
||||||
|
:theme-overrides="{ common: { borderRadius: '8px' } }"
|
||||||
|
>
|
||||||
|
<n-select
|
||||||
|
v-model:value="order"
|
||||||
|
placeholder="Sort by"
|
||||||
|
:options="[
|
||||||
|
{ label: 'Date', value: 'date' },
|
||||||
|
{ label: 'Popularity', value: 'popularity' }
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</n-config-provider>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
||||||
|
<n-date-picker
|
||||||
|
v-model:value="periodStart"
|
||||||
|
type="date"
|
||||||
|
placeholder="From date"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
<n-date-picker
|
||||||
|
v-model:value="periodEnd"
|
||||||
|
type="date"
|
||||||
|
placeholder="To date"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</n-collapse-transition>
|
||||||
|
</div>
|
||||||
|
</n-card>
|
||||||
|
|
||||||
|
<post-list :key="filterKey" :params="postListParams" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-else-if="notFound"
|
||||||
|
class="relative flex justify-center items-center h-full"
|
||||||
|
>
|
||||||
|
<n-empty description="The realm you're trying to access is not found.">
|
||||||
|
<template #icon>
|
||||||
|
<n-icon :component="Users" />
|
||||||
|
</template>
|
||||||
|
</n-empty>
|
||||||
|
</div>
|
||||||
|
<div v-else class="relative flex justify-center items-center h-full">
|
||||||
|
<n-spin size="large" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref, watch } from "vue"
|
||||||
|
import { useWindowScroll } from "@vueuse/core"
|
||||||
|
import { useMarkdownProcessor } from "~/composables/useMarkdownProcessor"
|
||||||
|
import type { SnRealm } from "~/types/api"
|
||||||
|
import type { PostListParams } from "~/composables/usePostList"
|
||||||
|
import PostList from "~/components/Post/PostList.vue"
|
||||||
|
import {
|
||||||
|
Reply,
|
||||||
|
Paperclip,
|
||||||
|
ArrowUpDown,
|
||||||
|
Filter,
|
||||||
|
Search,
|
||||||
|
ChevronDown,
|
||||||
|
ChevronUp,
|
||||||
|
Users,
|
||||||
|
UserPlus
|
||||||
|
} from "lucide-vue-next"
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
const message = useMessage()
|
||||||
|
const api = useSolarNetwork()
|
||||||
|
|
||||||
|
const notFound = ref<boolean>(false)
|
||||||
|
const realm = ref<SnRealm | null>(null)
|
||||||
|
const isJoining = ref(false)
|
||||||
|
const isMember = ref(false)
|
||||||
|
const checkingMembership = ref(false)
|
||||||
|
|
||||||
|
// Check if we're in invite mode
|
||||||
|
const isInviteMode = computed(() => {
|
||||||
|
return !!route.query.invite
|
||||||
|
})
|
||||||
|
|
||||||
|
// Use useFetch with the correct API URL to avoid router conflicts
|
||||||
|
const apiBase = useSolarNetworkUrl()
|
||||||
|
const apiBaseServer = useSolarNetworkUrl()
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { data, error } = await useFetch<SnRealm>(
|
||||||
|
`${apiBaseServer}/id/realms/${route.params.slug}`,
|
||||||
|
{ server: true }
|
||||||
|
)
|
||||||
|
|
||||||
|
if (error.value) {
|
||||||
|
console.error("Failed to fetch realm:", error.value)
|
||||||
|
notFound.value = true
|
||||||
|
} else if (data.value) {
|
||||||
|
realm.value = keysToCamel(data.value)
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Failed to fetch realm:", err)
|
||||||
|
notFound.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const realmBackground = computed(() => {
|
||||||
|
return realm.value?.background
|
||||||
|
? `${apiBase}/drive/files/${realm.value.background.id}?original=true`
|
||||||
|
: undefined
|
||||||
|
})
|
||||||
|
const realmPicture = computed(() => {
|
||||||
|
return realm.value?.picture
|
||||||
|
? `${apiBase}/drive/files/${realm.value.picture.id}`
|
||||||
|
: undefined
|
||||||
|
})
|
||||||
|
|
||||||
|
const { y: scrollY } = useWindowScroll()
|
||||||
|
const scrollThreshold = 192 // max-h-48 is 12rem = 192px
|
||||||
|
|
||||||
|
const backgroundOpacity = computed(() => {
|
||||||
|
return Math.max(0, Math.min(scrollY.value / scrollThreshold, 1))
|
||||||
|
})
|
||||||
|
|
||||||
|
const headerOpacity = computed(() => {
|
||||||
|
return 1 - backgroundOpacity.value
|
||||||
|
})
|
||||||
|
|
||||||
|
const pageStyle = computed(() => {
|
||||||
|
if (!realmBackground.value) return {}
|
||||||
|
return {
|
||||||
|
backgroundImage: `linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url('${realmBackground.value}')`,
|
||||||
|
backgroundSize: "cover",
|
||||||
|
backgroundPosition: "center",
|
||||||
|
backgroundRepeat: "no-repeat",
|
||||||
|
backgroundAttachment: "fixed",
|
||||||
|
opacity: isInviteMode.value ? 1 : backgroundOpacity.value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const cardClass = computed(() => ({
|
||||||
|
"backdrop-blur-2xl": !!realmBackground.value,
|
||||||
|
"shadow-xl": !!realmBackground.value
|
||||||
|
}))
|
||||||
|
|
||||||
|
const cardStyle = computed(() =>
|
||||||
|
realmBackground.value
|
||||||
|
? "background-color: var(--n-color-modal)"
|
||||||
|
: "background-color: var(--n-color)"
|
||||||
|
)
|
||||||
|
|
||||||
|
const cardContentStyle = computed(() =>
|
||||||
|
realmBackground.value ? "background-color: transparent" : ""
|
||||||
|
)
|
||||||
|
|
||||||
|
// Filter state
|
||||||
|
const activeCategoryTab = ref("all")
|
||||||
|
const includeReplies = ref<boolean | null>(null)
|
||||||
|
const mediaOnly = ref(false)
|
||||||
|
const orderDesc = ref(true)
|
||||||
|
const showAdvancedFilters = ref(false)
|
||||||
|
const queryTerm = ref("")
|
||||||
|
const order = ref<string | null>(null)
|
||||||
|
const periodStart = ref<number | null>(null)
|
||||||
|
const periodEnd = ref<number | null>(null)
|
||||||
|
|
||||||
|
const postListParams = computed<PostListParams>(() => {
|
||||||
|
const params: PostListParams = {
|
||||||
|
realm: route.params.slug as string,
|
||||||
|
includeReplies: includeReplies.value ?? undefined,
|
||||||
|
mediaOnly: mediaOnly.value,
|
||||||
|
orderDesc: orderDesc.value,
|
||||||
|
queryTerm: queryTerm.value || undefined,
|
||||||
|
order: order.value ?? undefined,
|
||||||
|
periodStart: periodStart.value
|
||||||
|
? Math.floor(periodStart.value / 1000)
|
||||||
|
: undefined,
|
||||||
|
periodEnd: periodEnd.value ? Math.floor(periodEnd.value / 1000) : undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activeCategoryTab.value === "posts") {
|
||||||
|
params.type = 0
|
||||||
|
} else if (activeCategoryTab.value === "articles") {
|
||||||
|
params.type = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
return params
|
||||||
|
})
|
||||||
|
|
||||||
|
const filterKey = computed(() => {
|
||||||
|
return JSON.stringify(postListParams.value)
|
||||||
|
})
|
||||||
|
|
||||||
|
const cycleIncludeReplies = () => {
|
||||||
|
if (includeReplies.value === null) {
|
||||||
|
includeReplies.value = true
|
||||||
|
} else if (includeReplies.value === true) {
|
||||||
|
includeReplies.value = false
|
||||||
|
} else {
|
||||||
|
includeReplies.value = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check membership status
|
||||||
|
async function checkMembership() {
|
||||||
|
if (!realm.value) return
|
||||||
|
|
||||||
|
checkingMembership.value = true
|
||||||
|
try {
|
||||||
|
await api(`/id/realms/${realm.value.slug}/members/me`, {
|
||||||
|
method: "GET"
|
||||||
|
})
|
||||||
|
isMember.value = true
|
||||||
|
} catch (err) {
|
||||||
|
// 404 means not a member
|
||||||
|
isMember.value = false
|
||||||
|
} finally {
|
||||||
|
checkingMembership.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle join realm
|
||||||
|
async function handleJoin() {
|
||||||
|
if (!realm.value) return
|
||||||
|
|
||||||
|
isJoining.value = true
|
||||||
|
try {
|
||||||
|
await api(`/id/realms/${realm.value.slug}/members/me`, {
|
||||||
|
method: "POST"
|
||||||
|
})
|
||||||
|
message.success(`Successfully joined ${realm.value.name}!`)
|
||||||
|
isMember.value = true
|
||||||
|
// Redirect to the realm page without invite query if in invite mode
|
||||||
|
if (isInviteMode.value) {
|
||||||
|
await navigateTo(`/realms/${realm.value.slug}`)
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
message.error(err instanceof Error ? err.message : String(err))
|
||||||
|
} finally {
|
||||||
|
isJoining.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check membership on mount
|
||||||
|
onMounted(() => {
|
||||||
|
if (realm.value) {
|
||||||
|
checkMembership()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
definePageMeta({
|
||||||
|
title: "Realms",
|
||||||
|
alias: ["/r/:slug()"]
|
||||||
|
})
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: computed(() => {
|
||||||
|
if (notFound.value) {
|
||||||
|
return "Realm not found"
|
||||||
|
}
|
||||||
|
if (realm.value) {
|
||||||
|
return realm.value.name
|
||||||
|
}
|
||||||
|
return "Loading realm..."
|
||||||
|
}),
|
||||||
|
meta: computed(() => {
|
||||||
|
if (realm.value) {
|
||||||
|
const description =
|
||||||
|
realm.value.description || `Join ${realm.value.name} on Solar Network.`
|
||||||
|
return [{ name: "description", content: description }]
|
||||||
|
}
|
||||||
|
return []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
defineOgImage({
|
||||||
|
component: "ImageCard",
|
||||||
|
// @ts-ignore
|
||||||
|
title: computed(() => (realm.value ? realm.value.name : "Realm")),
|
||||||
|
description: computed(() =>
|
||||||
|
realm.value
|
||||||
|
? realm.value.description || `Join ${realm.value.name} on Solar Network.`
|
||||||
|
: ""
|
||||||
|
),
|
||||||
|
avatarUrl: computed(() => realmPicture.value),
|
||||||
|
backgroundImage: computed(() => realmBackground.value)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.layout {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
order: 2;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
order: 1;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.layout {
|
||||||
|
grid-template-columns: 1fr 2fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
order: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
order: unset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 1280px) {
|
||||||
|
.sidebar {
|
||||||
|
position: sticky;
|
||||||
|
top: calc(var(--header-height) + 8px);
|
||||||
|
align-self: start;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,73 +1,21 @@
|
|||||||
<template>
|
|
||||||
<div class="d-flex align-center justify-center fill-height">
|
|
||||||
<v-card max-width="400" title="Magic Spell" prepend-icon="mdi-magic-staff" class="pa-2">
|
|
||||||
<v-card-text>
|
|
||||||
<v-alert v-if="done" type="success" class="mb-4">
|
|
||||||
The magic spell has been applied successfully. Now you can close this
|
|
||||||
tab and back to the Solar Network!
|
|
||||||
</v-alert>
|
|
||||||
<v-alert
|
|
||||||
v-else-if="!!error"
|
|
||||||
type="error"
|
|
||||||
title="Something went wrong"
|
|
||||||
class="mb-4"
|
|
||||||
>{{ error }}</v-alert
|
|
||||||
>
|
|
||||||
<div v-else-if="!!spell">
|
|
||||||
<p class="mb-2">
|
|
||||||
Magic spell for {{ spellTypes[spell.type] ?? "unknown" }}
|
|
||||||
</p>
|
|
||||||
<div class="d-flex align-center gap-2 mb-2">
|
|
||||||
<v-icon size="18">mdi-account-circle</v-icon>
|
|
||||||
<strong>@{{ spell.account.name }}</strong>
|
|
||||||
</div>
|
|
||||||
<div class="d-flex align-center gap-2 mb-2">
|
|
||||||
<v-icon size="18">mdi-play</v-icon>
|
|
||||||
<span>Available at</span>
|
|
||||||
<strong>{{
|
|
||||||
new Date(spell.createdAt ?? spell.affectedAt).toLocaleString()
|
|
||||||
}}</strong>
|
|
||||||
</div>
|
|
||||||
<div v-if="spell.expiredAt" class="d-flex align-center gap-2 mb-4">
|
|
||||||
<v-icon size="18">mdi-calendar</v-icon>
|
|
||||||
<span>Until</span>
|
|
||||||
<strong>{{ spell.expiredAt.toString() }}</strong>
|
|
||||||
</div>
|
|
||||||
<div class="mt-4">
|
|
||||||
<v-text-field
|
|
||||||
v-if="spell.type == 3"
|
|
||||||
v-model="newPassword"
|
|
||||||
label="New password"
|
|
||||||
type="password"
|
|
||||||
density="comfortable"
|
|
||||||
></v-text-field>
|
|
||||||
<v-btn color="primary" :loading="submitting" @click="applySpell">
|
|
||||||
<v-icon left>mdi-check</v-icon>
|
|
||||||
Apply
|
|
||||||
</v-btn>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<v-progress-circular
|
|
||||||
v-else
|
|
||||||
indeterminate
|
|
||||||
size="32"
|
|
||||||
class="mt-4"
|
|
||||||
></v-progress-circular>
|
|
||||||
</v-card-text>
|
|
||||||
</v-card>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, ref } from "vue"
|
import { onMounted, ref } from "vue"
|
||||||
import { useRoute } from "vue-router"
|
import { useRoute } from "vue-router"
|
||||||
|
import { Wand2, User, Clock, Calendar, Check } from "lucide-vue-next"
|
||||||
|
import { useSolarNetwork } from "~/composables/useSolarNetwork"
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
const api = useSolarNetwork()
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: "Magic Spell"
|
||||||
|
})
|
||||||
|
|
||||||
const spellWord: string =
|
const spellWord: string =
|
||||||
typeof route.params.word === "string"
|
typeof route.params.word === "string"
|
||||||
? route.params.word
|
? route.params.word
|
||||||
: route.params.word?.join("/") || ""
|
: route.params.word?.join("/") || ""
|
||||||
|
|
||||||
interface SnSpell {
|
interface SnSpell {
|
||||||
type: number
|
type: number
|
||||||
account: {
|
account: {
|
||||||
@@ -77,13 +25,13 @@ interface SnSpell {
|
|||||||
affectedAt: string
|
affectedAt: string
|
||||||
expiredAt?: string
|
expiredAt?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const spell = ref<SnSpell | null>(null)
|
const spell = ref<SnSpell | null>(null)
|
||||||
const error = ref<string | null>(null)
|
const error = ref<string | null>(null)
|
||||||
|
|
||||||
const newPassword = ref<string>()
|
const newPassword = ref<string>()
|
||||||
|
|
||||||
const submitting = ref(false)
|
const submitting = ref(false)
|
||||||
const done = ref(false)
|
const done = ref(false)
|
||||||
|
const loading = ref(true)
|
||||||
|
|
||||||
const spellTypes = [
|
const spellTypes = [
|
||||||
"Account Activation",
|
"Account Activation",
|
||||||
@@ -93,14 +41,17 @@ const spellTypes = [
|
|||||||
"Contact Method Verification"
|
"Contact Method Verification"
|
||||||
]
|
]
|
||||||
|
|
||||||
const api = useSolarNetwork()
|
|
||||||
|
|
||||||
async function fetchSpell() {
|
async function fetchSpell() {
|
||||||
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const resp = await api(`/id/spells/${encodeURIComponent(spellWord)}`)
|
const resp = await api<SnSpell>(
|
||||||
|
`/id/spells/${encodeURIComponent(spellWord)}`
|
||||||
|
)
|
||||||
spell.value = resp
|
spell.value = resp
|
||||||
} catch (err: unknown) {
|
} catch (err: unknown) {
|
||||||
error.value = err instanceof Error ? err.message : String(err)
|
error.value = err instanceof Error ? err.message : String(err)
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,8 +68,114 @@ async function applySpell() {
|
|||||||
done.value = true
|
done.value = true
|
||||||
} catch (err: unknown) {
|
} catch (err: unknown) {
|
||||||
error.value = err instanceof Error ? err.message : String(err)
|
error.value = err instanceof Error ? err.message : String(err)
|
||||||
|
} finally {
|
||||||
|
submitting.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => fetchSpell())
|
onMounted(() => fetchSpell())
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="relative flex items-center justify-center min-h-layout px-4">
|
||||||
|
<n-card class="w-full max-w-md shadow-lg" size="large">
|
||||||
|
<div v-if="done" class="py-4">
|
||||||
|
<n-result
|
||||||
|
status="success"
|
||||||
|
title="Spell Applied"
|
||||||
|
description="The magic spell has been applied successfully. Now you can close this tab and return to the Solar Network!"
|
||||||
|
>
|
||||||
|
</n-result>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="error">
|
||||||
|
<n-alert title="Something went wrong" type="error" class="mb-4">
|
||||||
|
{{ error }}
|
||||||
|
</n-alert>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="loading" class="flex justify-center py-12">
|
||||||
|
<n-spin size="large" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="spell" class="flex flex-col gap-6">
|
||||||
|
<!-- Header -->
|
||||||
|
<div
|
||||||
|
class="flex items-center gap-3 pb-4 border-b border-gray-100 dark:border-gray-800"
|
||||||
|
>
|
||||||
|
<div class="p-2 bg-amber-100 dark:bg-amber-900/30 rounded-lg">
|
||||||
|
<n-icon :component="Wand2" class="text-amber-500" :size="24" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h2 class="text-xl font-bold">Magic Spell</h2>
|
||||||
|
<p class="text-sm text-gray-500">
|
||||||
|
{{ spellTypes[spell.type] ?? "Unknown Spell" }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Details -->
|
||||||
|
<div class="space-y-4">
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
|
<n-icon :component="User" class="text-gray-400" :size="20" />
|
||||||
|
<div class="flex flex-col">
|
||||||
|
<span class="text-xs text-gray-500 uppercase tracking-wider"
|
||||||
|
>Account</span
|
||||||
|
>
|
||||||
|
<span class="font-medium">@{{ spell.account.name }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
|
<n-icon :component="Clock" class="text-gray-400" :size="20" />
|
||||||
|
<div class="flex flex-col">
|
||||||
|
<span class="text-xs text-gray-500 uppercase tracking-wider"
|
||||||
|
>Available at</span
|
||||||
|
>
|
||||||
|
<span class="font-medium">{{
|
||||||
|
new Date(spell.createdAt ?? spell.affectedAt).toLocaleString()
|
||||||
|
}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="spell.expiredAt" class="flex items-center gap-3">
|
||||||
|
<n-icon :component="Calendar" class="text-gray-400" :size="20" />
|
||||||
|
<div class="flex flex-col">
|
||||||
|
<span class="text-xs text-gray-500 uppercase tracking-wider"
|
||||||
|
>Expires</span
|
||||||
|
>
|
||||||
|
<span class="font-medium">{{
|
||||||
|
new Date(spell.expiredAt).toLocaleString()
|
||||||
|
}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Action -->
|
||||||
|
<div class="mt-2 space-y-4">
|
||||||
|
<n-input
|
||||||
|
v-if="spell.type == 3"
|
||||||
|
v-model:value="newPassword"
|
||||||
|
type="password"
|
||||||
|
show-password-on="click"
|
||||||
|
placeholder="New password"
|
||||||
|
size="large"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<n-button
|
||||||
|
type="primary"
|
||||||
|
class="w-full"
|
||||||
|
size="large"
|
||||||
|
:loading="submitting"
|
||||||
|
@click="applySpell"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<n-icon :component="Check" />
|
||||||
|
</template>
|
||||||
|
Apply Spell
|
||||||
|
</n-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</n-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|||||||
@@ -5,7 +5,17 @@ export default defineNuxtPlugin(() => {
|
|||||||
console.log(`[AUTH PLUGIN] Running on ${side}`)
|
console.log(`[AUTH PLUGIN] Running on ${side}`)
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
// Prevent fetching if it's already in progress
|
// Fix hydration mismatch: if isLoading is true on client, it's likely a stale state
|
||||||
|
// from SSR where the fetch didn't complete before the response was sent.
|
||||||
|
// Reset it to allow the client to fetch properly.
|
||||||
|
if (import.meta.client && userStore.isLoading) {
|
||||||
|
console.log(
|
||||||
|
`[AUTH PLUGIN] Detected stale isLoading state on ${side}. Resetting to allow fetch.`
|
||||||
|
)
|
||||||
|
userStore.isLoading = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prevent fetching if it's already in progress (server-side only now)
|
||||||
if (userStore.isLoading) {
|
if (userStore.isLoading) {
|
||||||
console.log(
|
console.log(
|
||||||
`[AUTH PLUGIN] User fetch already in progress on ${side}. Skipping.`
|
`[AUTH PLUGIN] User fetch already in progress on ${side}. Skipping.`
|
||||||
@@ -21,4 +31,3 @@ export default defineNuxtPlugin(() => {
|
|||||||
userStore.fetchUser()
|
userStore.fetchUser()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ export const useUserStore = defineStore("user", () => {
|
|||||||
// Actions
|
// Actions
|
||||||
async function fetchUser(reload = true): Promise<void> {
|
async function fetchUser(reload = true): Promise<void> {
|
||||||
if (currentFetchPromise.value) {
|
if (currentFetchPromise.value) {
|
||||||
console.log("[UserStore] Fetch already in progress. Waiting for existing fetch.")
|
console.log(
|
||||||
|
"[UserStore] Fetch already in progress. Waiting for existing fetch."
|
||||||
|
)
|
||||||
return currentFetchPromise.value
|
return currentFetchPromise.value
|
||||||
}
|
}
|
||||||
if (!reload && user.value) {
|
if (!reload && user.value) {
|
||||||
@@ -37,10 +39,18 @@ export const useUserStore = defineStore("user", () => {
|
|||||||
console.log(`[UserStore] Logged in as @${user.value.name}`)
|
console.log(`[UserStore] Logged in as @${user.value.name}`)
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
// Check for 401 Unauthorized error
|
// Check for 401 Unauthorized error
|
||||||
const is401Error = (e instanceof FetchError && e.statusCode === 401) ||
|
const is401Error =
|
||||||
(e && typeof e === 'object' && 'status' in e && (e as { status: number }).status === 401) ||
|
(e instanceof FetchError && e.statusCode === 401) ||
|
||||||
(e && typeof e === 'object' && 'statusCode' in e && (e as { statusCode: number }).statusCode === 401) ||
|
(e &&
|
||||||
(e instanceof Error && (e.message?.includes('401') || e.message?.includes('Unauthorized')))
|
typeof e === "object" &&
|
||||||
|
"status" in e &&
|
||||||
|
(e as { status: number }).status === 401) ||
|
||||||
|
(e &&
|
||||||
|
typeof e === "object" &&
|
||||||
|
"statusCode" in e &&
|
||||||
|
(e as { statusCode: number }).statusCode === 401) ||
|
||||||
|
(e instanceof Error &&
|
||||||
|
(e.message?.includes("401") || e.message?.includes("Unauthorized")))
|
||||||
|
|
||||||
if (is401Error) {
|
if (is401Error) {
|
||||||
error.value = "Unauthorized"
|
error.value = "Unauthorized"
|
||||||
@@ -50,6 +60,8 @@ export const useUserStore = defineStore("user", () => {
|
|||||||
user.value = null // Clear user data on error
|
user.value = null // Clear user data on error
|
||||||
console.error("Failed to fetch user... ", e)
|
console.error("Failed to fetch user... ", e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// console.log(`[UserStore] Logged as @${user.value!.name}`)
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
currentFetchPromise.value = null
|
currentFetchPromise.value = null
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
// Re-export all types from separate files for easy importing
|
// Re-export all types from separate files for easy importing
|
||||||
export type { SnFileMeta, SnCloudFile as SnAttachment, SnPost } from './post'
|
export * from "./post"
|
||||||
export type { SnVerification, SnPublisher } from './publisher'
|
export * from "./publisher"
|
||||||
export type { SnActivity } from './activity'
|
export * from "./activity"
|
||||||
export type { SnWalletOrder, OrderStatus } from './order'
|
export * from "./order"
|
||||||
export type { SnVersion } from './version'
|
export * from "./version"
|
||||||
export type { SnAccountLink, SnAccountBadge, SnAccountPerkSubscription, SnAccountProfile, SnAccount } from './user'
|
export * from "./user"
|
||||||
export type { GeoIpLocation, SnAuthChallenge, SnAuthSession, SnAuthFactor, SnAccountConnection } from './geo'
|
export * from "./geo"
|
||||||
|
export * from "./realm"
|
||||||
|
|||||||
19
app/types/api/realm.ts
Normal file
19
app/types/api/realm.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import type { SnCloudFile } from "./post"
|
||||||
|
import type { SnVerification as SnVerificationMark } from "./publisher"
|
||||||
|
|
||||||
|
export interface SnRealm {
|
||||||
|
id: string
|
||||||
|
slug: string
|
||||||
|
name: string
|
||||||
|
description?: string
|
||||||
|
isCommunity: boolean
|
||||||
|
isPublic: boolean
|
||||||
|
picture?: SnCloudFile
|
||||||
|
background?: SnCloudFile
|
||||||
|
verification?: SnVerificationMark
|
||||||
|
accountId: string
|
||||||
|
resourceIdentifier: string
|
||||||
|
createdAt: Date
|
||||||
|
updatedAt: Date
|
||||||
|
deletedAt?: Date
|
||||||
|
}
|
||||||
15
docker-compose.yml
Normal file
15
docker-compose.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
services:
|
||||||
|
app:
|
||||||
|
# This will build the Dockerfile in the current directory.
|
||||||
|
# Alternatively, you can specify the image from a registry.
|
||||||
|
# Replace 'your-github-username' with your actual GitHub username or organization.
|
||||||
|
image: ghcr.io/solsynth/floating-island:latest
|
||||||
|
build: .
|
||||||
|
# This maps the .env file from your project root into the container.
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
# This maps port 3000 on your host to port 3000 in the container.
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
# This ensures the container restarts automatically unless it's stopped manually.
|
||||||
|
restart: unless-stopped
|
||||||
@@ -58,7 +58,8 @@ export default defineNuxtConfig({
|
|||||||
public: {
|
public: {
|
||||||
development: process.env.NODE_ENV == "development",
|
development: process.env.NODE_ENV == "development",
|
||||||
apiBase: process.env.NUXT_PUBLIC_API_BASE || "https://api.solian.app",
|
apiBase: process.env.NUXT_PUBLIC_API_BASE || "https://api.solian.app",
|
||||||
siteUrl: process.env.NUXT_PUBLIC_SITE_URL || "https://solian.app"
|
siteUrl: process.env.NUXT_PUBLIC_SITE_URL || "https://solian.app",
|
||||||
|
devToken: process.env.NUXT_PUBLIC_DEV_TOKEN || ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
vite: {
|
vite: {
|
||||||
@@ -82,6 +83,8 @@ export default defineNuxtConfig({
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
naiveui: {
|
naiveui: {
|
||||||
|
colorModePreference: "system",
|
||||||
|
colorModePreferenceCookieName: "fi-ColorMode",
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
...generateTailwindColorThemes(),
|
...generateTailwindColorThemes(),
|
||||||
shared: {
|
shared: {
|
||||||
@@ -94,6 +97,21 @@ export default defineNuxtConfig({
|
|||||||
primaryColorSuppl: "#4C5EC5FF",
|
primaryColorSuppl: "#4C5EC5FF",
|
||||||
borderRadius: "16px",
|
borderRadius: "16px",
|
||||||
borderRadiusSmall: "8px"
|
borderRadiusSmall: "8px"
|
||||||
|
},
|
||||||
|
Input: {
|
||||||
|
borderRadius: "8px"
|
||||||
|
},
|
||||||
|
Select: {
|
||||||
|
borderRadius: "8px"
|
||||||
|
},
|
||||||
|
Dropdown: {
|
||||||
|
borderRadius: "8px"
|
||||||
|
},
|
||||||
|
Button: {
|
||||||
|
borderRadius: "8px",
|
||||||
|
borderRadiusLarge: "12px",
|
||||||
|
borderRadiusMedium: "8px",
|
||||||
|
borderRadiusSmall: "4px"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
light: {},
|
light: {},
|
||||||
|
|||||||
@@ -49,6 +49,8 @@
|
|||||||
"@types/node": "^24.10.1",
|
"@types/node": "^24.10.1",
|
||||||
"daisyui": "^5.5.5",
|
"daisyui": "^5.5.5",
|
||||||
"naive-ui": "^2.43.2",
|
"naive-ui": "^2.43.2",
|
||||||
"tailwindcss": "^4.1.17"
|
"tailwindcss": "^4.1.17",
|
||||||
|
"unplugin-auto-import": "^20.3.0",
|
||||||
|
"unplugin-vue-components": "^30.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user