Skip to content

Commit 4350e53

Browse files
authored
feat(manage): add CAS time dashboard on activity record (#636)
* deps(pnpm): update dependencies * fix(eslint): format code style * feat(manage): add CAS time dashboard on activity record * docs: add changeset
1 parent 3c50345 commit 4350e53

File tree

23 files changed

+8203
-10840
lines changed

23 files changed

+8203
-10840
lines changed

.changeset/slow-melons-jog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"enspire": minor
3+
---
4+
5+
Added a CAS time dashboard to the Activity Record, allowing for display of individual, combined, and total sums across all records.

.github/workflows/on-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
uses: actions/setup-node@v4
2424
with:
2525
node-version: 20
26-
cache: 'pnpm'
26+
cache: pnpm
2727
- name: Install dependencies
2828
run: pnpm install
2929
- name: Apply all pending migrations to the database

.github/workflows/on-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
uses: actions/setup-node@v4
3232
with:
3333
node-version: 20
34-
cache: 'pnpm'
34+
cache: pnpm
3535
- name: Install dependencies
3636
run: pnpm install
3737
- name: Apply all pending migrations to the database

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ dist: jammy
66
cache:
77
npm: false
88
directories:
9-
- "~/.pnpm-store"
10-
9+
- ~/.pnpm-store
10+
1111
before_install:
1212
- corepack enable
1313
- corepack prepare pnpm@latest-9 --activate
1414
- pnpm config set store-dir ~/.pnpm-store
15-
15+
1616
install:
1717
- pnpm install
1818

components/custom/CAS/Record/ViewMyActivityRecords.vue

Lines changed: 76 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
<script setup lang="ts">
22
import type { Ref } from 'vue'
3-
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
3+
import {
4+
Card,
5+
CardContent,
6+
CardDescription,
7+
CardHeader,
8+
CardTitle,
9+
} from '@/components/ui/card'
410
import {
511
Select,
612
SelectContent,
@@ -48,13 +54,33 @@ async function onRefresh() {
4854
isLoading.value = false
4955
}
5056
51-
watch(() => props.refreshWatcher, () => {
52-
onRefresh()
53-
})
57+
watch(
58+
() => props.refreshWatcher,
59+
() => {
60+
onRefresh()
61+
},
62+
)
5463
5564
watch(selectedClub, async () => {
5665
await onRefresh()
5766
})
67+
68+
// Computed properties to calculate total CAS times
69+
const totalCTime = computed(() => {
70+
return data.value?.data.reduce((sum, record) => sum + record.cTime, 0) || 0
71+
})
72+
73+
const totalATime = computed(() => {
74+
return data.value?.data.reduce((sum, record) => sum + record.aTime, 0) || 0
75+
})
76+
77+
const totalSTime = computed(() => {
78+
return data.value?.data.reduce((sum, record) => sum + record.sTime, 0) || 0
79+
})
80+
81+
const totalCASTime = computed(() => {
82+
return totalCTime.value + totalATime.value + totalSTime.value
83+
})
5884
</script>
5985

6086
<template>
@@ -76,18 +102,60 @@ watch(selectedClub, async () => {
76102
<SelectGroup>
77103
<SelectItem
78104
v-for="club in [...clubs.vice, ...clubs.president]"
79-
:key="club.id" :value="String(club.id)"
105+
:key="club.id"
106+
:value="String(club.id)"
80107
>
81108
{{ club.name.zh }}
82109
</SelectItem>
83110
</SelectGroup>
84111
</SelectContent>
85112
</Select>
86-
<Button size="icon" variant="outline" :disabled="isLoading || !selectedClub" @click="onRefresh()">
87-
<Icon name="material-symbols:refresh" :class="{ 'animate-spin': isLoading }" />
113+
<Button
114+
size="icon"
115+
variant="outline"
116+
:disabled="isLoading || !selectedClub"
117+
@click="onRefresh()"
118+
>
119+
<Icon
120+
name="material-symbols:refresh"
121+
:class="{ 'animate-spin': isLoading }"
122+
/>
88123
</Button>
89124
</div>
90-
<DataTable v-if="data && selectedClub" :columns="columns" :data="data.data" :refresh-function="refresh" />
125+
<div v-if="selectedClub" class="mb-4 text-sm">
126+
<div class="rounded border p-2 mt-1 flex justify-between">
127+
<div class="flex items-center space-x-0.5">
128+
<p class="font-bold">
129+
C:
130+
</p>
131+
<div>{{ totalCTime }} 小时</div>
132+
</div>
133+
<div class="flex items-center space-x-0.5">
134+
<p class="font-bold">
135+
A:
136+
</p>
137+
<div>{{ totalATime }} 小时</div>
138+
</div>
139+
<div class="flex items-center space-x-0.5">
140+
<p class="font-bold">
141+
S:
142+
</p>
143+
<div>{{ totalSTime }} 小时</div>
144+
</div>
145+
<div class="flex items-center space-x-0.5">
146+
<p class="font-bold">
147+
Total:
148+
</p>
149+
<div>{{ totalCASTime }} 小时</div>
150+
</div>
151+
</div>
152+
</div>
153+
<DataTable
154+
v-if="data && selectedClub"
155+
:columns="columns"
156+
:data="data.data"
157+
:refresh-function="refresh"
158+
/>
91159
</CardContent>
92160
</Card>
93161
<Toaster />

components/custom/CAS/Record/view-activity-records/DataTable.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
TableRow,
1313
} from '@/components/ui/table'
1414
import { valueUpdater } from '@/lib/utils'
15-
1615
import {
1716
FlexRender,
1817
getCoreRowModel,

components/custom/club-card.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<script setup lang="ts">
22
import type { PropType } from 'vue'
3-
import type { Club } from '~/types/clubs'
3+
import Badge from '@/components/ui/badge/Badge.vue'
44
import { Button } from '@/components/ui/button'
55
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'
66
import { cn } from '@/lib/utils'
7-
import Badge from '@/components/ui/badge/Badge.vue'
87
import sanitizeHtml from 'sanitize-html'
8+
import type { Club } from '~/types/clubs'
99
1010
const props = defineProps({
1111
club: {

components/custom/sidebar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ if (import.meta.client) {
9292
</Button>
9393
</NuxtLink>
9494
<NuxtLink to="/manage/record">
95-
<Button v-if="isPresidentOrVicePresident" :variant="route.name === 'manage-record' ? 'secondary' : 'ghost'" class="w-full justify-start mt-1">
95+
<Button :variant="route.name === 'manage-record' ? 'secondary' : 'ghost'" class="w-full justify-start mt-1">
9696
<Icon class="mr-2 h-4 w-4" name="charm:tick-double" />
9797
活动签到
9898
</Button>

data/forms/forms.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
20240930_0001:
3-
title: "社团注册表"
4-
description: "提交社团注册表,如有多个社团可反复在此提交。"
5-
url: "https://wzvkx0jz.nocodb.com/#/nc/form/4b639cfb-a057-414f-b778-016c02309f32?embed"
6-
start_date: "2024-09-30"
7-
end_date: "2024-10-30"
3+
title: 社团注册表
4+
description: 提交社团注册表,如有多个社团可反复在此提交。
5+
url: 'https://wzvkx0jz.nocodb.com/#/nc/form/4b639cfb-a057-414f-b778-016c02309f32?embed'
6+
start_date: 2024-09-30
7+
end_date: 2024-10-30

db/migrations/migration_lock.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Please do not edit this file manually
22
# It should be added in your version-control system (i.e. Git)
3-
provider = "postgresql"
3+
provider = "postgresql"

layouts/sign-in-or-out.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
2-
import { useFavicon, usePreferredDark } from '@vueuse/core'
32
import IconLogo from '@/assets/logo.svg'
3+
import { useFavicon, usePreferredDark } from '@vueuse/core'
44
55
const isDark = usePreferredDark()
66
const favicon = computed(() => isDark.value ? '/favicon-dark.ico' : '/favicon.ico')

lib/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { type ClassValue, clsx } from 'clsx'
2-
import { twMerge } from 'tailwind-merge'
3-
41
import type { Updater } from '@tanstack/vue-table'
52
import type { Ref } from 'vue'
63

4+
import { type ClassValue, clsx } from 'clsx'
5+
import { twMerge } from 'tailwind-merge'
6+
77
export function cn(...inputs: ClassValue[]) {
88
return twMerge(clsx(inputs))
99
}

package.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,71 +16,71 @@
1616
"typecheck": "vue-tsc --noEmit --skipLibCheck"
1717
},
1818
"dependencies": {
19-
"@changesets/cli": "^2.27.8",
20-
"@clerk/clerk-sdk-node": "^5.0.46",
21-
"@clerk/themes": "^2.1.33",
19+
"@changesets/cli": "^2.27.9",
20+
"@clerk/clerk-sdk-node": "^5.0.52",
21+
"@clerk/themes": "^2.1.37",
2222
"@netlify/edge-functions": "^2.11.0",
2323
"@netlify/functions": "^2.8.2",
2424
"@netlify/integrations": "^0.5.4",
2525
"@netlify/sentry": "^0.0.10",
26-
"@nuxt/content": "^2.13.2",
26+
"@nuxt/content": "^2.13.4",
2727
"@radix-icons/vue": "^1.0.0",
28-
"@sentry/nuxt": "^8.32.0",
28+
"@sentry/nuxt": "^8.34.0",
2929
"@tanstack/vue-table": "^8.20.5",
3030
"@unovis/ts": "^1.4.4",
3131
"@unovis/vue": "^1.4.4",
32-
"@vee-validate/zod": "^4.13.2",
32+
"@vee-validate/zod": "^4.14.3",
3333
"@vite-pwa/nuxt": "^0.10.5",
3434
"@vueuse/core": "^11.1.0",
3535
"class-variance-authority": "^0.7.0",
3636
"clsx": "^2.1.1",
3737
"dotenv": "^16.4.5",
38-
"h3": "^1.12.0",
38+
"h3": "^1.13.0",
3939
"h3-clerk": "^0.4.12",
4040
"iron-webcrypto": "^1.2.1",
4141
"lucide-vue-next": "^0.441.0",
42-
"ofetch": "^1.4.0",
43-
"radix-vue": "^1.9.6",
44-
"sanitize-html": "^2.13.0",
45-
"tailwind-merge": "^2.5.2",
42+
"ofetch": "^1.4.1",
43+
"radix-vue": "^1.9.7",
44+
"sanitize-html": "^2.13.1",
45+
"tailwind-merge": "^2.5.4",
4646
"tailwindcss-animate": "^1.0.7",
4747
"uncrypto": "^0.1.3",
4848
"unstorage": "^1.12.0",
4949
"uuid": "^10.0.0",
5050
"v-calendar": "^3.1.2",
5151
"vaul-vue": "^0.2.0",
52-
"vee-validate": "^4.13.2",
53-
"vue-clerk": "^0.6.16",
54-
"yaml": "^2.5.1",
52+
"vee-validate": "^4.14.3",
53+
"vue-clerk": "^0.6.19",
54+
"yaml": "^2.6.0",
5555
"zod": "^3.23.8"
5656
},
5757
"devDependencies": {
58-
"@antfu/eslint-config": "^3.7.3",
58+
"@antfu/eslint-config": "^3.8.0",
5959
"@changesets/changelog-github": "^0.5.0",
60-
"@netlify/blobs": "^8.0.1",
60+
"@netlify/blobs": "^8.1.0",
6161
"@nuxt/fonts": "^0.8.0",
62-
"@nuxt/icon": "^1.5.2",
63-
"@nuxt/image": "^1.8.0",
62+
"@nuxt/icon": "^1.5.6",
63+
"@nuxt/image": "^1.8.1",
6464
"@nuxtjs/google-fonts": "^3.2.0",
65-
"@nuxtjs/tailwindcss": "^6.12.1",
66-
"@prisma/client": "^5.20.0",
65+
"@nuxtjs/tailwindcss": "^6.12.2",
66+
"@prisma/client": "^5.21.1",
6767
"@rollup/plugin-wasm": "^6.2.2",
6868
"@tailwindcss/typography": "^0.5.15",
6969
"@types/node-fetch": "^2.6.11",
7070
"@types/sanitize-html": "^2.13.0",
7171
"@types/uuid": "^10.0.0",
7272
"@types/ws": "^8.5.12",
7373
"dayjs-nuxt": "^2.1.11",
74-
"eslint": "^9.11.1",
74+
"eslint": "^9.13.0",
7575
"netlify": "^13.1.21",
7676
"nuxt": "^3.13.2",
7777
"nuxt-svgo": "^4.0.6",
78-
"prisma": "^5.20.0",
78+
"prisma": "^5.21.1",
7979
"shadcn-nuxt": "^0.10.4",
8080
"ts-node": "^10.9.2",
8181
"tsx": "^4.19.1",
82-
"typescript": "^5.6.2",
83-
"vue": "^3.5.10",
82+
"typescript": "^5.6.3",
83+
"vue": "^3.5.12",
8484
"vue-router": "4.4.5",
8585
"vue-tsc": "^2.1.6"
8686
},

pages/cas/clubs/[id].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script lang="ts" setup>
2-
import { useRoute } from 'vue-router'
32
import { Button } from '@/components/ui/button'
43
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
54
import sanitizeHtml from 'sanitize-html'
5+
import { useRoute } from 'vue-router'
66
import type { Club, Clubs } from '~/types/clubs'
77
88
const { data } = await useFetch<Clubs>('/api/club/all_details')

pages/cas/rating.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<script setup lang="ts">
2-
import { ref } from 'vue'
3-
import { useForm } from 'vee-validate'
4-
import { toTypedSchema } from '@vee-validate/zod'
5-
import * as z from 'zod'
6-
import { cn } from '~/lib/utils'
72
import { Button } from '@/components/ui/button'
83
import { Card, CardContent } from '@/components/ui/card'
4+
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue } from '@/components/ui/select'
95
import { Textarea } from '@/components/ui/textarea'
106
import { useToast } from '@/components/ui/toast/use-toast'
11-
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue } from '@/components/ui/select'
7+
import { toTypedSchema } from '@vee-validate/zod'
8+
import { useForm } from 'vee-validate'
9+
import { ref } from 'vue'
10+
import * as z from 'zod'
11+
import { cn } from '~/lib/utils'
1212
1313
const { toast } = useToast()
1414

pages/manage/manage.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script setup lang="ts">
2+
import Toaster from '@/components/ui/toast/Toaster.vue'
3+
import { useToast } from '@/components/ui/toast/use-toast'
24
import { LoaderCircle } from 'lucide-vue-next'
35
import { onMounted } from 'vue'
46
import { enums } from '~/components/custom/enum2str'
5-
import { useToast } from '@/components/ui/toast/use-toast'
6-
import Toaster from '@/components/ui/toast/Toaster.vue'
77
88
definePageMeta({
99
middleware: ['auth'],

pages/sign-in.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
2-
import { SignIn } from 'vue-clerk'
3-
import { usePreferredDark } from '@vueuse/core'
42
import { dark } from '@clerk/themes'
3+
import { usePreferredDark } from '@vueuse/core'
4+
import { SignIn } from 'vue-clerk'
55
66
const isDark = usePreferredDark()
77

0 commit comments

Comments
 (0)