From 77b4eb0f7343a62913001788da55fed53dea9f44 Mon Sep 17 00:00:00 2001 From: Malted Date: Wed, 22 Jan 2025 16:50:08 -0500 Subject: [PATCH 1/2] Toast notifs onchange --- src/app/harbor/shipyard/edit-ship-form.tsx | 2 +- src/app/harbor/tavern/tavern.tsx | 135 +++++++++++---------- 2 files changed, 75 insertions(+), 62 deletions(-) diff --git a/src/app/harbor/shipyard/edit-ship-form.tsx b/src/app/harbor/shipyard/edit-ship-form.tsx index b35eae5d..a5c7d7f9 100644 --- a/src/app/harbor/shipyard/edit-ship-form.tsx +++ b/src/app/harbor/shipyard/edit-ship-form.tsx @@ -7,7 +7,7 @@ import React, { useState } from 'react' import Modal from '../../../components/ui/modal' import { EditableShipFields } from '../../utils/server/data' -const editMessages = [ +export const editMessages = [ 'Orpheus hopes you know that she put a lot of effort into recording your changes~', 'Heidi scribbles down your changes hastily...', "Orpheus put your Ship changes in the logbook. They're going nowhere, rest assured.", diff --git a/src/app/harbor/tavern/tavern.tsx b/src/app/harbor/tavern/tavern.tsx index 65a1fa76..fc9bfc0f 100644 --- a/src/app/harbor/tavern/tavern.tsx +++ b/src/app/harbor/tavern/tavern.tsx @@ -20,6 +20,8 @@ import { } from './tavern-utils' import Modal from '@/components/ui/modal' import { Button } from '@/components/ui/button' +import { useToast } from '@/hooks/use-toast' +import { editMessages } from '../shipyard/edit-ship-form' const Map = dynamic(() => import('./map'), { ssr: false, @@ -41,6 +43,15 @@ const RsvpStatusSwitcher = ({ tavernEvents, onTavernSelect }) => { const [attendeeNoOrganizerModal, setAttendeeNoOrganizerModal] = useState(false) + const { toast } = useToast() + useEffect(() => { + toast({ + title: 'Saved', + description: + editMessages[Math.floor(Math.random() * editMessages.length)], + }) + }, [rsvpStatus, whichTavern, shirtSize]) + useEffect(() => { // set rsvp status getTavernRsvpStatus().then((status) => setRsvpStatus(status)) @@ -99,71 +110,73 @@ const RsvpStatusSwitcher = ({ tavernEvents, onTavernSelect }) => {
Please consider volunteering to organize this tavern, me hearty! -
- - +
+ {tavernEvents && (rsvpStatus === 'participant' || rsvpStatus === 'organizer') ? ( -
- - + <> + - - -
+ + ) : null}
From 53a2aeb8a2bea73db0cbe665d04f22fadf75d29a Mon Sep 17 00:00:00 2001 From: Malted Date: Wed, 22 Jan 2025 17:14:03 -0500 Subject: [PATCH 2/2] done --- src/app/harbor/tavern/map.tsx | 79 +++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 37 deletions(-) diff --git a/src/app/harbor/tavern/map.tsx b/src/app/harbor/tavern/map.tsx index dcda9442..d135d57b 100644 --- a/src/app/harbor/tavern/map.tsx +++ b/src/app/harbor/tavern/map.tsx @@ -32,7 +32,7 @@ export default function Map({ tavernEvents, tavernPeople, selectedTavern }) { className="h-96 rounded-lg" center={[0, 0]} zoom={2} - scrollWheelZoom={false} + scrollWheelZoom={true} >

Mystic Tavern without organizer

-
+ {/*

Someone unable to organize or attend

-
+
*/}

Someone able to organize

@@ -73,10 +73,10 @@ export default function Map({ tavernEvents, tavernPeople, selectedTavern }) {

Someone able to attend

-
+ {/*

Someone who has not responded

-
+
*/} ) @@ -116,43 +116,48 @@ function TavernMarkers(props: MapProps) { console.log(props) - const peopleMarkers = props.people.map((t) => { - let iconClass = `rounded-full border-2 border-white w-full h-full ` + const peopleMarkers = props.people + .map((t) => { + let iconClass = `rounded-full border-2 border-white w-full h-full ` - switch (t.status) { - case 'none': { - iconClass += 'bg-[#cfdfff]' - break - } - case 'organizer': { - iconClass += 'bg-[#ffd66e]' - break - } - case 'participant': { - iconClass += 'bg-[#f82b60]' - break - } - default: { - iconClass += 'bg-[#666666]' - break + switch (t.status) { + case 'none': { + // iconClass += 'bg-[#cfdfff]' + // break + return null + } + case 'organizer': { + iconClass += 'bg-[#ffd66e]' + break + } + case 'participant': { + iconClass += 'bg-[#f82b60]' + break + } + default: { + // iconClass += 'bg-[#666666]' + // break + return null + } } - } - const icon = new DivIcon({ - className: iconClass, - iconSize: [25, 25], + const icon = new DivIcon({ + className: iconClass, + iconSize: [25, 25], + }) + + return ( + Number(c)) as LatLngExpression + } + icon={icon} + /> + ) }) + .filter((e) => e !== null) - return ( - Number(c)) as LatLngExpression - } - icon={icon} - /> - ) - }) const eventMarkers = props.events .map((e) => { if (!e.geocode) {