Skip to content

Commit

Permalink
feat(nuxt3): nuxtlabs ui
Browse files Browse the repository at this point in the history
  • Loading branch information
LarchLiu committed Jun 19, 2023
1 parent e884c14 commit ca8ab16
Show file tree
Hide file tree
Showing 10 changed files with 823 additions and 15 deletions.
780 changes: 779 additions & 1 deletion pnpm-lock.yaml

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions server/nuxt3/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default defineAppConfig({
ui: {
colors: ['green', 'red'],
notifications: {
position: 'top-10 right-0',
},
},
})
1 change: 1 addition & 0 deletions server/nuxt3/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<template>
<NuxtPage />
<UNotifications md:w-120 xl:w-120 />
</template>

<style>
Expand Down
5 changes: 5 additions & 0 deletions server/nuxt3/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ export default defineNuxtConfig({
'@vueuse/nuxt',
'@unocss/nuxt',
'@pinia/nuxt',
'@nuxthq/ui',
],
ui: {
safelistColors: ['green', 'red'],
icons: ['carbon', 'twemoji'],
},
css: [
'@unocss/reset/tailwind-compat.css',
],
Expand Down
1 change: 1 addition & 0 deletions server/nuxt3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@iconify-json/carbon": "^1.1.17",
"@iconify-json/twemoji": "^1.1.11",
"@nuxt/devtools": "^0.5.5",
"@nuxthq/ui": "^2.4.0",
"@pinia/nuxt": "^0.4.11",
"@unocss/eslint-config": "^0.52.7",
"@unocss/nuxt": "^0.52.7",
Expand Down
21 changes: 17 additions & 4 deletions server/nuxt3/pages/app-init.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { OutputConfig, ServerConfig } from '../composables/config'
const text = ref('')
const config = ref<ServerConfig<OutputConfig>>()
const toast = useToast()
const showUserIdInput = ref(false)
async function onInitClick() {
const decode = cryption.decode(text.value)
Expand All @@ -15,13 +16,25 @@ async function onInitClick() {
method: 'POST',
body: text.value, // config.value.app[appName],
})
if (error.value)
alert(errorMessage(error.value))
else
if (error.value) {
toast.add({
title: errorMessage(error.value),
color: 'red',
timeout: 2000,
icon: 'i-carbon-warning',
})
}
else {
showUserIdInput.value = true
}
}
else {
alert('Config code error')
toast.add({
title: 'Config code error',
color: 'red',
timeout: 2000,
icon: 'i-carbon-warning',
})
}
}
</script>
Expand Down
5 changes: 3 additions & 2 deletions server/nuxt3/pages/user-config.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { cryption } from '~/constants'
import type { OutUserConfig, ServerConfig } from '~/composables/config'
const route = useRoute()
const toast = useToast()
const { code } = route.query
const regex = /[A-Za-z]+[A-Z0-9][0-9]$/g
const decode = (code && code.length > 2 && regex.test(code as string)) ? cryption.decode(code as string) : ''
Expand All @@ -27,9 +28,9 @@ async function onChange(config: ServerConfig<OutUserConfig>) {
},
})
if (error.value)
alert(errorMessage(error.value))
toast.add({ title: errorMessage(error.value), color: 'red', timeout: 2000, icon: 'i-carbon-warning' })
else
alert('success')
toast.add({ title: 'success', color: 'green', timeout: 2000, icon: 'i-carbon-checkmark-outline' })
}
</script>

Expand Down
9 changes: 5 additions & 4 deletions server/nuxt3/server/api/telegram/save-web-info.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { WebInfoByApi } from '@stargram/core/webInfo'
import { WebInfo } from '@stargram/core/webInfo'
import { routes } from '@stargram/web-hub'
import { WebCard } from '@stargram/core/webCard'
import { SupabaseImageStorage } from '@stargram/core/storage/supabase'
import { OpenaiSummarizeContent } from '@stargram/core/llm/openai'
Expand All @@ -14,9 +15,9 @@ export default eventHandler(async (event) => {
const context = body.context as Context
const config = context.USER_CONFIG as UserConfig

const webInfo = new WebInfoByApi({
stargramHub: config.webInfo.api.stargramHub,
browserlessToken: config.webInfo.api.browserlessToken,
const webInfo = new WebInfo({
routes,
browserlessToken: config.webInfo.localFn.browserlessToken,
})

const imgStorage = new SupabaseImageStorage({
Expand Down
7 changes: 3 additions & 4 deletions server/nuxt3/stargram.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
}
},
"webInfo": {
"select": "api",
"select": "localFn",
"public": false,
"userConfig": true,
"config": {
"stargramHub": "https://stargram.cc",
"browserlessToken": ""
},
"fn": "WebInfoByApi",
"import": "import { WebInfoByApi } from '@stargram/core/webInfo'\n"
"fn": "WebInfo",
"import": "import { WebInfo } from '@stargram/core/webInfo'\nimport { routes } from '@stargram/web-hub'\n"
},
"webCard": {
"select": "localFn",
Expand Down
1 change: 1 addition & 0 deletions server/nuxt3/uno.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default defineConfig({
presetIcons({
scale: 1.2,
warn: true,
prefix: 'uno-',
}),
presetTypography(),
presetWebFonts({
Expand Down

1 comment on commit ca8ab16

@vercel
Copy link

@vercel vercel bot commented on ca8ab16 Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

star-nexus – ./

star-nexus-git-main-larchliu.vercel.app
star-nexus-larchliu.vercel.app
star-nexus.vercel.app

Please sign in to comment.