diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml
index 968c658..0d26edf 100644
--- a/.github/workflows/pr-check.yaml
+++ b/.github/workflows/pr-check.yaml
@@ -5,7 +5,7 @@ on:
branches:
- main
pull_request:
- types: ['opened', 'reopened', 'synchronize', 'ready_for_review']
+ types: ["opened", "reopened", "synchronize", "ready_for_review"]
concurrency:
# Allow only one workflow per any non-`main` branch.
@@ -18,8 +18,8 @@ env:
RUST_BACKTRACE: 1
jobs:
- tests:
- name: Run Clippy and tests
+ check-backend:
+ name: Run backend checks
runs-on: ubuntu-24.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
steps:
@@ -41,3 +41,28 @@ jobs:
- name: cargo test
run: cargo test
+ check-frontend:
+ name: Run frontend checks
+ runs-on: ubuntu-24.04
+ if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
+ defaults:
+ run:
+ working-directory: web
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v4
+ - name: Setup bun
+ uses: oven-sh/setup-bun@v2
+ with:
+ bun-version: latest
+ - name: Install dependencies
+ run: bun install --frozen-lockfile
+ - name: Cache dependencies
+ uses: actions/cache@v4
+ with:
+ path: ~/.bun/install/cache
+ key: ${{ runner.os }}-bun-${{ hashFiles('docs/bun.lockb') }}
+ restore-keys: |
+ ${{ runner.os }}-bun-
+ - name: Check Frontend
+ run: bun run lint
diff --git a/web/src/lib/components/app-sidebar.svelte b/web/src/lib/components/app-sidebar.svelte
index f4fedc7..13115f2 100644
--- a/web/src/lib/components/app-sidebar.svelte
+++ b/web/src/lib/components/app-sidebar.svelte
@@ -62,7 +62,7 @@
视频来源
diff --git a/web/src/lib/components/video-card.svelte b/web/src/lib/components/video-card.svelte
index 6c45ded..f5b6a3c 100644
--- a/web/src/lib/components/video-card.svelte
+++ b/web/src/lib/components/video-card.svelte
@@ -3,14 +3,12 @@
import { Card, CardContent, CardHeader, CardTitle } from '$lib/components/ui/card/index.js';
import { Button } from '$lib/components/ui/button/index.js';
import * as AlertDialog from '$lib/components/ui/alert-dialog/index.js';
- import type { ApiError, VideoInfo } from '$lib/types';
+ import type { VideoInfo } from '$lib/types';
import RotateCcwIcon from '@lucide/svelte/icons/rotate-ccw';
import InfoIcon from '@lucide/svelte/icons/info';
import UserIcon from '@lucide/svelte/icons/user';
import { goto } from '$app/navigation';
- import api from '$lib/api';
import * as Tooltip from '$lib/components/ui/tooltip/index.js';
- import { toast } from 'svelte-sonner';
export let video: VideoInfo;
export let showActions: boolean = true; // 控制是否显示操作按钮
diff --git a/web/src/lib/stores/filter.ts b/web/src/lib/stores/filter.ts
index 1e90edd..8d3c2c3 100644
--- a/web/src/lib/stores/filter.ts
+++ b/web/src/lib/stores/filter.ts
@@ -12,7 +12,7 @@ export interface AppState {
export const appStateStore = writable({
query: '',
currentPage: 0,
- videoSource: null,
+ videoSource: null
});
export const ToQuery = (state: AppState): string => {
@@ -41,36 +41,40 @@ export const setQuery = (query: string) => {
export const setVideoSourceFilter = (filter: { type: string; id: string }) => {
appStateStore.update((state) => ({
...state,
- videoSource: filter,
+ videoSource: filter
}));
};
export const clearVideoSourceFilter = () => {
appStateStore.update((state) => ({
...state,
- videoSource: null,
+ videoSource: null
}));
};
export const setCurrentPage = (page: number) => {
appStateStore.update((state) => ({
...state,
- currentPage: page,
+ currentPage: page
}));
};
export const resetCurrentPage = () => {
appStateStore.update((state) => ({
...state,
- currentPage: 0,
+ currentPage: 0
}));
};
-export const setAll = (query: string, currentPage: number, videoSource: { type: string; id: string } | null) => {
+export const setAll = (
+ query: string,
+ currentPage: number,
+ videoSource: { type: string; id: string } | null
+) => {
appStateStore.set({
query,
currentPage,
- videoSource,
+ videoSource
});
};
@@ -78,6 +82,6 @@ export const clearAll = () => {
appStateStore.set({
query: '',
currentPage: 0,
- videoSource: null,
+ videoSource: null
});
};
diff --git a/web/src/lib/types.ts b/web/src/lib/types.ts
index 086bc52..5bc773b 100644
--- a/web/src/lib/types.ts
+++ b/web/src/lib/types.ts
@@ -61,7 +61,7 @@ export interface VideoResponse {
// 重置视频响应类型
export interface ResetVideoResponse {
resetted: boolean;
- video: VideoInfo,
+ video: VideoInfo;
pages: PageInfo[];
}
diff --git a/web/src/routes/+page.svelte b/web/src/routes/+page.svelte
index 4234c0c..cb8c0bf 100644
--- a/web/src/routes/+page.svelte
+++ b/web/src/routes/+page.svelte
@@ -6,16 +6,11 @@
import * as AlertDialog from '$lib/components/ui/alert-dialog/index.js';
import RotateCcwIcon from '@lucide/svelte/icons/rotate-ccw';
import api from '$lib/api';
- import type {
- VideosResponse,
- VideoSourcesResponse,
- ApiError,
- ResetAllVideosResponse
- } from '$lib/types';
+ import type { VideosResponse, VideoSourcesResponse, ApiError } from '$lib/types';
import { onMount } from 'svelte';
import { page } from '$app/stores';
import { goto } from '$app/navigation';
- import { setVideoSources, videoSourceStore } from '$lib/stores/video-source';
+ import { videoSourceStore } from '$lib/stores/video-source';
import { VIDEO_SOURCES } from '$lib/consts';
import { setBreadcrumb } from '$lib/stores/breadcrumb';
import {
@@ -24,12 +19,9 @@
resetCurrentPage,
setAll,
setCurrentPage,
- setQuery,
- setVideoSourceFilter,
ToQuery
} from '$lib/stores/filter';
import { toast } from 'svelte-sonner';
- import { Title } from '$lib/components/ui/card';
const pageSize = 20;