Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: lint
Browse files Browse the repository at this point in the history
nexmoe committed Apr 24, 2024
1 parent f15ce80 commit 639f484
Showing 10 changed files with 139 additions and 129 deletions.
30 changes: 15 additions & 15 deletions components.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"$schema": "https://shadcn-vue.com/schema.json",
"style": "default",
"typescript": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "assets/css/tailwind.css",
"baseColor": "slate",
"cssVariables": true
},
"framework": "nuxt",
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
"$schema": "https://shadcn-vue.com/schema.json",
"style": "default",
"typescript": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "assets/css/tailwind.css",
"baseColor": "slate",
"cssVariables": true
},
"framework": "nuxt",
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
14 changes: 9 additions & 5 deletions components/flow/Index.vue
Original file line number Diff line number Diff line change
@@ -21,11 +21,15 @@ provide('flow', props.flow)
<div class="flow">
<FlowHeader v-if="props.header" :id="props.flow!.id" :title="props.flow!.title" :url="props.flow!.homepage" />

<div class="flow-body" :class="[
props.flow!.configCard === 'gallery' ? 'n-gallery' : 'n-grid',
]">
<NuxtLink v-for="(module) in props.flow!.module" :key="module.url" :title="module.title" :to="module.url"
target="_blank">
<div
class="flow-body" :class="[
props.flow!.configCard === 'gallery' ? 'n-gallery' : 'n-grid',
]"
>
<NuxtLink
v-for="(module) in props.flow!.module" :key="module.url" :title="module.title" :to="module.url"
target="_blank"
>
<ModuleList v-if="props.flow!.configCard === 'list'" v-bind="{ module }" />
<ModuleProject v-else-if="props.flow!.configCard === 'project'" v-bind="{ module }" />
<ModuleGallery v-else-if="props.flow!.configCard === 'gallery'" v-bind="{ module }" />
20 changes: 13 additions & 7 deletions components/module/Image.vue
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import type { AppRouter } from '@/server/trpc/routers'
type RouterOutput = inferRouterOutputs<AppRouter>
type ModuleOutput = RouterOutput['module']['get']
type FlowOutput = RouterOutput['flow']['get']
type Module = Exclude<ModuleOutput, null>;
type Module = Exclude<ModuleOutput, null>
interface Props {
module: Module
@@ -28,8 +28,10 @@ const text = computed(() => extractTextFromHTML(props.module.content))
</div>
</div>
<div v-if="props.module.image" class="shadow-sm max-h-96 rounded-xl relative overflow-hidden">
<NuxtImg class="w-full" format="webp" :src="props.module!.image" :alt="module.title"
referrerpolicy="no-referrer" loading="lazy" width="420px" />
<NuxtImg
class="w-full" format="webp" :src="props.module!.image" :alt="module.title"
referrerpolicy="no-referrer" loading="lazy" width="420px"
/>
</div>
</div>
<div class="space-y-4 px-3 pb-3">
@@ -39,11 +41,15 @@ const text = computed(() => extractTextFromHTML(props.module.content))
<div v-if="!flow?.configNoContent && text !== ' '" class="line-clamp-3">
<div v-html="text" />
</div>
<div v-if="!props.module.image || (props.module.platform?.length || 0) > 1"
class="flex flex-row items-center gap-1">
<div
v-if="!props.module.image || (props.module.platform?.length || 0) > 1"
class="flex flex-row items-center gap-1"
>
<template v-if="(props.module.platform?.length || 0) > 1">
<div v-for="platform in props.module.platform" :key="platform" class="w-7 h-7 block"
@click="navigateTo(platform, { open: { target: '_blank' }, external: true })">
<div
v-for="platform in props.module.platform" :key="platform" class="w-7 h-7 block"
@click="navigateTo(platform, { open: { target: '_blank' }, external: true })"
>
<LinkIcon :url="platform" />
</div>
</template>
2 changes: 1 addition & 1 deletion lib/utils.ts
Original file line number Diff line number Diff line change
@@ -2,5 +2,5 @@ import { type ClassValue, clsx } from 'clsx'
import { twMerge } from 'tailwind-merge'

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
return twMerge(clsx(inputs))
}
4 changes: 2 additions & 2 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ export default defineNuxtConfig({
'nuxt-icon',
'@nuxtjs/seo',
'@nuxtjs/tailwindcss',
'shadcn-nuxt'
'shadcn-nuxt',
],
shadcn: {
/**
@@ -31,7 +31,7 @@ export default defineNuxtConfig({
* Directory that the component lives in.
* @default "./components/ui"
*/
componentDir: './components/ui'
componentDir: './components/ui',
},
ogImage: {
googleFontMirror: true,
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -73,4 +73,4 @@
]
}
}
}
}
10 changes: 5 additions & 5 deletions server/flowing.ts
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ const prisma = new PrismaClient()
/**
* 计算两个字符串之间的Levenshtein距离。
* Levenshtein距离是一个字符串相似度的度量,表示从一个字符串转换成另一个字符串所需的最少编辑操作次数(插入、删除或替换字符)。
*
*
* @param a 字符串a,作为比较的基准。
* @param b 字符串b,与字符串a进行比较。
* @returns 两个字符串之间的Levenshtein距离,返回一个数字。
@@ -37,9 +37,9 @@ function levenshteinDistance(a: string, b: string): number {
// 计算当前字符替换、插入或删除的代价
const cost = a[i - 1] === b[j - 1] ? 0 : 1
matrix[i][j] = Math.min(
matrix[i - 1][j] + 1, // 插入操作
matrix[i][j - 1] + 1, // 删除操作
matrix[i - 1][j - 1] + cost, // 替换操作
matrix[i - 1][j] + 1, // 插入操作
matrix[i][j - 1] + 1, // 删除操作
matrix[i - 1][j - 1] + cost, // 替换操作
)
}
}
@@ -203,4 +203,4 @@ export async function flowingByFlowId(flowId: string) {
})
if (flow)
await flowingByFlow(flow)
}
}
18 changes: 9 additions & 9 deletions server/middleware/update-site-config.ts
Original file line number Diff line number Diff line change
@@ -2,14 +2,14 @@
import { appRouter } from '@/server/trpc/routers'

export default eventHandler(async (e) => {
const caller = appRouter.createCaller({ prisma: e.context.prisma })
const caller = appRouter.createCaller({ prisma: e.context.prisma })

const config = await caller.config.get()
// eslint-disable-next-line no-console
console.log(config.siteName)
// updateSiteConfig({
// name: config.siteName,
// description: config.siteDescription,
// url: config.siteUrl,
// })
const config = await caller.config.get()
// eslint-disable-next-line no-console
console.log(config.siteName)
// updateSiteConfig({
// name: config.siteName,
// description: config.siteDescription,
// url: config.siteUrl,
// })
})
166 changes: 83 additions & 83 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,86 +1,86 @@
const animate = require("tailwindcss-animate")
const animate = require('tailwindcss-animate')

/** @type {import('tailwindcss').Config} */
module.exports = {
darkMode: ["class"],
safelist: ["dark"],
prefix: "",
theme: {
container: {
center: true,
padding: "2rem",
screens: {
"2xl": "1400px",
},
},
extend: {
colors: {
border: "hsl(var(--border))",
input: "hsl(var(--input))",
ring: "hsl(var(--ring))",
background: "hsl(var(--background))",
foreground: "hsl(var(--foreground))",
primary: {
DEFAULT: "hsl(var(--primary))",
foreground: "hsl(var(--primary-foreground))",
},
secondary: {
DEFAULT: "hsl(var(--secondary))",
foreground: "hsl(var(--secondary-foreground))",
},
destructive: {
DEFAULT: "hsl(var(--destructive))",
foreground: "hsl(var(--destructive-foreground))",
},
muted: {
DEFAULT: "hsl(var(--muted))",
foreground: "hsl(var(--muted-foreground))",
},
accent: {
DEFAULT: "hsl(var(--accent))",
foreground: "hsl(var(--accent-foreground))",
},
popover: {
DEFAULT: "hsl(var(--popover))",
foreground: "hsl(var(--popover-foreground))",
},
card: {
DEFAULT: "hsl(var(--card))",
foreground: "hsl(var(--card-foreground))",
},
},
borderRadius: {
xl: "calc(var(--radius) + 4px)",
lg: "var(--radius)",
md: "calc(var(--radius) - 2px)",
sm: "calc(var(--radius) - 4px)",
},
keyframes: {
"accordion-down": {
from: { height: 0 },
to: { height: "var(--radix-accordion-content-height)" },
},
"accordion-up": {
from: { height: "var(--radix-accordion-content-height)" },
to: { height: 0 },
},
"collapsible-down": {
from: { height: 0 },
to: { height: 'var(--radix-collapsible-content-height)' },
},
"collapsible-up": {
from: { height: 'var(--radix-collapsible-content-height)' },
to: { height: 0 },
},
},
animation: {
"accordion-down": "accordion-down 0.2s ease-out",
"accordion-up": "accordion-up 0.2s ease-out",
"collapsible-down": "collapsible-down 0.2s ease-in-out",
"collapsible-up": "collapsible-up 0.2s ease-in-out",
},
},
},
plugins: [animate],
}
darkMode: ['class'],
safelist: ['dark'],
prefix: '',

theme: {
container: {
center: true,
padding: '2rem',
screens: {
'2xl': '1400px',
},
},
extend: {
colors: {
border: 'hsl(var(--border))',
input: 'hsl(var(--input))',
ring: 'hsl(var(--ring))',
background: 'hsl(var(--background))',
foreground: 'hsl(var(--foreground))',
primary: {
DEFAULT: 'hsl(var(--primary))',
foreground: 'hsl(var(--primary-foreground))',
},
secondary: {
DEFAULT: 'hsl(var(--secondary))',
foreground: 'hsl(var(--secondary-foreground))',
},
destructive: {
DEFAULT: 'hsl(var(--destructive))',
foreground: 'hsl(var(--destructive-foreground))',
},
muted: {
DEFAULT: 'hsl(var(--muted))',
foreground: 'hsl(var(--muted-foreground))',
},
accent: {
DEFAULT: 'hsl(var(--accent))',
foreground: 'hsl(var(--accent-foreground))',
},
popover: {
DEFAULT: 'hsl(var(--popover))',
foreground: 'hsl(var(--popover-foreground))',
},
card: {
DEFAULT: 'hsl(var(--card))',
foreground: 'hsl(var(--card-foreground))',
},
},
borderRadius: {
xl: 'calc(var(--radius) + 4px)',
lg: 'var(--radius)',
md: 'calc(var(--radius) - 2px)',
sm: 'calc(var(--radius) - 4px)',
},
keyframes: {
'accordion-down': {
from: { height: 0 },
to: { height: 'var(--radix-accordion-content-height)' },
},
'accordion-up': {
from: { height: 'var(--radix-accordion-content-height)' },
to: { height: 0 },
},
'collapsible-down': {
from: { height: 0 },
to: { height: 'var(--radix-collapsible-content-height)' },
},
'collapsible-up': {
from: { height: 'var(--radix-collapsible-content-height)' },
to: { height: 0 },
},
},
animation: {
'accordion-down': 'accordion-down 0.2s ease-out',
'accordion-up': 'accordion-up 0.2s ease-out',
'collapsible-down': 'collapsible-down 0.2s ease-in-out',
'collapsible-up': 'collapsible-up 0.2s ease-in-out',
},
},
},
plugins: [animate],
}
2 changes: 1 addition & 1 deletion utils/date.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import dayjs from 'dayjs'

export function formatDateTime(source: string | number) {
return dayjs(source).format('MMMM DD, YYYY');
return dayjs(source).format('MMMM DD, YYYY')
}

0 comments on commit 639f484

Please sign in to comment.