Skip to content

Commit 6b836cc

Browse files
authored
Merge pull request #7 from COSCUP/fix/rename-sponsor-to-booths
refactor(naming): rename sponsor to booths across components and data
2 parents de7ec5b + ec79f61 commit 6b836cc

File tree

7 files changed

+74
-45
lines changed

7 files changed

+74
-45
lines changed

pnpm-lock.yaml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import './style.css'
66
const router = useRouter()
77
const route = useRoute()
88
9-
const goToSponsorList = () => {
10-
router.push('/sponsor')
9+
const goToBoothsList = () => {
10+
router.push('/booths')
1111
}
1212
1313
const scanQRCode = () => {
@@ -27,7 +27,7 @@ const goToGameScene = () => {
2727
<router-view />
2828

2929
<div class="bottom-bar">
30-
<button class="button button-sponsor" @click="goToSponsorList">
30+
<button class="button button-booths" @click="goToBoothsList">
3131
<Icon icon="tabler:building-store" class="icon" />
3232
<span>攤位列表</span>
3333
</button>
@@ -85,7 +85,7 @@ const goToGameScene = () => {
8585
transform: translateY(-10px);
8686
}
8787
88-
.button-sponsor:hover,
88+
.button-booths:hover,
8989
.button-profile:hover {
9090
transform: translateY(-2px);
9191
color: #007bff;

src/components/SponsorList.vue renamed to src/components/BoothsList.vue

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script setup lang="ts">
22
import { onMounted, ref, computed } from 'vue'
33
import { marked } from 'marked'
4-
import { GameData } from '../game/GameData'
4+
import { GameData } from '../data/GameData'
55
6-
const sponsorData = ref()
6+
const boothsData = ref()
77
const activeID = ref<number | null>(null)
88
const renderer = new marked.Renderer()
99
renderer.link = function ({href, title, text}) {
@@ -12,11 +12,11 @@ renderer.link = function ({href, title, text}) {
1212
marked.setOptions({ renderer })
1313
1414
onMounted(() => {
15-
const sponsorDataUrl = 'https://coscup.org/2024/json/sponsor.json'
16-
fetch(sponsorDataUrl)
15+
const boothsDataUrl = 'https://coscup.org/2024/json/sponsor.json'
16+
fetch(boothsDataUrl)
1717
.then(res => res.json())
1818
.then(json => {
19-
sponsorData.value = json.reduce(
19+
boothsData.value = json.reduce(
2020
(acc: any, item: any) => {
2121
acc[item.id] = item
2222
return acc
@@ -28,7 +28,7 @@ onMounted(() => {
2828
})
2929
})
3030
31-
function toggleSponsor(id: number) {
31+
function toggleBooths(id: number) {
3232
activeID.value = activeID.value === id ? null : id
3333
}
3434
@@ -39,25 +39,25 @@ function markedIntro(intro: string) {
3939
</script>
4040

4141
<template>
42-
<div class="sponsor-wrapper">
43-
<div class="sponsor-list" :style="{ 'margin-bottom': `${GameData.bottomBarHeight}px` }">
42+
<div class="booths-wrapper">
43+
<div class="booths-list" :style="{ 'margin-bottom': `${GameData.bottomBarHeight}px` }">
4444
<div
45-
v-for="(sponsor, id) in sponsorData"
45+
v-for="(booths, id) in boothsData"
4646
:key="id"
47-
class="sponsor-item"
48-
@click="toggleSponsor(id)"
47+
class="booths-item"
48+
@click="toggleBooths(id)"
4949
>
50-
<div class="sponsor-header">
50+
<div class="booths-header">
5151
<img
52-
:src="'https://coscup.org/' + sponsorData[id].image"
53-
:alt="sponsorData[id].name['zh-TW']" class="sponsor-logo" />
54-
<span class="sponsor-name">{{ sponsorData[id].name['zh-TW'] }}</span>
52+
:src="'https://coscup.org/' + boothsData[id].image"
53+
:alt="boothsData[id].name['zh-TW']" class="booths-logo" />
54+
<span class="booths-name">{{ boothsData[id].name['zh-TW'] }}</span>
5555
</div>
5656
<transition name="fade-slide">
5757
<div
5858
v-if="activeID === id"
59-
class="sponsor-detail"
60-
v-html="markedIntro(sponsor.intro['zh-TW'])"
59+
class="booths-detail"
60+
v-html="markedIntro(booths.intro['zh-TW'])"
6161
>
6262
</div>
6363
</transition>
@@ -68,7 +68,7 @@ function markedIntro(intro: string) {
6868

6969

7070
<style scoped>
71-
.sponsor-wrapper {
71+
.booths-wrapper {
7272
height: 100%;
7373
width: 100%;
7474
display: flex;
@@ -78,7 +78,7 @@ function markedIntro(intro: string) {
7878
background-color: #FBFAF2;
7979
}
8080
81-
.sponsor-list {
81+
.booths-list {
8282
display: flex;
8383
flex-direction: column;
8484
gap: 12px;
@@ -87,29 +87,29 @@ function markedIntro(intro: string) {
8787
overflow-y: auto;
8888
}
8989
90-
.sponsor-item {
90+
.booths-item {
9191
border-radius: 12px;
9292
padding: 12px;
9393
background-color: white;
9494
}
9595
96-
.sponsor-header {
96+
.booths-header {
9797
display: flex;
9898
align-items: center;
9999
gap: 12px;
100100
}
101101
102-
.sponsor-logo {
102+
.booths-logo {
103103
width: 100px;
104104
}
105105
106-
.sponsor-name {
106+
.booths-name {
107107
font-weight: bold;
108108
font-size: 18px;
109109
color: #444;
110110
}
111111
112-
.sponsor-detail {
112+
.booths-detail {
113113
font-size: 14px;
114114
color: #555;
115115
transform-origin: top;

src/components/PhaserGame.vue

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const scene = ref()
1414
const game = ref()
1515
const showPopup = ref(false)
1616
const popupData = ref<{ type: string, ID: string } | null>(null)
17-
const sponsorData = ref()
17+
const boothsData = ref()
1818
const comments = ref()
1919
const newMessage = ref('')
2020
const renderer = new marked.Renderer()
@@ -26,11 +26,11 @@ marked.setOptions({ renderer })
2626
onMounted(() => {
2727
game.value = StartGame('game-container')
2828
29-
const sponsorDataUrl = 'https://coscup.org/2024/json/sponsor.json'
30-
fetch(sponsorDataUrl)
29+
const boothsDataUrl = 'https://coscup.org/2024/json/sponsor.json'
30+
fetch(boothsDataUrl)
3131
.then(res => res.json())
3232
.then(json => {
33-
sponsorData.value = json.reduce(
33+
boothsData.value = json.reduce(
3434
(acc: any, item: any) => {
3535
acc[item.id] = item
3636
return acc
@@ -271,13 +271,13 @@ watch([showPopup, popupData], async ([isOpen, data]) => {
271271
src="/assets/banner-mobile.png"
272272
>
273273
</div>
274-
<div v-else-if="popupData?.type === 'Sponsor'" class="Sponsor">
275-
<h2>{{ sponsorData[popupData?.ID].name['zh-TW'] }}</h2>
274+
<div v-else-if="popupData?.type === 'Booths'" class="Booths">
275+
<h2>{{ boothsData[popupData?.ID].name['zh-TW'] }}</h2>
276276
<img
277-
:alt="sponsorData[popupData?.ID].name['zh-TW']"
278-
:src="'https://coscup.org/' + sponsorData[popupData?.ID].image"
277+
:alt="boothsData[popupData?.ID].name['zh-TW']"
278+
:src="'https://coscup.org/' + boothsData[popupData?.ID].image"
279279
>
280-
<div v-html="markedIntro(sponsorData[popupData?.ID].intro['zh-TW'] )"></div>
280+
<div class="booths-content" v-html="markedIntro(boothsData[popupData?.ID].intro['zh-TW'] )"></div>
281281
</div>
282282
<div v-else-if="popupData?.type === 'Venue'" class="Venue">
283283
<h2>{{ popupData?.ID }}</h2>
@@ -356,8 +356,27 @@ img {
356356
width: 100%;
357357
}
358358
359-
.Sponsor h2,
360-
.Sponsor p,
359+
.Booths {
360+
text-align: left;
361+
}
362+
363+
.booths-content {
364+
max-height: 40vh;
365+
overflow-y: auto;
366+
padding-right: 4px;
367+
}
368+
369+
.booths-content p {
370+
line-height: 1.6;
371+
margin-bottom: 12px;
372+
}
373+
374+
.booths-content a {
375+
color: #007bff;
376+
text-decoration: underline;
377+
word-break: break-word;
378+
}
379+
361380
.Venue h2 {
362381
text-align: left;
363382
max-height: 50vh;

src/config/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
22
import PhaserGame from '../components/PhaserGame.vue'
3-
import SponsorList from '../components/SponsorList.vue'
3+
import BoothsList from '../components/BoothsList.vue'
44
import QRCodeScanner from '../components/QRCodeScanner.vue'
55
import MyProfile from '../components/MyProfile.vue'
66

@@ -20,9 +20,9 @@ const routes: Array<RouteRecordRaw> = [
2020
component: PhaserGame
2121
},
2222
{
23-
path: '/sponsor',
24-
name: 'sponsor',
25-
component: SponsorList
23+
path: '/booths',
24+
name: 'booths',
25+
component: BoothsList
2626
},
2727
{
2828
path: '/qrcode-scanner',

src/data/TileData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class HexTile extends Phaser.GameObjects.Container {
8080
if (this.type === "Base") {
8181
this.color = 0xD3BBDD
8282
}
83-
else if (this.type === "Sponsor") {
83+
else if (this.type === "Booths") {
8484
this.color = 0xF8C0C8
8585
}
8686
else if (this.type === "Venue") {

src/game/scenes/Game.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function randomData(scene: Phaser.Scene, x: number, y: number) {
1616

1717
const r = Math.random()
1818
if (r < 0.25) {
19-
ret.type = 'Sponsor'
19+
ret.type = 'Booths'
2020
ret.ID = 'Andes'
2121
}
2222
else {

0 commit comments

Comments
 (0)