diff --git a/package.json b/package.json index c715ce6..1d06c73 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "dependencies": { "firebase": "^10.4.0", "firebase-admin": "^11.11.0", + "lodash": "^4.17.21", "luxon": "^3.4.1", "svelte-french-toast": "^1.2.0", "tailwind-merge": "^1.14.0" @@ -31,6 +32,7 @@ "@tanstack/svelte-table": "^8.10.7", "@ts-stack/markdown": "^1.4.0", "@types/file-saver": "^2.0.5", + "@types/lodash": "^4.14.199", "@types/luxon": "^3.3.1", "@typescript-eslint/eslint-plugin": "^6.4.1", "@typescript-eslint/parser": "^6.4.1", diff --git a/src/lib/components/AdminTable.svelte b/src/lib/components/AdminTable.svelte index ad1f3e7..a1b2622 100644 --- a/src/lib/components/AdminTable.svelte +++ b/src/lib/components/AdminTable.svelte @@ -1,7 +1,7 @@ @@ -20,5 +21,20 @@ : 'bg-radicalRed-500 text-white transition-colors hover:bg-radicalRed-600', $$restProps.class )}> + {#if loading} + + + + + {/if} diff --git a/src/lib/server/firebaseAdmin.ts b/src/lib/server/firebaseAdmin.ts index 6761243..bd20bc5 100644 --- a/src/lib/server/firebaseAdmin.ts +++ b/src/lib/server/firebaseAdmin.ts @@ -7,9 +7,11 @@ const serviceAccount = { privateKey: env.FIREABSE_ADMIN_PRIVATE_KEY, } as ServiceAccount -const app = admin.initializeApp({ - credential: admin.credential.cert(serviceAccount), - databaseURL: 'https://vancouver-kdd-default-rtdb.firebaseio.com', -}) +const app = + admin.apps[0] ?? + admin.initializeApp({ + credential: admin.credential.cert(serviceAccount), + databaseURL: 'https://vancouver-kdd-default-rtdb.firebaseio.com', + }) export const db = app.firestore() diff --git a/src/lib/services/firestoreService.ts b/src/lib/services/firestoreService.ts deleted file mode 100644 index adae66f..0000000 --- a/src/lib/services/firestoreService.ts +++ /dev/null @@ -1,22 +0,0 @@ -import {collection, addDoc} from 'firebase/firestore' -import {db} from '$lib/firebase' - -interface FormData { - firstTime: string - name: string - email: string - occupation: string - work: string - location: string - message: string -} - -export const saveFormData = async (formData: FormData) => { - try { - const collectionRef = collection(db, 'Tickets') - await addDoc(collectionRef, formData) - console.log('Form data saved to Firestore') - } catch (error) { - console.error('Error saving form data to Firestore:', error) - } -} diff --git a/src/routes/admin/+page.svelte b/src/routes/admin/+page.svelte index f9e1abe..7166140 100644 --- a/src/routes/admin/+page.svelte +++ b/src/routes/admin/+page.svelte @@ -17,7 +17,7 @@ .catch((error) => { const errorCode = error.code const errorMessage = error.message - console.log(errorCode, errorMessage) + console.error(errorCode, errorMessage) }) } diff --git a/src/routes/admin/dashboard/+page.svelte b/src/routes/admin/dashboard/+page.svelte index 029b261..e9cc596 100644 --- a/src/routes/admin/dashboard/+page.svelte +++ b/src/routes/admin/dashboard/+page.svelte @@ -17,7 +17,7 @@ goto('/admin') }) .catch((error) => { - console.log(error) + console.error(error) }) } diff --git a/src/routes/admin/register/+page.svelte b/src/routes/admin/register/+page.svelte index ea24b2a..a0f3016 100644 --- a/src/routes/admin/register/+page.svelte +++ b/src/routes/admin/register/+page.svelte @@ -7,7 +7,7 @@ let email: string let password: string - let success: boolean | undefined = undefined + // let success: boolean | undefined = undefined const register = () => { createUserWithEmailAndPassword(firebaseAuth, email, password) @@ -18,10 +18,8 @@ .catch((error) => { const errorCode = error.code const errorMessage = error.message - console.log(errorCode, errorMessage) - - success = false - console.log(success) + console.error(errorCode, errorMessage) + // success = false }) } diff --git a/src/routes/checkout/[eventId]/+page.server.ts b/src/routes/checkout/[eventId]/+page.server.ts index e45647f..c1b9643 100644 --- a/src/routes/checkout/[eventId]/+page.server.ts +++ b/src/routes/checkout/[eventId]/+page.server.ts @@ -6,10 +6,8 @@ import {error, redirect} from '@sveltejs/kit' export const load = async ({params}) => { const eventId = params.eventId - console.log({eventId}) if (eventId) { const data = await getEvent(eventId) - console.log('data', data) return {event: data} } return {event: null} @@ -17,8 +15,6 @@ export const load = async ({params}) => { export const actions = { default: async ({request}) => { - console.log('checkout page.server.ts is this cached? ' + new Date().valueOf()) - const formData = await request.formData() const eventId = formData.get('eventId') as string if (!eventId) { diff --git a/src/routes/checkout/[eventId]/+page.svelte b/src/routes/checkout/[eventId]/+page.svelte index fdaccb4..f8fd0d4 100644 --- a/src/routes/checkout/[eventId]/+page.svelte +++ b/src/routes/checkout/[eventId]/+page.svelte @@ -1,18 +1,18 @@ Vancouver KDD - Checkout -
+
- event-poster -
-
-

Date & Time

-
- {event && DateTime.fromISO(event.date).toFormat('yyyy LLL dd H:mm a')} -
+ event-poster +
+

Date

+
+ {eventTime && eventTime.toLocaleString(DateTime.DATE_FULL)}
-
-

Location

-
- {event && event.location} -
+

Time

+
+ {eventTime && eventTime.toLocaleString(DateTime.TIME_SIMPLE)} + {eventTimeTo && '- ' + eventTimeTo.toLocaleString(DateTime.TIME_SIMPLE)}
-
-

Summary

- +

Location

+
+ {event && event.location}
+

Summary

+
@@ -86,30 +73,23 @@
{ - const data = new FormData(e.currentTarget) - const headers = new Headers() - headers.append('x-prerender-revalidate', '0VkJCrieFXnOIRGqLdqf0VkJCrieFXnOIRGqLdqf') - const response = await fetch(e.currentTarget.action, { - method: 'POST', - headers, - body: data, - }) - const result = await response.json() - applyAction(result) - toast.success('티켓 예약이 완료되었습니다.') - }}> - + }}>
@@ -117,8 +97,10 @@ {event?.title}
-
-

** KDD 밋업에 처음 참석하시나요?

+
+

+ KDD 밋업에 처음 참석하시나요? * +

- +
- +
- +
- {#if formData.occupation === '기타'} + {#if formData.occupation === 'other'} (customOccupation = e.target?.value)} - on:change={updateOccupation} /> + class="w-full px-3 py-2 border border-gray-300 text-sm rounded-md focus:outline-none focus:border-royalBlue-500" /> {/if}
- +
- + +

+ (아래 중 1개 항목이 충족되면 해당) * +

+

1. 저는 현재 학생입니다

2. 저는 현재 구직중입니다

3. 저는 KDD 밋업에 처음 참석합니다

-
{ - isFreeStore.set(true) - }} + on:click={() => ($isFreeStore = true)} class="form-radio text-royalBlue-500" /> @@ -242,9 +231,7 @@ id="no" name="isFreeApplicable" value="No" - on:click={() => { - isFreeStore.set(false) - }} + on:click={() => ($isFreeStore = false)} class="form-radio text-royalBlue-500" /> @@ -255,77 +242,37 @@
+ class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-royalBlue-500 text-sm" />
- {#if $isFreeStore} - - {:else} - - {/if} +
-
-

- ** This information is solely for reserving KDD's open events and will not be used for any - other purpose. -

-
- {#if isTicketReserved} -
- -
- {/if}
- dialog.close()} - class="bg-transparent backdrop-blur-sm max-w-full max-h-full min-w-full min-h-full flex items-center justify-center"> -
-

+

dialog.close()} class="bg-transparent backdrop-blur-sm"> +
+

+ {@html Marked.parse(event?.description ?? '')}

- diff --git a/yarn.lock b/yarn.lock index 8816ce0..4231147 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2160,6 +2160,11 @@ resolved "https://registry.yarnpkg.com/@types/linkify-it/-/linkify-it-3.0.3.tgz#15a0712296c5041733c79efe233ba17ae5a7587b" integrity sha512-pTjcqY9E4nOI55Wgpz7eiI8+LzdYnw3qxXCfHyBDdPbYvbyLgWLJGh8EdPvqawwMK1Uo1794AUkkR38Fr0g+2g== +"@types/lodash@^4.14.199": + version "4.14.199" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.199.tgz#c3edb5650149d847a277a8961a7ad360c474e9bf" + integrity sha512-Vrjz5N5Ia4SEzWWgIVwnHNEnb1UE1XMkvY5DGXrAeOGE9imk0hgTHh5GyDjLDJi9OTCn9oo9dXH1uToK1VRfrg== + "@types/long@^4.0.0": version "4.0.2" resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a"