Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: information page of specific club & autoclean HTML <script> <style> elements #494

Merged
merged 38 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e42ac12
feat: detail information of specific club
at-wr Mar 2, 2024
d399d27
style: make the code fit Lint style
at-wr Mar 2, 2024
10ca1f4
style: make the code fit Lint style (again)
at-wr Mar 2, 2024
d18f441
style: add trailing comma
at-wr Mar 2, 2024
68ff9a1
style: merge `filteredClubs` into 2 lines
at-wr Mar 2, 2024
9e32ccf
style: remove extra semicolons and fixed the missing trailing comma i…
at-wr Mar 2, 2024
307910a
style: remove useless comment
at-wr Mar 2, 2024
ba2fe84
docs: Clubs page retitled
at-wr Mar 2, 2024
87d2f5e
style: use `NuxtLink` instead of `nuxt-link`
at-wr Mar 2, 2024
b05e7fe
fix: make the layout responsive by adjusting the custom mobile layout
at-wr Mar 2, 2024
83a1be1
feat: show `暂无简介` while there's no description for certain clubs
at-wr Mar 2, 2024
8382bc3
feat: new function `cleanHTML()`
at-wr Mar 2, 2024
0e0181c
refactor: use `cleanHTML` in order to clean <script> and <style> tags
at-wr Mar 2, 2024
b42c072
style: remove extra semicolon and spaces
at-wr Mar 2, 2024
5ae51e8
style: remove extra semicolon
at-wr Mar 2, 2024
1eeb48f
style: remove extra semicolon and add self-closing on <p>
at-wr Mar 2, 2024
6e7f20f
feat: add hint to go back if the club does not exist
at-wr Mar 2, 2024
6106e4f
fix: return `''` if `!content`
at-wr Mar 2, 2024
7e332da
style: merge into single line
at-wr Mar 2, 2024
b76ea25
style: fix Linter issues
at-wr Mar 2, 2024
b3d2659
style: remove v-bind
at-wr Mar 2, 2024
c1c1f56
fix: altered to the correct link
at-wr Mar 2, 2024
9aa9188
feat: add JetBrains Run/Debug Configuration
at-wr Mar 2, 2024
65c3e81
refactor: filter club info with a brand-new method
at-wr Mar 2, 2024
b2ce433
refactor: move `cleanHTML` to `/utils`
at-wr Mar 2, 2024
bb87ec6
refactor: move `cleanHTML` to `/utils`
at-wr Mar 2, 2024
4ee8c34
fix: add several styles to certain objects
at-wr Mar 2, 2024
b8d1b53
refactor: merge into `/cas/clubs`
at-wr Mar 2, 2024
f39ecc6
refactor: update URL of `/cas/clubs/*`
at-wr Mar 2, 2024
fcb7b69
fix: use `v-if` instead of `v-html`
at-wr Mar 2, 2024
8a67185
style: remove some nobody
at-wr Mar 2, 2024
0133094
refactor: merge `cleanHTML()` into `utils.ts`
at-wr Mar 2, 2024
9799043
refactor: merged into `utils.ts`
at-wr Mar 2, 2024
25a69f3
refactor: merged into single line
at-wr Mar 2, 2024
7a6f98c
refactor: unify `~/` into `@/`
at-wr Mar 2, 2024
ae8dc8b
fix: minor typescript fixes
at-wr Mar 2, 2024
f2a02a2
fix: minor fixes
qwerzl Mar 2, 2024
b8e3227
fix: minor fixes
qwerzl Mar 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions components/custom/club-card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ const props = defineProps({
</div>
</CardContent>
<CardFooter>
<Button class="w-full">
详细信息
</Button>
<nuxt-link :to="`/clubs/${props.club.groups[0].C_GroupsID}`">
qwerzl marked this conversation as resolved.
Show resolved Hide resolved
<Button class="w-full">
详细信息
</Button>
</nuxt-link>
</CardFooter>
</Card>
</template>
2 changes: 1 addition & 1 deletion components/custom/sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { Button } from '@/components/ui/button'
<NuxtLink to="/cas/clubs">
<Button :variant="$route.name === 'cas-clubs' ? 'secondary' : 'ghost'" class="w-full justify-start">
<Icon class="mr-2 h-4 w-4" name="material-symbols:grid-view-outline-rounded" />
我们的社团
社团列表
</Button>
</NuxtLink>
<NuxtLink to="/cas/checkin">
Expand Down
64 changes: 64 additions & 0 deletions pages/clubs/[id].vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<script setup lang="ts">
import { useRoute } from 'vue-router'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '~/components/ui/card'
import json from '~/content/clubs.json'
import type { Clubs } from '~/content/clubs'

const clubs: Clubs = json as Clubs
const route = useRoute()
const id = route.params.id // Fetch current Club ID via route params

// Filter clubs based on C_GroupsID
// It just works ;)
const filteredClubs = Object.values(clubs).flatMap(clubCategory =>
clubCategory.flatMap(club => club.groups.filter(group => group.C_GroupsID === id)))

// Get the number of members in each group
// const groupMemberCounts = filteredClubs.map(group => group.gmember.length)

qwerzl marked this conversation as resolved.
Show resolved Hide resolved
// This page requires login
definePageMeta({
middleware: ['auth'],
})
</script>

<template>
<div v-if="filteredClubs.length > 0">
<div v-for="group in filteredClubs" :key="group.C_GroupsID">
<div class="flex">
qwerzl marked this conversation as resolved.
Show resolved Hide resolved
<Card class="w-3/4">
qwerzl marked this conversation as resolved.
Show resolved Hide resolved
<CardHeader>
<CardTitle class="flex items-center gap-x-1">
{{ group.C_NameC }}
</CardTitle>
<CardDescription>{{ group.C_NameE }}</CardDescription>
</CardHeader>
<CardContent>
<p>{{ group.C_DescriptionC }}</p>
<br>
<p>{{ group.C_DescriptionE }}</p>
qwerzl marked this conversation as resolved.
Show resolved Hide resolved
</CardContent>
</Card>
<Card class="w-1/4">
qwerzl marked this conversation as resolved.
Show resolved Hide resolved
<CardHeader>
<CardTitle class="flex items-center gap-x-1">
社团属性
</CardTitle>
<CardDescription>Club Info</CardDescription>
</CardHeader>
<CardContent>
<p>社团类型: {{ group.C_Category }}</p>
<!-- <p>社团人数: {{ groupMemberCounts }}</p> -->
</CardContent>
</Card>
</div>
</div>
</div>
<p v-else>
Sorry, but we didn't find anything here.
</p>
</template>

<style scoped>

</style>