diff --git a/src/app/[tab]/page.tsx b/src/app/[tab]/page.tsx
index 6fb3b02f..7906ec42 100644
--- a/src/app/[tab]/page.tsx
+++ b/src/app/[tab]/page.tsx
@@ -28,7 +28,7 @@ export default function Page({
}, [])
const { tab } = params
- const validTabs = ['signpost', 'shipyard', 'wonderdome', 'shop']
+ const validTabs = ['signpost', 'shipyard', 'wonderdome', 'shop', 'tavern']
if (!validTabs.includes(tab)) return notFound()
const { magic_auth_token } = searchParams
diff --git a/src/app/harbor/tabs/tabs.tsx b/src/app/harbor/tabs/tabs.tsx
index f42b6897..7e102b87 100644
--- a/src/app/harbor/tabs/tabs.tsx
+++ b/src/app/harbor/tabs/tabs.tsx
@@ -5,6 +5,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
import Shipyard from '../shipyard/shipyard'
import Battles from '../battles/battles'
import Shop from '../shop/shop'
+import Tavern from '../tavern/tavern'
import { useEffect } from 'react'
import SignPost from '../signpost/signpost'
import { tour } from './tour'
@@ -211,6 +212,11 @@ export default function Harbor({
path: 'shop',
component: ,
},
+ {
+ name: <>Tavern 🍻>,
+ path: 'tavern',
+ component: ,
+ },
]
let usPrices = false
diff --git a/src/app/harbor/tavern/tavern.tsx b/src/app/harbor/tavern/tavern.tsx
new file mode 100644
index 00000000..70386d7b
--- /dev/null
+++ b/src/app/harbor/tavern/tavern.tsx
@@ -0,0 +1,52 @@
+'use client'
+
+import { useEffect } from 'react'
+import useLocalStorageState from '../../../../lib/useLocalStorageState'
+import { setTavernRsvpStatus, getTavernRsvpStatus } from '@/app/utils/tavern'
+
+const RsvpStatusSwitcher = () => {
+ const [rsvpStatus, setRsvpStatus] = useLocalStorageState(
+ 'cache.rsvpStatus',
+ 'none',
+ )
+
+ useEffect(() => {
+ // set rsvp status
+ getTavernRsvpStatus().then((status) => setRsvpStatus(status))
+ }, [])
+
+ const onOptionChangeHandler = (e) => {
+ setRsvpStatus(e.target.value)
+ setTavernRsvpStatus(e.target.value)
+ }
+
+ return (
+
+
+
+
+ )
+}
+
+export default function Tavern() {
+ return (
+
+
+
+ Mystic Tavern
+
+
+
+
+
+ )
+}
diff --git a/src/app/utils/tavern.ts b/src/app/utils/tavern.ts
new file mode 100644
index 00000000..bb547a79
--- /dev/null
+++ b/src/app/utils/tavern.ts
@@ -0,0 +1,45 @@
+'use server'
+
+import Airtable from 'airtable'
+import { getSession } from './auth'
+
+Airtable.configure({
+ apiKey: process.env.AIRTABLE_API_KEY,
+ endpointUrl: process.env.AIRTABLE_ENDPOINT_URL,
+})
+
+type RsvpStatus = 'none' | 'organizer' | 'participant'
+export const setTavernRsvpStatus = async (rsvpStatus: RsvpStatus) => {
+ // check auth
+ const session = await getSession()
+ if (!session) {
+ return
+ }
+ if (!session.personId) {
+ return
+ }
+
+ // update status
+ const base = Airtable.base(process.env.BASE_ID)
+ const result = await base('people').update(session.personId, {
+ tavern_rsvp_status: rsvpStatus,
+ })
+
+ return result.get('tavern_rsvp_status')
+}
+
+export const getTavernRsvpStatus = async () => {
+ // check auth
+ const session = await getSession()
+ if (!session) {
+ return
+ }
+ if (!session.personId) {
+ return
+ }
+
+ // get status
+ const base = Airtable.base(process.env.BASE_ID)
+ const record = await base('people').find(session.personId)
+ return record.get('tavern_rsvp_status') as RsvpStatus
+}
diff --git a/src/middleware.ts b/src/middleware.ts
index 36aac377..f7083e38 100644
--- a/src/middleware.ts
+++ b/src/middleware.ts
@@ -212,5 +212,12 @@ export async function middleware(request: NextRequest) {
}
export const config = {
- matcher: ['/signpost', '/shipyard', '/wonderdome', '/shop', '/api/cron/'],
+ matcher: [
+ '/signpost',
+ '/shipyard',
+ '/wonderdome',
+ '/shop',
+ '/tavern',
+ '/api/cron/',
+ ],
}