@mbpockets/shared-ui 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +681 -0
- package/README.md +85 -0
- package/dist/EventPage/editMode/index.cjs +573 -0
- package/dist/EventPage/editMode/index.cjs.map +1 -0
- package/dist/EventPage/editMode/index.d.cts +5 -0
- package/dist/EventPage/editMode/index.d.ts +5 -0
- package/dist/EventPage/editMode/index.mjs +559 -0
- package/dist/EventPage/editMode/index.mjs.map +1 -0
- package/dist/EventPage/editMode.cjs +573 -0
- package/dist/EventPage/editMode.cjs.map +1 -0
- package/dist/EventPage/editMode.d.cts +5 -0
- package/dist/EventPage/editMode.d.ts +5 -0
- package/dist/EventPage/editMode.mjs +559 -0
- package/dist/EventPage/editMode.mjs.map +1 -0
- package/dist/EventPage/index.cjs +1245 -0
- package/dist/EventPage/index.cjs.map +1 -0
- package/dist/EventPage/index.d.cts +6 -0
- package/dist/EventPage/index.d.ts +6 -0
- package/dist/EventPage/index.mjs +1215 -0
- package/dist/EventPage/index.mjs.map +1 -0
- package/dist/EventPage.cjs +1245 -0
- package/dist/EventPage.cjs.map +1 -0
- package/dist/EventPage.d.cts +42 -0
- package/dist/EventPage.d.ts +42 -0
- package/dist/EventPage.mjs +1215 -0
- package/dist/EventPage.mjs.map +1 -0
- package/dist/PlayerPage/index.cjs +370 -0
- package/dist/PlayerPage/index.cjs.map +1 -0
- package/dist/PlayerPage/index.d.cts +4 -0
- package/dist/PlayerPage/index.d.ts +4 -0
- package/dist/PlayerPage/index.mjs +358 -0
- package/dist/PlayerPage/index.mjs.map +1 -0
- package/dist/PlayerPage.cjs +370 -0
- package/dist/PlayerPage.cjs.map +1 -0
- package/dist/PlayerPage.d.cts +32 -0
- package/dist/PlayerPage.d.ts +32 -0
- package/dist/PlayerPage.mjs +358 -0
- package/dist/PlayerPage.mjs.map +1 -0
- package/dist/ProfilePage/index.cjs +136 -0
- package/dist/ProfilePage/index.cjs.map +1 -0
- package/dist/ProfilePage/index.d.cts +3 -0
- package/dist/ProfilePage/index.d.ts +3 -0
- package/dist/ProfilePage/index.mjs +124 -0
- package/dist/ProfilePage/index.mjs.map +1 -0
- package/dist/ProfilePage.cjs +136 -0
- package/dist/ProfilePage.cjs.map +1 -0
- package/dist/ProfilePage.d.cts +10 -0
- package/dist/ProfilePage.d.ts +10 -0
- package/dist/ProfilePage.mjs +124 -0
- package/dist/ProfilePage.mjs.map +1 -0
- package/dist/SearchPage/Filters/index.cjs +270 -0
- package/dist/SearchPage/Filters/index.cjs.map +1 -0
- package/dist/SearchPage/Filters/index.d.cts +4 -0
- package/dist/SearchPage/Filters/index.d.ts +4 -0
- package/dist/SearchPage/Filters/index.mjs +250 -0
- package/dist/SearchPage/Filters/index.mjs.map +1 -0
- package/dist/SearchPage/Filters.cjs +270 -0
- package/dist/SearchPage/Filters.cjs.map +1 -0
- package/dist/SearchPage/Filters.d.cts +31 -0
- package/dist/SearchPage/Filters.d.ts +31 -0
- package/dist/SearchPage/Filters.mjs +250 -0
- package/dist/SearchPage/Filters.mjs.map +1 -0
- package/dist/SearchPage/Results/index.cjs +226 -0
- package/dist/SearchPage/Results/index.cjs.map +1 -0
- package/dist/SearchPage/Results/index.d.cts +4 -0
- package/dist/SearchPage/Results/index.d.ts +4 -0
- package/dist/SearchPage/Results/index.mjs +212 -0
- package/dist/SearchPage/Results/index.mjs.map +1 -0
- package/dist/SearchPage/Results.cjs +226 -0
- package/dist/SearchPage/Results.cjs.map +1 -0
- package/dist/SearchPage/Results.d.cts +53 -0
- package/dist/SearchPage/Results.d.ts +53 -0
- package/dist/SearchPage/Results.mjs +212 -0
- package/dist/SearchPage/Results.mjs.map +1 -0
- package/dist/SearchPage/index.cjs +737 -0
- package/dist/SearchPage/index.cjs.map +1 -0
- package/dist/SearchPage/index.d.cts +7 -0
- package/dist/SearchPage/index.d.ts +7 -0
- package/dist/SearchPage/index.mjs +695 -0
- package/dist/SearchPage/index.mjs.map +1 -0
- package/dist/SearchPage.cjs +737 -0
- package/dist/SearchPage.cjs.map +1 -0
- package/dist/SearchPage.d.cts +110 -0
- package/dist/SearchPage.d.ts +110 -0
- package/dist/SearchPage.mjs +695 -0
- package/dist/SearchPage.mjs.map +1 -0
- package/dist/TablePage/GameTableProvider/index.cjs +26 -0
- package/dist/TablePage/GameTableProvider/index.cjs.map +1 -0
- package/dist/TablePage/GameTableProvider/index.d.cts +4 -0
- package/dist/TablePage/GameTableProvider/index.d.ts +4 -0
- package/dist/TablePage/GameTableProvider/index.mjs +19 -0
- package/dist/TablePage/GameTableProvider/index.mjs.map +1 -0
- package/dist/TablePage/GameTableProvider.cjs +26 -0
- package/dist/TablePage/GameTableProvider.cjs.map +1 -0
- package/dist/TablePage/GameTableProvider.d.cts +15 -0
- package/dist/TablePage/GameTableProvider.d.ts +15 -0
- package/dist/TablePage/GameTableProvider.mjs +19 -0
- package/dist/TablePage/GameTableProvider.mjs.map +1 -0
- package/dist/TablePage/ModalProvider/index.cjs +83 -0
- package/dist/TablePage/ModalProvider/index.cjs.map +1 -0
- package/dist/TablePage/ModalProvider/index.css +49 -0
- package/dist/TablePage/ModalProvider/index.css.map +1 -0
- package/dist/TablePage/ModalProvider/index.d.cts +3 -0
- package/dist/TablePage/ModalProvider/index.d.ts +3 -0
- package/dist/TablePage/ModalProvider/index.mjs +79 -0
- package/dist/TablePage/ModalProvider/index.mjs.map +1 -0
- package/dist/TablePage/ModalProvider.cjs +83 -0
- package/dist/TablePage/ModalProvider.cjs.map +1 -0
- package/dist/TablePage/ModalProvider.css +49 -0
- package/dist/TablePage/ModalProvider.css.map +1 -0
- package/dist/TablePage/ModalProvider.d.cts +17 -0
- package/dist/TablePage/ModalProvider.d.ts +17 -0
- package/dist/TablePage/ModalProvider.mjs +79 -0
- package/dist/TablePage/ModalProvider.mjs.map +1 -0
- package/dist/TablePage/index.cjs +606 -0
- package/dist/TablePage/index.cjs.map +1 -0
- package/dist/TablePage/index.css +49 -0
- package/dist/TablePage/index.css.map +1 -0
- package/dist/TablePage/index.d.cts +10 -0
- package/dist/TablePage/index.d.ts +10 -0
- package/dist/TablePage/index.mjs +579 -0
- package/dist/TablePage/index.mjs.map +1 -0
- package/dist/TablePage/players/index.cjs +85 -0
- package/dist/TablePage/players/index.cjs.map +1 -0
- package/dist/TablePage/players/index.d.cts +4 -0
- package/dist/TablePage/players/index.d.ts +4 -0
- package/dist/TablePage/players/index.mjs +76 -0
- package/dist/TablePage/players/index.mjs.map +1 -0
- package/dist/TablePage/players.cjs +85 -0
- package/dist/TablePage/players.cjs.map +1 -0
- package/dist/TablePage/players.d.cts +22 -0
- package/dist/TablePage/players.d.ts +22 -0
- package/dist/TablePage/players.mjs +76 -0
- package/dist/TablePage/players.mjs.map +1 -0
- package/dist/TablePage.cjs +606 -0
- package/dist/TablePage.cjs.map +1 -0
- package/dist/TablePage.css +49 -0
- package/dist/TablePage.css.map +1 -0
- package/dist/TablePage.d.cts +54 -0
- package/dist/TablePage.d.ts +54 -0
- package/dist/TablePage.mjs +579 -0
- package/dist/TablePage.mjs.map +1 -0
- package/dist/common/Modal/index.cjs +64 -0
- package/dist/common/Modal/index.cjs.map +1 -0
- package/dist/common/Modal/index.css +49 -0
- package/dist/common/Modal/index.css.map +1 -0
- package/dist/common/Modal/index.d.cts +2 -0
- package/dist/common/Modal/index.d.ts +2 -0
- package/dist/common/Modal/index.mjs +62 -0
- package/dist/common/Modal/index.mjs.map +1 -0
- package/dist/common/Modal.cjs +64 -0
- package/dist/common/Modal.cjs.map +1 -0
- package/dist/common/Modal.css +49 -0
- package/dist/common/Modal.css.map +1 -0
- package/dist/common/Modal.d.cts +9 -0
- package/dist/common/Modal.d.ts +9 -0
- package/dist/common/Modal.mjs +62 -0
- package/dist/common/Modal.mjs.map +1 -0
- package/dist/common/index.cjs +210 -0
- package/dist/common/index.cjs.map +1 -0
- package/dist/common/index.css +49 -0
- package/dist/common/index.css.map +1 -0
- package/dist/common/index.d.cts +4 -0
- package/dist/common/index.d.ts +4 -0
- package/dist/common/index.mjs +194 -0
- package/dist/common/index.mjs.map +1 -0
- package/dist/common.cjs +210 -0
- package/dist/common.cjs.map +1 -0
- package/dist/common.css +49 -0
- package/dist/common.css.map +1 -0
- package/dist/common.d.cts +28 -0
- package/dist/common.d.ts +28 -0
- package/dist/common.mjs +194 -0
- package/dist/common.mjs.map +1 -0
- package/dist/index-D7WHhl3Q.d.ts +64 -0
- package/dist/index-DC0kK3aC.d.cts +64 -0
- package/dist/index.cjs +2608 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +49 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.mjs +2529 -0
- package/dist/index.mjs.map +1 -0
- package/dist/mocks/EventDB.cjs +171 -0
- package/dist/mocks/EventDB.cjs.map +1 -0
- package/dist/mocks/EventDB.d.cts +6 -0
- package/dist/mocks/EventDB.d.ts +6 -0
- package/dist/mocks/EventDB.mjs +169 -0
- package/dist/mocks/EventDB.mjs.map +1 -0
- package/dist/mocks/Events.cjs +59 -0
- package/dist/mocks/Events.cjs.map +1 -0
- package/dist/mocks/Events.d.cts +13 -0
- package/dist/mocks/Events.d.ts +13 -0
- package/dist/mocks/Events.mjs +57 -0
- package/dist/mocks/Events.mjs.map +1 -0
- package/dist/mocks/Players.cjs +75 -0
- package/dist/mocks/Players.cjs.map +1 -0
- package/dist/mocks/Players.d.cts +15 -0
- package/dist/mocks/Players.d.ts +15 -0
- package/dist/mocks/Players.mjs +73 -0
- package/dist/mocks/Players.mjs.map +1 -0
- package/dist/mocks/SearchResults.cjs +143 -0
- package/dist/mocks/SearchResults.cjs.map +1 -0
- package/dist/mocks/SearchResults.d.cts +30 -0
- package/dist/mocks/SearchResults.d.ts +30 -0
- package/dist/mocks/SearchResults.mjs +137 -0
- package/dist/mocks/SearchResults.mjs.map +1 -0
- package/dist/mocks/Tables.cjs +133 -0
- package/dist/mocks/Tables.cjs.map +1 -0
- package/dist/mocks/Tables.d.cts +38 -0
- package/dist/mocks/Tables.d.ts +38 -0
- package/dist/mocks/Tables.mjs +131 -0
- package/dist/mocks/Tables.mjs.map +1 -0
- package/dist/mocks/Tags.cjs +142 -0
- package/dist/mocks/Tags.cjs.map +1 -0
- package/dist/mocks/Tags.d.cts +5 -0
- package/dist/mocks/Tags.d.ts +5 -0
- package/dist/mocks/Tags.mjs +140 -0
- package/dist/mocks/Tags.mjs.map +1 -0
- package/dist/mocks/index.cjs +566 -0
- package/dist/mocks/index.cjs.map +1 -0
- package/dist/mocks/index.d.cts +8 -0
- package/dist/mocks/index.d.ts +8 -0
- package/dist/mocks/index.mjs +555 -0
- package/dist/mocks/index.mjs.map +1 -0
- package/dist/mocks.cjs +566 -0
- package/dist/mocks.cjs.map +1 -0
- package/dist/mocks.d.cts +8 -0
- package/dist/mocks.d.ts +8 -0
- package/dist/mocks.mjs +555 -0
- package/dist/mocks.mjs.map +1 -0
- package/dist/types/event.cjs +4 -0
- package/dist/types/event.cjs.map +1 -0
- package/dist/types/event.d.cts +37 -0
- package/dist/types/event.d.ts +37 -0
- package/dist/types/event.mjs +3 -0
- package/dist/types/event.mjs.map +1 -0
- package/dist/types/index.cjs +4 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +6 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.mjs +3 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types/player.cjs +4 -0
- package/dist/types/player.cjs.map +1 -0
- package/dist/types/player.d.cts +20 -0
- package/dist/types/player.d.ts +20 -0
- package/dist/types/player.mjs +3 -0
- package/dist/types/player.mjs.map +1 -0
- package/dist/types/search.cjs +4 -0
- package/dist/types/search.cjs.map +1 -0
- package/dist/types/search.d.cts +20 -0
- package/dist/types/search.d.ts +20 -0
- package/dist/types/search.mjs +3 -0
- package/dist/types/search.mjs.map +1 -0
- package/dist/types/table.cjs +4 -0
- package/dist/types/table.cjs.map +1 -0
- package/dist/types/table.d.cts +21 -0
- package/dist/types/table.d.ts +21 -0
- package/dist/types/table.mjs +3 -0
- package/dist/types/table.mjs.map +1 -0
- package/dist/types/tables.cjs +4 -0
- package/dist/types/tables.cjs.map +1 -0
- package/dist/types/tables.d.cts +21 -0
- package/dist/types/tables.d.ts +21 -0
- package/dist/types/tables.mjs +3 -0
- package/dist/types/tables.mjs.map +1 -0
- package/dist/types/tag.cjs +4 -0
- package/dist/types/tag.cjs.map +1 -0
- package/dist/types/tag.d.cts +14 -0
- package/dist/types/tag.d.ts +14 -0
- package/dist/types/tag.mjs +3 -0
- package/dist/types/tag.mjs.map +1 -0
- package/dist/types.cjs +4 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +6 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.mjs +3 -0
- package/dist/types.mjs.map +1 -0
- package/package.json +117 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2529 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React7, { createContext, useState, useEffect, useContext, useMemo, useRef } from 'react';
|
|
3
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import { Box, Grid, TextField, Tooltip, IconButton, Button, CircularProgress, Dialog, DialogTitle, DialogContent, DialogActions, Card, CardContent, Typography, FormControl, InputLabel, Select, MenuItem, Chip, LinearProgress, CardMedia, useTheme, useMediaQuery, CardHeader } from '@mui/material';
|
|
5
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
6
|
+
import EditIcon from '@mui/icons-material/Edit';
|
|
7
|
+
import AddIcon from '@mui/icons-material/Add';
|
|
8
|
+
import ColorizeIcon from '@mui/icons-material/Colorize';
|
|
9
|
+
import CancelIcon from '@mui/icons-material/Cancel';
|
|
10
|
+
import CheckCircleIcon from '@mui/icons-material/CheckCircle';
|
|
11
|
+
import Box2 from '@mui/material/Box';
|
|
12
|
+
import Grid9 from '@mui/material/Grid';
|
|
13
|
+
import Card10 from '@mui/material/Card';
|
|
14
|
+
import CardContent10 from '@mui/material/CardContent';
|
|
15
|
+
import CardHeader4 from '@mui/material/CardHeader';
|
|
16
|
+
import Divider2 from '@mui/material/Divider';
|
|
17
|
+
import Avatar from '@mui/material/Avatar';
|
|
18
|
+
import CasinoIcon from '@mui/icons-material/Casino';
|
|
19
|
+
import CalendarTodayIcon from '@mui/icons-material/CalendarToday';
|
|
20
|
+
import LocationOnIcon from '@mui/icons-material/LocationOn';
|
|
21
|
+
import EventIcon from '@mui/icons-material/Event';
|
|
22
|
+
import Autocomplete from '@mui/material/Autocomplete';
|
|
23
|
+
import Popper from '@mui/material/Popper';
|
|
24
|
+
import TextField3 from '@mui/material/TextField';
|
|
25
|
+
import Typography10 from '@mui/material/Typography';
|
|
26
|
+
import FormControl2 from '@mui/material/FormControl';
|
|
27
|
+
import RadioGroup from '@mui/material/RadioGroup';
|
|
28
|
+
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
29
|
+
import Radio from '@mui/material/Radio';
|
|
30
|
+
import FormGroup from '@mui/material/FormGroup';
|
|
31
|
+
import Checkbox from '@mui/material/Checkbox';
|
|
32
|
+
import Button7 from '@mui/material/Button';
|
|
33
|
+
import SearchIcon from '@mui/icons-material/Search';
|
|
34
|
+
import Image2 from 'next/image';
|
|
35
|
+
import ListIcon from '@mui/icons-material/List';
|
|
36
|
+
import SaveIcon from '@mui/icons-material/Save';
|
|
37
|
+
|
|
38
|
+
// src/components/EventPage/editMode/EventBannerEdit.tsx
|
|
39
|
+
var defaultValue = {
|
|
40
|
+
isOwner: false,
|
|
41
|
+
updateEvent: async () => false,
|
|
42
|
+
updateImages: () => {
|
|
43
|
+
},
|
|
44
|
+
event: null
|
|
45
|
+
};
|
|
46
|
+
var EventEditContext = createContext(defaultValue);
|
|
47
|
+
function EventEditProvider({
|
|
48
|
+
value,
|
|
49
|
+
initialEvent,
|
|
50
|
+
children
|
|
51
|
+
}) {
|
|
52
|
+
const [event, setEvent] = useState(initialEvent);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
setEvent(initialEvent);
|
|
55
|
+
}, [initialEvent]);
|
|
56
|
+
const handleUpdateEvent = async (patch) => {
|
|
57
|
+
if (value == null ? void 0 : value.updateEvent) {
|
|
58
|
+
const result = value.updateEvent(patch);
|
|
59
|
+
if (result instanceof Promise) {
|
|
60
|
+
const success = await result;
|
|
61
|
+
if (success) {
|
|
62
|
+
setEvent((prev) => ({ ...prev, ...patch }));
|
|
63
|
+
}
|
|
64
|
+
return success;
|
|
65
|
+
} else {
|
|
66
|
+
const success = result === false ? false : true;
|
|
67
|
+
if (success) {
|
|
68
|
+
setEvent((prev) => ({ ...prev, ...patch }));
|
|
69
|
+
}
|
|
70
|
+
return success;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
};
|
|
75
|
+
const mergedValue = {
|
|
76
|
+
...defaultValue,
|
|
77
|
+
...value,
|
|
78
|
+
event,
|
|
79
|
+
updateEvent: handleUpdateEvent
|
|
80
|
+
};
|
|
81
|
+
return /* @__PURE__ */ jsx(EventEditContext.Provider, { value: mergedValue, children });
|
|
82
|
+
}
|
|
83
|
+
function useEventEdit() {
|
|
84
|
+
const context = useContext(EventEditContext);
|
|
85
|
+
if (!context) {
|
|
86
|
+
throw new Error("useEventEdit must be used within an EventEditProvider");
|
|
87
|
+
}
|
|
88
|
+
return context;
|
|
89
|
+
}
|
|
90
|
+
function generateTagsDisplay(tag) {
|
|
91
|
+
return /* @__PURE__ */ jsx(
|
|
92
|
+
"span",
|
|
93
|
+
{
|
|
94
|
+
className: "inline-block text-sm px-3 py-1 rounded-full outline-black outline-2 font-outlined",
|
|
95
|
+
style: {
|
|
96
|
+
marginTop: "6px",
|
|
97
|
+
marginRight: "6px",
|
|
98
|
+
marginBottom: "6px",
|
|
99
|
+
background: tag.color || "#bfbcbb",
|
|
100
|
+
color: "white",
|
|
101
|
+
textShadow: "black 0.2em 0.2em 0.4em"
|
|
102
|
+
},
|
|
103
|
+
children: tag.label
|
|
104
|
+
},
|
|
105
|
+
tag.id
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
function renderTagsFromIds(ids, legalTags) {
|
|
109
|
+
if (!ids || !legalTags || legalTags.length === 0) {
|
|
110
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
111
|
+
}
|
|
112
|
+
const validTags = ids.map((id) => legalTags.find((tag) => tag.id === id)).filter((tag) => Boolean(tag));
|
|
113
|
+
return validTags.map((tag) => generateTagsDisplay(tag));
|
|
114
|
+
}
|
|
115
|
+
function EventBannerEdit({
|
|
116
|
+
initialValue,
|
|
117
|
+
onCancel,
|
|
118
|
+
onSave
|
|
119
|
+
}) {
|
|
120
|
+
const { updateImages } = useEventEdit();
|
|
121
|
+
const [title, setTitle] = useState(initialValue.title);
|
|
122
|
+
const [bannerColor, setBannerColor] = useState(initialValue.bannerColor || "");
|
|
123
|
+
const [desktopBanner, setDesktopBanner] = useState(initialValue.bannerUrl.desktop);
|
|
124
|
+
const [mobileBanner, setMobileBanner] = useState(initialValue.bannerUrl.mobile || "");
|
|
125
|
+
const [links, setLinks] = useState(initialValue.links);
|
|
126
|
+
const [linkToEdit, setLinkToEdit] = useState(null);
|
|
127
|
+
const [isSaving, setIsSaving] = useState(false);
|
|
128
|
+
const backgroundColor = bannerColor || "linear-gradient(135deg, rgba(25,118,210,0.8), rgba(25,118,210,1))";
|
|
129
|
+
const handleSave = async () => {
|
|
130
|
+
setIsSaving(true);
|
|
131
|
+
try {
|
|
132
|
+
const patch = {};
|
|
133
|
+
if (title !== initialValue.title) {
|
|
134
|
+
patch.title = title;
|
|
135
|
+
}
|
|
136
|
+
const currentBannerColor = bannerColor || void 0;
|
|
137
|
+
const initialBannerColor = initialValue.bannerColor || void 0;
|
|
138
|
+
if (currentBannerColor !== initialBannerColor) {
|
|
139
|
+
patch.bannerColor = currentBannerColor;
|
|
140
|
+
}
|
|
141
|
+
const currentMobile = mobileBanner || void 0;
|
|
142
|
+
const initialMobile = initialValue.bannerUrl.mobile || void 0;
|
|
143
|
+
if (desktopBanner !== initialValue.bannerUrl.desktop || currentMobile !== initialMobile) {
|
|
144
|
+
patch.bannerUrl = {
|
|
145
|
+
desktop: desktopBanner,
|
|
146
|
+
mobile: currentMobile
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
if (JSON.stringify(links) !== JSON.stringify(initialValue.links)) {
|
|
150
|
+
patch.links = links;
|
|
151
|
+
}
|
|
152
|
+
if (Object.keys(patch).length > 0) {
|
|
153
|
+
await onSave(patch);
|
|
154
|
+
} else {
|
|
155
|
+
onCancel();
|
|
156
|
+
}
|
|
157
|
+
} catch (error) {
|
|
158
|
+
console.error("Failed to save banner changes", error);
|
|
159
|
+
} finally {
|
|
160
|
+
setIsSaving(false);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const removeLink = (index) => {
|
|
164
|
+
setLinks(links.filter((_, i) => i !== index));
|
|
165
|
+
};
|
|
166
|
+
const openEditLink = (index) => {
|
|
167
|
+
setLinkToEdit({
|
|
168
|
+
index,
|
|
169
|
+
text: links[index].text,
|
|
170
|
+
url: links[index].url
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
const saveEditedLink = () => {
|
|
174
|
+
if (linkToEdit) {
|
|
175
|
+
const newLinks = [...links];
|
|
176
|
+
if (linkToEdit.index === -1) {
|
|
177
|
+
newLinks.push({ text: linkToEdit.text, url: linkToEdit.url });
|
|
178
|
+
} else {
|
|
179
|
+
newLinks[linkToEdit.index] = { text: linkToEdit.text, url: linkToEdit.url };
|
|
180
|
+
}
|
|
181
|
+
setLinks(newLinks);
|
|
182
|
+
setLinkToEdit(null);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
const handleEyeDropper = async () => {
|
|
186
|
+
if (!window.EyeDropper) {
|
|
187
|
+
alert("EyeDropper API is not supported in this browser");
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const eyeDropper = new window.EyeDropper();
|
|
191
|
+
try {
|
|
192
|
+
const result = await eyeDropper.open();
|
|
193
|
+
setBannerColor(result.sRGBHex);
|
|
194
|
+
} catch (e) {
|
|
195
|
+
console.log("EyeDropper cancelled or failed", e);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
return /* @__PURE__ */ jsxs(Box, { sx: { position: "relative", width: "100%" }, children: [
|
|
199
|
+
/* @__PURE__ */ jsxs(
|
|
200
|
+
Grid,
|
|
201
|
+
{
|
|
202
|
+
sx: {
|
|
203
|
+
background: backgroundColor,
|
|
204
|
+
paddingTop: "8px",
|
|
205
|
+
position: "relative",
|
|
206
|
+
border: "2px dashed rgba(255,255,255,0.5)",
|
|
207
|
+
borderRadius: 1
|
|
208
|
+
},
|
|
209
|
+
children: [
|
|
210
|
+
/* @__PURE__ */ jsxs(Box, { sx: {
|
|
211
|
+
position: "absolute",
|
|
212
|
+
top: 8,
|
|
213
|
+
left: 8,
|
|
214
|
+
zIndex: 10,
|
|
215
|
+
display: "flex",
|
|
216
|
+
flexDirection: "column",
|
|
217
|
+
gap: 1,
|
|
218
|
+
bgcolor: "rgba(0,0,0,0.5)",
|
|
219
|
+
p: 1,
|
|
220
|
+
borderRadius: 1,
|
|
221
|
+
width: "300px"
|
|
222
|
+
}, children: [
|
|
223
|
+
/* @__PURE__ */ jsx(
|
|
224
|
+
TextField,
|
|
225
|
+
{
|
|
226
|
+
label: "Title",
|
|
227
|
+
variant: "outlined",
|
|
228
|
+
size: "small",
|
|
229
|
+
value: title,
|
|
230
|
+
onChange: (e) => setTitle(e.target.value),
|
|
231
|
+
sx: { input: { color: "white" }, label: { color: "rgba(255,255,255,0.7)" }, "& .MuiOutlinedInput-root": { "& fieldset": { borderColor: "rgba(255,255,255,0.3)" } } }
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
235
|
+
/* @__PURE__ */ jsx(
|
|
236
|
+
TextField,
|
|
237
|
+
{
|
|
238
|
+
label: "Banner Color",
|
|
239
|
+
variant: "outlined",
|
|
240
|
+
size: "small",
|
|
241
|
+
value: bannerColor,
|
|
242
|
+
onChange: (e) => setBannerColor(e.target.value),
|
|
243
|
+
placeholder: "#HEX or linear-gradient(...)",
|
|
244
|
+
sx: { flex: 1, input: { color: "white" }, label: { color: "rgba(255,255,255,0.7)" }, "& .MuiOutlinedInput-root": { "& fieldset": { borderColor: "rgba(255,255,255,0.3)" } } }
|
|
245
|
+
}
|
|
246
|
+
),
|
|
247
|
+
/* @__PURE__ */ jsx(Tooltip, { title: "Eye Dropper", children: /* @__PURE__ */ jsx(
|
|
248
|
+
IconButton,
|
|
249
|
+
{
|
|
250
|
+
size: "small",
|
|
251
|
+
onClick: handleEyeDropper,
|
|
252
|
+
sx: { color: "white", bgcolor: "rgba(255,255,255,0.1)", "&:hover": { bgcolor: "rgba(255,255,255,0.2)" } },
|
|
253
|
+
children: /* @__PURE__ */ jsx(ColorizeIcon, { fontSize: "small" })
|
|
254
|
+
}
|
|
255
|
+
) }),
|
|
256
|
+
/* @__PURE__ */ jsx(
|
|
257
|
+
"input",
|
|
258
|
+
{
|
|
259
|
+
type: "color",
|
|
260
|
+
value: bannerColor.startsWith("#") ? bannerColor : "#1976d2",
|
|
261
|
+
onChange: (e) => setBannerColor(e.target.value),
|
|
262
|
+
style: { width: "40px", height: "40px", padding: 0, border: "none", background: "transparent", cursor: "pointer" }
|
|
263
|
+
}
|
|
264
|
+
)
|
|
265
|
+
] }),
|
|
266
|
+
/* @__PURE__ */ jsx(Box, { sx: { display: "flex", gap: 1 }, children: /* @__PURE__ */ jsx(
|
|
267
|
+
Button,
|
|
268
|
+
{
|
|
269
|
+
variant: "contained",
|
|
270
|
+
size: "small",
|
|
271
|
+
fullWidth: true,
|
|
272
|
+
onClick: updateImages,
|
|
273
|
+
children: "Update Images"
|
|
274
|
+
}
|
|
275
|
+
) })
|
|
276
|
+
] }),
|
|
277
|
+
/* @__PURE__ */ jsx(
|
|
278
|
+
Box,
|
|
279
|
+
{
|
|
280
|
+
sx: {
|
|
281
|
+
width: "100%",
|
|
282
|
+
height: "auto",
|
|
283
|
+
maxHeight: "250px",
|
|
284
|
+
overflow: "hidden",
|
|
285
|
+
display: "flex",
|
|
286
|
+
justifyContent: "center",
|
|
287
|
+
opacity: 0.8
|
|
288
|
+
},
|
|
289
|
+
children: /* @__PURE__ */ jsx(
|
|
290
|
+
Box,
|
|
291
|
+
{
|
|
292
|
+
component: "img",
|
|
293
|
+
src: desktopBanner,
|
|
294
|
+
alt: title,
|
|
295
|
+
sx: {
|
|
296
|
+
width: "100%",
|
|
297
|
+
height: "auto",
|
|
298
|
+
objectFit: "contain"
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
)
|
|
302
|
+
}
|
|
303
|
+
),
|
|
304
|
+
/* @__PURE__ */ jsxs(
|
|
305
|
+
Grid,
|
|
306
|
+
{
|
|
307
|
+
display: "flex",
|
|
308
|
+
justifyContent: "center",
|
|
309
|
+
alignItems: "center",
|
|
310
|
+
paddingTop: "3px",
|
|
311
|
+
paddingBottom: "3px",
|
|
312
|
+
sx: { gap: 1.5, flexWrap: "wrap" },
|
|
313
|
+
children: [
|
|
314
|
+
/* @__PURE__ */ jsx(Box, { sx: { px: 1.5, py: 0.5, color: "rgba(255,255,255,0.5)", bgcolor: "rgba(0,0,0,0.4)", borderRadius: 2, border: "1px dashed rgba(255,255,255,0.2)" }, children: "Stats Placeholder" }),
|
|
315
|
+
generateTagsDisplay(initialValue.eventTag),
|
|
316
|
+
links.map((link, index) => /* @__PURE__ */ jsxs(
|
|
317
|
+
Box,
|
|
318
|
+
{
|
|
319
|
+
sx: {
|
|
320
|
+
position: "relative",
|
|
321
|
+
display: "flex",
|
|
322
|
+
alignItems: "center",
|
|
323
|
+
px: 1.5,
|
|
324
|
+
py: 0.5,
|
|
325
|
+
color: "#fff",
|
|
326
|
+
bgcolor: "rgba(0,0,0,0.7)",
|
|
327
|
+
borderRadius: 2,
|
|
328
|
+
boxShadow: "0 8px 16px rgba(0,0,0,0.25), 0 2px 4px rgba(0,0,0,0.15)",
|
|
329
|
+
border: "1px solid rgba(255,255,255,0.25)",
|
|
330
|
+
backdropFilter: "blur(6px)",
|
|
331
|
+
fontWeight: 700,
|
|
332
|
+
letterSpacing: 0.2
|
|
333
|
+
},
|
|
334
|
+
children: [
|
|
335
|
+
link.text,
|
|
336
|
+
/* @__PURE__ */ jsxs(Box, { sx: { ml: 1, display: "flex" }, children: [
|
|
337
|
+
/* @__PURE__ */ jsx(Tooltip, { title: "Edit Link", children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => openEditLink(index), sx: { color: "white", p: 0.2 }, children: /* @__PURE__ */ jsx(EditIcon, { fontSize: "inherit" }) }) }),
|
|
338
|
+
/* @__PURE__ */ jsx(Tooltip, { title: "Remove Link", children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => removeLink(index), sx: { color: "error.light", p: 0.2 }, children: /* @__PURE__ */ jsx(DeleteIcon, { fontSize: "inherit" }) }) })
|
|
339
|
+
] })
|
|
340
|
+
]
|
|
341
|
+
},
|
|
342
|
+
index
|
|
343
|
+
)),
|
|
344
|
+
/* @__PURE__ */ jsx(
|
|
345
|
+
Button,
|
|
346
|
+
{
|
|
347
|
+
variant: "outlined",
|
|
348
|
+
size: "small",
|
|
349
|
+
startIcon: /* @__PURE__ */ jsx(AddIcon, {}),
|
|
350
|
+
onClick: () => setLinkToEdit({ index: -1, text: "", url: "" }),
|
|
351
|
+
sx: {
|
|
352
|
+
color: "white",
|
|
353
|
+
borderColor: "rgba(255,255,255,0.5)",
|
|
354
|
+
borderRadius: 2,
|
|
355
|
+
"&:hover": { borderColor: "white", bgcolor: "rgba(255,255,255,0.1)" }
|
|
356
|
+
},
|
|
357
|
+
children: "Add Link"
|
|
358
|
+
}
|
|
359
|
+
)
|
|
360
|
+
]
|
|
361
|
+
}
|
|
362
|
+
)
|
|
363
|
+
]
|
|
364
|
+
}
|
|
365
|
+
),
|
|
366
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", justifyContent: "flex-end", gap: 2, mt: 2 }, children: [
|
|
367
|
+
/* @__PURE__ */ jsx(Button, { onClick: onCancel, color: "inherit", disabled: isSaving, children: "Cancel" }),
|
|
368
|
+
/* @__PURE__ */ jsx(
|
|
369
|
+
Button,
|
|
370
|
+
{
|
|
371
|
+
onClick: handleSave,
|
|
372
|
+
variant: "contained",
|
|
373
|
+
color: "primary",
|
|
374
|
+
disabled: isSaving,
|
|
375
|
+
startIcon: isSaving ? /* @__PURE__ */ jsx(CircularProgress, { size: 20, color: "inherit" }) : null,
|
|
376
|
+
children: isSaving ? "Saving..." : "Save Changes"
|
|
377
|
+
}
|
|
378
|
+
)
|
|
379
|
+
] }),
|
|
380
|
+
/* @__PURE__ */ jsxs(Dialog, { open: linkToEdit !== null, onClose: () => setLinkToEdit(null), children: [
|
|
381
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: (linkToEdit == null ? void 0 : linkToEdit.index) === -1 ? "Add Link" : "Edit Link" }),
|
|
382
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", gap: 2, pt: 1, width: "400px" }, children: [
|
|
383
|
+
/* @__PURE__ */ jsx(
|
|
384
|
+
TextField,
|
|
385
|
+
{
|
|
386
|
+
label: "Link Text",
|
|
387
|
+
fullWidth: true,
|
|
388
|
+
value: (linkToEdit == null ? void 0 : linkToEdit.text) || "",
|
|
389
|
+
onChange: (e) => setLinkToEdit((prev) => prev ? { ...prev, text: e.target.value } : null)
|
|
390
|
+
}
|
|
391
|
+
),
|
|
392
|
+
/* @__PURE__ */ jsx(
|
|
393
|
+
TextField,
|
|
394
|
+
{
|
|
395
|
+
label: "Link URL",
|
|
396
|
+
fullWidth: true,
|
|
397
|
+
value: (linkToEdit == null ? void 0 : linkToEdit.url) || "",
|
|
398
|
+
onChange: (e) => setLinkToEdit((prev) => prev ? { ...prev, url: e.target.value } : null)
|
|
399
|
+
}
|
|
400
|
+
)
|
|
401
|
+
] }) }),
|
|
402
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
403
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => setLinkToEdit(null), children: "Cancel" }),
|
|
404
|
+
/* @__PURE__ */ jsx(Button, { onClick: saveEditedLink, variant: "contained", children: "Confirm" })
|
|
405
|
+
] })
|
|
406
|
+
] })
|
|
407
|
+
] });
|
|
408
|
+
}
|
|
409
|
+
var CANDIDATE_TIMEZONES = [
|
|
410
|
+
"America/New_York",
|
|
411
|
+
"America/Chicago",
|
|
412
|
+
"America/Denver",
|
|
413
|
+
"America/Los_Angeles",
|
|
414
|
+
"America/Anchorage",
|
|
415
|
+
"America/Adak",
|
|
416
|
+
"Pacific/Honolulu",
|
|
417
|
+
"UTC"
|
|
418
|
+
];
|
|
419
|
+
function EventBasicInfo(props) {
|
|
420
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
421
|
+
const { isOwner, updateEvent, event } = useEventEdit();
|
|
422
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
423
|
+
const description = (_b = (_a = props.description) != null ? _a : event == null ? void 0 : event.description) != null ? _b : "";
|
|
424
|
+
const startingDate = (_c = props.startingDate) != null ? _c : event == null ? void 0 : event.startingDate;
|
|
425
|
+
const endingDate = (_d = props.endingDate) != null ? _d : event == null ? void 0 : event.endingDate;
|
|
426
|
+
const timeInfo = (_f = (_e = props.timeInfo) != null ? _e : event == null ? void 0 : event.date) != null ? _f : "";
|
|
427
|
+
const timezone = (_h = (_g = props.timezone) != null ? _g : event == null ? void 0 : event.timezone) != null ? _h : "UTC";
|
|
428
|
+
if (isEditing) {
|
|
429
|
+
return /* @__PURE__ */ jsx(
|
|
430
|
+
EventBasicInfoEdit,
|
|
431
|
+
{
|
|
432
|
+
initialValue: {
|
|
433
|
+
description,
|
|
434
|
+
startingDate: typeof startingDate === "string" ? startingDate : startingDate == null ? void 0 : startingDate.toISOString(),
|
|
435
|
+
endingDate: typeof endingDate === "string" ? endingDate : endingDate == null ? void 0 : endingDate.toISOString(),
|
|
436
|
+
date: timeInfo,
|
|
437
|
+
timezone
|
|
438
|
+
},
|
|
439
|
+
onCancel: () => setIsEditing(false),
|
|
440
|
+
onSave: async (payload) => {
|
|
441
|
+
const success = await updateEvent(payload);
|
|
442
|
+
if (success) {
|
|
443
|
+
setIsEditing(false);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
return /* @__PURE__ */ jsx(
|
|
450
|
+
EventBasicInfoView,
|
|
451
|
+
{
|
|
452
|
+
...props,
|
|
453
|
+
description,
|
|
454
|
+
startingDate,
|
|
455
|
+
endingDate,
|
|
456
|
+
timeInfo,
|
|
457
|
+
timezone,
|
|
458
|
+
isOwner,
|
|
459
|
+
onEdit: () => setIsEditing(true)
|
|
460
|
+
}
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
function EventBasicInfoView({ description, locationId, startingDate, endingDate, timeInfo, timezone, isOwner, onEdit }) {
|
|
464
|
+
return /* @__PURE__ */ jsx(Grid9, { sx: { position: "relative" }, children: /* @__PURE__ */ jsx(Card, { style: {
|
|
465
|
+
boxShadow: "0px 4px 10px rgba(0, 0, 0, 0.1)",
|
|
466
|
+
background: "linear-gradient(135deg, rgba(225, 225, 225, 1), rgba(250, 250, 250, 1))"
|
|
467
|
+
}, children: /* @__PURE__ */ jsxs(CardContent, { children: [
|
|
468
|
+
isOwner && /* @__PURE__ */ jsx(Box2, { sx: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ jsx(Button, { size: "small", onClick: onEdit, variant: "outlined", children: "Edit" }) }),
|
|
469
|
+
generateTimeInfo(timeInfo, timezone || "UTC", startingDate, endingDate),
|
|
470
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h5", paddingTop: 2, children: "About:" }),
|
|
471
|
+
/* @__PURE__ */ jsx(Typography, { sx: { whiteSpace: "pre-wrap" }, paddingTop: 1, children: description }),
|
|
472
|
+
getLocation()
|
|
473
|
+
] }) }) });
|
|
474
|
+
}
|
|
475
|
+
var generateTimeInfo = function(timeInfo, timezone, startingDate, endingDate) {
|
|
476
|
+
const formatDateTime = (dateInput) => {
|
|
477
|
+
const d = typeof dateInput === "string" ? new Date(dateInput) : dateInput;
|
|
478
|
+
if (!d || isNaN(d.getTime())) return "";
|
|
479
|
+
try {
|
|
480
|
+
return new Intl.DateTimeFormat("en-US", {
|
|
481
|
+
month: "short",
|
|
482
|
+
day: "numeric",
|
|
483
|
+
year: "numeric",
|
|
484
|
+
hour: "numeric",
|
|
485
|
+
minute: "2-digit",
|
|
486
|
+
hour12: true,
|
|
487
|
+
timeZone: timezone,
|
|
488
|
+
timeZoneName: "shortGeneric"
|
|
489
|
+
}).format(d).replace(",", " @");
|
|
490
|
+
} catch (e) {
|
|
491
|
+
return d.toUTCString();
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
let rangeText = null;
|
|
495
|
+
if (startingDate && endingDate) {
|
|
496
|
+
rangeText = `From ${formatDateTime(startingDate)}
|
|
497
|
+
Until ${formatDateTime(endingDate)}`;
|
|
498
|
+
} else if (startingDate) {
|
|
499
|
+
rangeText = `starting ${formatDateTime(startingDate)}`;
|
|
500
|
+
} else if (endingDate) {
|
|
501
|
+
rangeText = `until ${formatDateTime(endingDate)}`;
|
|
502
|
+
}
|
|
503
|
+
return /* @__PURE__ */ jsxs(Box2, { sx: { mt: 2 }, children: [
|
|
504
|
+
rangeText && /* @__PURE__ */ jsx(Typography, { variant: "body1", fontSize: "x-large", fontWeight: "bold", sx: { whiteSpace: "pre-wrap" }, children: rangeText }),
|
|
505
|
+
timeInfo && /* @__PURE__ */ jsxs(Box2, { sx: { mt: 1 }, children: [
|
|
506
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h5", children: "Hours of Operation:" }),
|
|
507
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", sx: { whiteSpace: "pre-wrap" }, children: timeInfo })
|
|
508
|
+
] })
|
|
509
|
+
] });
|
|
510
|
+
};
|
|
511
|
+
var getLocation = function(locationId) {
|
|
512
|
+
return /* @__PURE__ */ jsx(Box2, { sx: {
|
|
513
|
+
width: "100%",
|
|
514
|
+
p: 1.5,
|
|
515
|
+
borderRadius: 2,
|
|
516
|
+
boxShadow: "0px 4px 10px rgba(0, 0, 0, 0.1)",
|
|
517
|
+
background: "linear-gradient(135deg, rgba(180, 180,180, 1), rgba(225, 225, 225, 0.8))",
|
|
518
|
+
mt: 2
|
|
519
|
+
}, children: "Location Data goes here" });
|
|
520
|
+
};
|
|
521
|
+
function EventBasicInfoEdit({
|
|
522
|
+
initialValue,
|
|
523
|
+
onCancel,
|
|
524
|
+
onSave
|
|
525
|
+
}) {
|
|
526
|
+
const toWallTimeISO = (dateInput, timeZone) => {
|
|
527
|
+
if (!dateInput) return "";
|
|
528
|
+
const d = new Date(dateInput);
|
|
529
|
+
if (isNaN(d.getTime())) return "";
|
|
530
|
+
const parts = new Intl.DateTimeFormat("en-US", {
|
|
531
|
+
year: "numeric",
|
|
532
|
+
month: "2-digit",
|
|
533
|
+
day: "2-digit",
|
|
534
|
+
hour: "2-digit",
|
|
535
|
+
minute: "2-digit",
|
|
536
|
+
hour12: false,
|
|
537
|
+
timeZone
|
|
538
|
+
}).formatToParts(d);
|
|
539
|
+
const f = (type) => {
|
|
540
|
+
var _a;
|
|
541
|
+
return (_a = parts.find((p) => p.type === type)) == null ? void 0 : _a.value;
|
|
542
|
+
};
|
|
543
|
+
const year = f("year");
|
|
544
|
+
const month = f("month");
|
|
545
|
+
const day = f("day");
|
|
546
|
+
let hour = f("hour");
|
|
547
|
+
if (hour === "24") hour = "00";
|
|
548
|
+
const minute = f("minute");
|
|
549
|
+
return `${year}-${month}-${day}T${hour}:${minute}`;
|
|
550
|
+
};
|
|
551
|
+
const toUTCISOString = (wallTime, timeZone) => {
|
|
552
|
+
var _a;
|
|
553
|
+
if (!wallTime) return void 0;
|
|
554
|
+
const d = /* @__PURE__ */ new Date(wallTime + ":00Z");
|
|
555
|
+
const parts = new Intl.DateTimeFormat("en-US", {
|
|
556
|
+
timeZone,
|
|
557
|
+
timeZoneName: "longOffset"
|
|
558
|
+
}).formatToParts(d);
|
|
559
|
+
const offsetPart = ((_a = parts.find((p) => p.type === "timeZoneName")) == null ? void 0 : _a.value) || "GMT";
|
|
560
|
+
const offset = offsetPart.replace("GMT", "");
|
|
561
|
+
const isoWithOffset = `${wallTime}:00${offset || "+00:00"}`;
|
|
562
|
+
return new Date(isoWithOffset).toISOString();
|
|
563
|
+
};
|
|
564
|
+
const [description, setDescription] = useState(initialValue.description);
|
|
565
|
+
const [timezone, setTimezone] = useState(initialValue.timezone);
|
|
566
|
+
const [startingDate, setStartingDate] = useState(toWallTimeISO(initialValue.startingDate, initialValue.timezone));
|
|
567
|
+
const [endingDate, setEndingDate] = useState(toWallTimeISO(initialValue.endingDate, initialValue.timezone));
|
|
568
|
+
const [timeInfo, setTimeInfo] = useState(initialValue.date);
|
|
569
|
+
const [isSaving, setIsSaving] = useState(false);
|
|
570
|
+
const handleSave = async () => {
|
|
571
|
+
setIsSaving(true);
|
|
572
|
+
try {
|
|
573
|
+
const patch = {};
|
|
574
|
+
if (description !== initialValue.description) patch.description = description;
|
|
575
|
+
if (timeInfo !== initialValue.date) patch.date = timeInfo;
|
|
576
|
+
if (timezone !== initialValue.timezone) patch.timezone = timezone;
|
|
577
|
+
if (startingDate !== toWallTimeISO(initialValue.startingDate, timezone) || timezone !== initialValue.timezone) {
|
|
578
|
+
patch.startingDate = toUTCISOString(startingDate, timezone);
|
|
579
|
+
}
|
|
580
|
+
if (endingDate !== toWallTimeISO(initialValue.endingDate, timezone) || timezone !== initialValue.timezone) {
|
|
581
|
+
patch.endingDate = toUTCISOString(endingDate, timezone);
|
|
582
|
+
}
|
|
583
|
+
if (Object.keys(patch).length > 0) {
|
|
584
|
+
await onSave(patch);
|
|
585
|
+
} else {
|
|
586
|
+
onCancel();
|
|
587
|
+
}
|
|
588
|
+
} catch (error) {
|
|
589
|
+
console.error("Failed to save basic info changes", error);
|
|
590
|
+
} finally {
|
|
591
|
+
setIsSaving(false);
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
return /* @__PURE__ */ jsx(Card, { sx: {
|
|
595
|
+
boxShadow: "0px 4px 10px rgba(0, 0, 0, 0.1)",
|
|
596
|
+
background: "linear-gradient(135deg, rgba(225, 225, 225, 1), rgba(250, 250, 250, 1))",
|
|
597
|
+
border: "2px dashed rgba(25,118,210,0.5)",
|
|
598
|
+
width: "100%"
|
|
599
|
+
}, children: /* @__PURE__ */ jsxs(CardContent, { sx: { position: "relative" }, children: [
|
|
600
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", justifyContent: "flex-end", mb: 1, gap: 1 }, children: [
|
|
601
|
+
/* @__PURE__ */ jsx(Tooltip, { title: "Cancel", children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: onCancel, color: "error", disabled: isSaving, children: /* @__PURE__ */ jsx(CancelIcon, {}) }) }),
|
|
602
|
+
/* @__PURE__ */ jsx(Tooltip, { title: "Apply Changes", children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: handleSave, color: "primary", disabled: isSaving, children: isSaving ? /* @__PURE__ */ jsx(CircularProgress, { size: 24 }) : /* @__PURE__ */ jsx(CheckCircleIcon, {}) }) })
|
|
603
|
+
] }),
|
|
604
|
+
/* @__PURE__ */ jsxs(Box, { sx: { mt: 2 }, children: [
|
|
605
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", fontSize: "x-large", fontWeight: "bold", sx: { mb: 1 }, children: "Event Dates & Times:" }),
|
|
606
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
|
|
607
|
+
/* @__PURE__ */ jsx(Grid, { size: { xs: 12, sm: 4 }, children: /* @__PURE__ */ jsx(
|
|
608
|
+
TextField,
|
|
609
|
+
{
|
|
610
|
+
fullWidth: true,
|
|
611
|
+
label: "Starting Date",
|
|
612
|
+
type: "datetime-local",
|
|
613
|
+
size: "small",
|
|
614
|
+
value: startingDate,
|
|
615
|
+
onChange: (e) => setStartingDate(e.target.value),
|
|
616
|
+
InputLabelProps: { shrink: true }
|
|
617
|
+
}
|
|
618
|
+
) }),
|
|
619
|
+
/* @__PURE__ */ jsx(Grid, { size: { xs: 12, sm: 4 }, children: /* @__PURE__ */ jsx(
|
|
620
|
+
TextField,
|
|
621
|
+
{
|
|
622
|
+
fullWidth: true,
|
|
623
|
+
label: "Ending Date",
|
|
624
|
+
type: "datetime-local",
|
|
625
|
+
size: "small",
|
|
626
|
+
value: endingDate,
|
|
627
|
+
onChange: (e) => setEndingDate(e.target.value),
|
|
628
|
+
InputLabelProps: { shrink: true }
|
|
629
|
+
}
|
|
630
|
+
) }),
|
|
631
|
+
/* @__PURE__ */ jsx(Grid, { size: { xs: 12, sm: 4 }, children: /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, size: "small", children: [
|
|
632
|
+
/* @__PURE__ */ jsx(InputLabel, { children: "Display Timezone" }),
|
|
633
|
+
/* @__PURE__ */ jsx(
|
|
634
|
+
Select,
|
|
635
|
+
{
|
|
636
|
+
label: "Display Timezone",
|
|
637
|
+
value: timezone,
|
|
638
|
+
onChange: (e) => setTimezone(e.target.value),
|
|
639
|
+
children: CANDIDATE_TIMEZONES.map((tz) => /* @__PURE__ */ jsx(MenuItem, { value: tz, children: tz }, tz))
|
|
640
|
+
}
|
|
641
|
+
)
|
|
642
|
+
] }) })
|
|
643
|
+
] }),
|
|
644
|
+
/* @__PURE__ */ jsxs(Box, { sx: { mt: 2 }, children: [
|
|
645
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h5", children: "Hours of Operation:" }),
|
|
646
|
+
/* @__PURE__ */ jsx(
|
|
647
|
+
TextField,
|
|
648
|
+
{
|
|
649
|
+
fullWidth: true,
|
|
650
|
+
multiline: true,
|
|
651
|
+
variant: "standard",
|
|
652
|
+
placeholder: "e.g. Mon-Fri 9am-5pm",
|
|
653
|
+
value: timeInfo,
|
|
654
|
+
onChange: (e) => setTimeInfo(e.target.value),
|
|
655
|
+
sx: { mt: 1 }
|
|
656
|
+
}
|
|
657
|
+
)
|
|
658
|
+
] })
|
|
659
|
+
] }),
|
|
660
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h5", paddingTop: 2, children: "About:" }),
|
|
661
|
+
/* @__PURE__ */ jsx(
|
|
662
|
+
TextField,
|
|
663
|
+
{
|
|
664
|
+
fullWidth: true,
|
|
665
|
+
multiline: true,
|
|
666
|
+
variant: "standard",
|
|
667
|
+
value: description,
|
|
668
|
+
onChange: (e) => setDescription(e.target.value),
|
|
669
|
+
sx: {
|
|
670
|
+
paddingTop: 1,
|
|
671
|
+
"& .MuiInputBase-root": {
|
|
672
|
+
lineHeight: 1.5,
|
|
673
|
+
whiteSpace: "pre-wrap"
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
),
|
|
678
|
+
/* @__PURE__ */ jsx(Box, { sx: {
|
|
679
|
+
mt: 2,
|
|
680
|
+
width: "100%",
|
|
681
|
+
p: 1.5,
|
|
682
|
+
borderRadius: 2,
|
|
683
|
+
boxShadow: "0px 4px 10px rgba(0, 0, 0, 0.1)",
|
|
684
|
+
background: "linear-gradient(135deg, rgba(180, 180,180, 1), rgba(225, 225, 225, 0.8))",
|
|
685
|
+
color: "rgba(0,0,0,0.5)",
|
|
686
|
+
border: "1px dashed rgba(0,0,0,0.2)"
|
|
687
|
+
}, children: "Location Data (Not Editable)" })
|
|
688
|
+
] }) });
|
|
689
|
+
}
|
|
690
|
+
function EventBanner(props) {
|
|
691
|
+
const { isOwner, updateEvent, event } = useEventEdit();
|
|
692
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
693
|
+
if (!event && !props.bannerUrl) return null;
|
|
694
|
+
const bannerUrl = props.bannerUrl || (event == null ? void 0 : event.bannerUrl);
|
|
695
|
+
const links = props.links || (event == null ? void 0 : event.links) || [];
|
|
696
|
+
const title = props.title || (event == null ? void 0 : event.title) || "";
|
|
697
|
+
const eventTag = props.eventTag || (event == null ? void 0 : event.eventTag);
|
|
698
|
+
const bannerColor = props.bannerColor || (event == null ? void 0 : event.bannerColor);
|
|
699
|
+
if (!bannerUrl || !eventTag) return null;
|
|
700
|
+
if (isEditing) {
|
|
701
|
+
return /* @__PURE__ */ jsx(
|
|
702
|
+
EventBannerEdit,
|
|
703
|
+
{
|
|
704
|
+
initialValue: {
|
|
705
|
+
bannerUrl,
|
|
706
|
+
bannerColor,
|
|
707
|
+
links,
|
|
708
|
+
title,
|
|
709
|
+
eventTag
|
|
710
|
+
},
|
|
711
|
+
onCancel: () => setIsEditing(false),
|
|
712
|
+
onSave: async (payload) => {
|
|
713
|
+
const success = await updateEvent(payload);
|
|
714
|
+
if (success) {
|
|
715
|
+
setIsEditing(false);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
);
|
|
720
|
+
}
|
|
721
|
+
return /* @__PURE__ */ jsx(
|
|
722
|
+
EventBannerView,
|
|
723
|
+
{
|
|
724
|
+
...props,
|
|
725
|
+
bannerUrl,
|
|
726
|
+
links,
|
|
727
|
+
title,
|
|
728
|
+
eventTag,
|
|
729
|
+
bannerColor,
|
|
730
|
+
isOwner,
|
|
731
|
+
onEdit: () => setIsEditing(true)
|
|
732
|
+
}
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
function EventBannerView({
|
|
736
|
+
bannerUrl,
|
|
737
|
+
links,
|
|
738
|
+
bannerColor,
|
|
739
|
+
title,
|
|
740
|
+
eventTag,
|
|
741
|
+
attendees,
|
|
742
|
+
numGames,
|
|
743
|
+
isOwner,
|
|
744
|
+
onEdit
|
|
745
|
+
}) {
|
|
746
|
+
const backgroundColor = bannerColor || "linear-gradient(135deg, rgba(25,118,210,0.8), rgba(25,118,210,1))";
|
|
747
|
+
return /* @__PURE__ */ jsxs(
|
|
748
|
+
Grid9,
|
|
749
|
+
{
|
|
750
|
+
sx: {
|
|
751
|
+
background: backgroundColor,
|
|
752
|
+
paddingTop: "8px",
|
|
753
|
+
position: "relative"
|
|
754
|
+
},
|
|
755
|
+
children: [
|
|
756
|
+
/* @__PURE__ */ jsxs(Grid9, { children: [
|
|
757
|
+
/* @__PURE__ */ jsxs(
|
|
758
|
+
Box,
|
|
759
|
+
{
|
|
760
|
+
sx: {
|
|
761
|
+
width: "100%",
|
|
762
|
+
height: "auto",
|
|
763
|
+
maxHeight: "250px",
|
|
764
|
+
overflow: "hidden",
|
|
765
|
+
display: "flex",
|
|
766
|
+
justifyContent: "center"
|
|
767
|
+
},
|
|
768
|
+
children: [
|
|
769
|
+
/* @__PURE__ */ jsx(
|
|
770
|
+
Box,
|
|
771
|
+
{
|
|
772
|
+
component: "img",
|
|
773
|
+
src: bannerUrl.desktop,
|
|
774
|
+
alt: title,
|
|
775
|
+
sx: {
|
|
776
|
+
width: "100%",
|
|
777
|
+
height: "auto",
|
|
778
|
+
objectFit: "contain",
|
|
779
|
+
display: { xs: "none", md: "block" }
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
),
|
|
783
|
+
bannerUrl.mobile && /* @__PURE__ */ jsx(
|
|
784
|
+
Box,
|
|
785
|
+
{
|
|
786
|
+
component: "img",
|
|
787
|
+
src: bannerUrl.mobile,
|
|
788
|
+
alt: title,
|
|
789
|
+
sx: {
|
|
790
|
+
width: "100%",
|
|
791
|
+
height: "auto",
|
|
792
|
+
objectFit: "contain",
|
|
793
|
+
display: { xs: "block", md: "none" }
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
),
|
|
797
|
+
!bannerUrl.mobile && /* @__PURE__ */ jsx(
|
|
798
|
+
Box,
|
|
799
|
+
{
|
|
800
|
+
component: "img",
|
|
801
|
+
src: bannerUrl.desktop,
|
|
802
|
+
alt: title,
|
|
803
|
+
sx: {
|
|
804
|
+
width: "100%",
|
|
805
|
+
height: "auto",
|
|
806
|
+
objectFit: "contain",
|
|
807
|
+
display: { xs: "block", md: "none" }
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
)
|
|
811
|
+
]
|
|
812
|
+
}
|
|
813
|
+
),
|
|
814
|
+
/* @__PURE__ */ jsxs(
|
|
815
|
+
Grid9,
|
|
816
|
+
{
|
|
817
|
+
display: "flex",
|
|
818
|
+
justifyContent: "center",
|
|
819
|
+
alignItems: "center",
|
|
820
|
+
paddingTop: "3px",
|
|
821
|
+
paddingBottom: "3px",
|
|
822
|
+
sx: { gap: 1.5, flexWrap: "wrap" },
|
|
823
|
+
children: [
|
|
824
|
+
/* @__PURE__ */ jsx(
|
|
825
|
+
Box,
|
|
826
|
+
{
|
|
827
|
+
sx: {
|
|
828
|
+
px: 1.5,
|
|
829
|
+
py: 0.5,
|
|
830
|
+
color: "#fff",
|
|
831
|
+
bgcolor: "rgba(0,0,0,0.7)",
|
|
832
|
+
borderRadius: 2,
|
|
833
|
+
boxShadow: "0 8px 16px rgba(0,0,0,0.25), 0 2px 4px rgba(0,0,0,0.15)",
|
|
834
|
+
border: "1px solid rgba(255,255,255,0.25)",
|
|
835
|
+
backdropFilter: "blur(6px)",
|
|
836
|
+
fontWeight: 700,
|
|
837
|
+
letterSpacing: 0.2,
|
|
838
|
+
alignItems: "center",
|
|
839
|
+
justifyContent: "center"
|
|
840
|
+
},
|
|
841
|
+
children: `${attendees} Players`
|
|
842
|
+
}
|
|
843
|
+
),
|
|
844
|
+
/* @__PURE__ */ jsx(
|
|
845
|
+
Box,
|
|
846
|
+
{
|
|
847
|
+
sx: {
|
|
848
|
+
px: 1.5,
|
|
849
|
+
py: 0.5,
|
|
850
|
+
color: "#fff",
|
|
851
|
+
bgcolor: "rgba(0,0,0,0.7)",
|
|
852
|
+
borderRadius: 2,
|
|
853
|
+
boxShadow: "0 8px 16px rgba(0,0,0,0.25), 0 2px 4px rgba(0,0,0,0.15)",
|
|
854
|
+
border: "1px solid rgba(255,255,255,0.25)",
|
|
855
|
+
backdropFilter: "blur(6px)",
|
|
856
|
+
fontWeight: 700,
|
|
857
|
+
letterSpacing: 0.2,
|
|
858
|
+
alignItems: "center",
|
|
859
|
+
justifyContent: "center"
|
|
860
|
+
},
|
|
861
|
+
children: `${numGames} tables`
|
|
862
|
+
}
|
|
863
|
+
),
|
|
864
|
+
generateTagsDisplay(eventTag),
|
|
865
|
+
links.map((link) => generateLink(link))
|
|
866
|
+
]
|
|
867
|
+
}
|
|
868
|
+
)
|
|
869
|
+
] }),
|
|
870
|
+
isOwner && /* @__PURE__ */ jsx(
|
|
871
|
+
Button,
|
|
872
|
+
{
|
|
873
|
+
variant: "contained",
|
|
874
|
+
onClick: onEdit,
|
|
875
|
+
sx: {
|
|
876
|
+
position: "absolute",
|
|
877
|
+
top: 16,
|
|
878
|
+
right: 16,
|
|
879
|
+
bgcolor: "rgba(255, 255, 255, 0.9)",
|
|
880
|
+
color: "primary.main",
|
|
881
|
+
"&:hover": {
|
|
882
|
+
bgcolor: "white"
|
|
883
|
+
}
|
|
884
|
+
},
|
|
885
|
+
children: "Edit"
|
|
886
|
+
}
|
|
887
|
+
)
|
|
888
|
+
]
|
|
889
|
+
}
|
|
890
|
+
);
|
|
891
|
+
}
|
|
892
|
+
var generateLink = function(link) {
|
|
893
|
+
return /* @__PURE__ */ jsx(
|
|
894
|
+
Box,
|
|
895
|
+
{
|
|
896
|
+
component: "a",
|
|
897
|
+
href: link.url,
|
|
898
|
+
target: "_blank",
|
|
899
|
+
rel: "noopener noreferrer",
|
|
900
|
+
sx: {
|
|
901
|
+
px: 1.5,
|
|
902
|
+
py: 0.5,
|
|
903
|
+
color: "#fff",
|
|
904
|
+
bgcolor: "rgba(0,0,0,0.7)",
|
|
905
|
+
borderRadius: 2,
|
|
906
|
+
boxShadow: "0 8px 16px rgba(0,0,0,0.25), 0 2px 4px rgba(0,0,0,0.15)",
|
|
907
|
+
border: "1px solid rgba(255,255,255,0.25)",
|
|
908
|
+
backdropFilter: "blur(6px)",
|
|
909
|
+
fontWeight: 700,
|
|
910
|
+
letterSpacing: 0.2,
|
|
911
|
+
alignItems: "center",
|
|
912
|
+
justifyContent: "center",
|
|
913
|
+
textDecoration: "none",
|
|
914
|
+
"&:hover": {
|
|
915
|
+
bgcolor: "rgba(255,255,255,0.1)"
|
|
916
|
+
}
|
|
917
|
+
},
|
|
918
|
+
children: link.text
|
|
919
|
+
},
|
|
920
|
+
link.text
|
|
921
|
+
);
|
|
922
|
+
};
|
|
923
|
+
var BaseSearchResultCard = ({
|
|
924
|
+
result,
|
|
925
|
+
onClick,
|
|
926
|
+
children,
|
|
927
|
+
icon,
|
|
928
|
+
tags
|
|
929
|
+
}) => {
|
|
930
|
+
const handleClick = () => {
|
|
931
|
+
if (onClick) {
|
|
932
|
+
onClick(result.id);
|
|
933
|
+
}
|
|
934
|
+
};
|
|
935
|
+
return /* @__PURE__ */ jsx(
|
|
936
|
+
Card,
|
|
937
|
+
{
|
|
938
|
+
elevation: 6,
|
|
939
|
+
sx: {
|
|
940
|
+
width: "100%",
|
|
941
|
+
cursor: onClick ? "pointer" : "default",
|
|
942
|
+
boxShadow: "0px 8px 24px rgba(0, 0, 0, 0.15)",
|
|
943
|
+
transition: "box-shadow 0.3s ease-in-out",
|
|
944
|
+
"&:hover": {
|
|
945
|
+
boxShadow: "0px 12px 28px rgba(0, 0, 0, 0.2)"
|
|
946
|
+
},
|
|
947
|
+
marginBottom: 2
|
|
948
|
+
},
|
|
949
|
+
onClick: handleClick,
|
|
950
|
+
children: /* @__PURE__ */ jsxs(CardContent, { sx: { display: "flex", alignItems: "flex-start" }, children: [
|
|
951
|
+
icon && /* @__PURE__ */ jsx(Box, { sx: { mr: 2, display: "flex", alignItems: "center", pt: 0.5 }, children: icon }),
|
|
952
|
+
/* @__PURE__ */ jsxs(Box, { sx: { flex: 1 }, children: [
|
|
953
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h6", sx: { mb: 1 }, children: result.title }),
|
|
954
|
+
children,
|
|
955
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", children: result.description }),
|
|
956
|
+
result.tags && result.tags.length > 0 && /* @__PURE__ */ jsx(Box, { sx: { mt: 1 }, children: /* @__PURE__ */ jsx(Box, { sx: {
|
|
957
|
+
display: "block",
|
|
958
|
+
whiteSpace: "nowrap",
|
|
959
|
+
overflow: "hidden",
|
|
960
|
+
textOverflow: "clip",
|
|
961
|
+
pl: 0.5
|
|
962
|
+
// Add some padding to prevent clipping of the leftmost tag
|
|
963
|
+
}, children: (() => {
|
|
964
|
+
const MAX_VISIBLE = 5;
|
|
965
|
+
const tagObjs = result.tags.map((tagId) => tags.find((t) => t.id === tagId)).filter((t) => Boolean(t));
|
|
966
|
+
const visible = tagObjs.slice(0, MAX_VISIBLE);
|
|
967
|
+
const hiddenCount = Math.max(tagObjs.length - visible.length, 0);
|
|
968
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
969
|
+
visible.map((tag) => generateTagsDisplay(tag)),
|
|
970
|
+
hiddenCount > 0 && /* @__PURE__ */ jsxs(
|
|
971
|
+
"span",
|
|
972
|
+
{
|
|
973
|
+
className: "inline-block text-sm px-3 py-1 rounded-full outline-black outline-2 font-outlined",
|
|
974
|
+
style: {
|
|
975
|
+
marginTop: "6px",
|
|
976
|
+
marginRight: "6px",
|
|
977
|
+
marginBottom: "6px",
|
|
978
|
+
background: "#9e9e9e",
|
|
979
|
+
color: "white",
|
|
980
|
+
textShadow: "black 0.2em 0.2em 0.4em"
|
|
981
|
+
},
|
|
982
|
+
children: [
|
|
983
|
+
"+",
|
|
984
|
+
hiddenCount,
|
|
985
|
+
" more"
|
|
986
|
+
]
|
|
987
|
+
}
|
|
988
|
+
)
|
|
989
|
+
] });
|
|
990
|
+
})() }) })
|
|
991
|
+
] })
|
|
992
|
+
] })
|
|
993
|
+
}
|
|
994
|
+
);
|
|
995
|
+
};
|
|
996
|
+
var BaseSearchResultCard_default = BaseSearchResultCard;
|
|
997
|
+
var PlayerResultCard = ({
|
|
998
|
+
result,
|
|
999
|
+
onClick,
|
|
1000
|
+
tags
|
|
1001
|
+
}) => {
|
|
1002
|
+
const firstLetter = result.title.charAt(0).toUpperCase();
|
|
1003
|
+
const getAvatarColor = (name) => {
|
|
1004
|
+
const colors = [
|
|
1005
|
+
"#F44336",
|
|
1006
|
+
"#E91E63",
|
|
1007
|
+
"#9C27B0",
|
|
1008
|
+
"#673AB7",
|
|
1009
|
+
"#3F51B5",
|
|
1010
|
+
"#2196F3",
|
|
1011
|
+
"#03A9F4",
|
|
1012
|
+
"#00BCD4",
|
|
1013
|
+
"#009688",
|
|
1014
|
+
"#4CAF50",
|
|
1015
|
+
"#8BC34A",
|
|
1016
|
+
"#CDDC39",
|
|
1017
|
+
"#FFEB3B",
|
|
1018
|
+
"#FFC107",
|
|
1019
|
+
"#FF9800",
|
|
1020
|
+
"#FF5722"
|
|
1021
|
+
];
|
|
1022
|
+
let hash = 0;
|
|
1023
|
+
for (let i = 0; i < name.length; i++) {
|
|
1024
|
+
hash = name.charCodeAt(i) + ((hash << 5) - hash);
|
|
1025
|
+
}
|
|
1026
|
+
return colors[Math.abs(hash) % colors.length];
|
|
1027
|
+
};
|
|
1028
|
+
const avatarColor = getAvatarColor(result.title);
|
|
1029
|
+
const playerIcon = /* @__PURE__ */ jsx(
|
|
1030
|
+
Avatar,
|
|
1031
|
+
{
|
|
1032
|
+
src: result.imageUrl,
|
|
1033
|
+
alt: result.title,
|
|
1034
|
+
sx: {
|
|
1035
|
+
width: 40,
|
|
1036
|
+
height: 40,
|
|
1037
|
+
bgcolor: !result.imageUrl ? avatarColor : void 0
|
|
1038
|
+
},
|
|
1039
|
+
children: !result.imageUrl && firstLetter
|
|
1040
|
+
}
|
|
1041
|
+
);
|
|
1042
|
+
return /* @__PURE__ */ jsx(BaseSearchResultCard_default, { result, onClick, icon: playerIcon, tags });
|
|
1043
|
+
};
|
|
1044
|
+
var PlayerResultCard_default = PlayerResultCard;
|
|
1045
|
+
var TableResultCard = ({ result, tags, onClick }) => {
|
|
1046
|
+
const capacity = result.capacity || 1;
|
|
1047
|
+
const numPlayers = result.numPlayers || 0;
|
|
1048
|
+
const occupancy = numPlayers / capacity * 100;
|
|
1049
|
+
return /* @__PURE__ */ jsx(BaseSearchResultCard, { result, tags, onClick, icon: /* @__PURE__ */ jsx(CasinoIcon, { color: "primary" }), children: /* @__PURE__ */ jsxs(Box, { sx: { mb: 1 }, children: [
|
|
1050
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 0.5 }, children: [
|
|
1051
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "body2", color: "text.secondary", children: [
|
|
1052
|
+
"Players: ",
|
|
1053
|
+
numPlayers,
|
|
1054
|
+
" / ",
|
|
1055
|
+
capacity
|
|
1056
|
+
] }),
|
|
1057
|
+
result.dungeonMaster ? /* @__PURE__ */ jsx(Chip, { label: "DM Present", size: "small", color: "success", variant: "outlined" }) : /* @__PURE__ */ jsx(Chip, { label: "No DM", size: "small", color: "warning", variant: "outlined" })
|
|
1058
|
+
] }),
|
|
1059
|
+
/* @__PURE__ */ jsx(LinearProgress, { variant: "determinate", value: occupancy, sx: { height: 8, borderRadius: 4 } })
|
|
1060
|
+
] }) });
|
|
1061
|
+
};
|
|
1062
|
+
var TableResultCard_default = TableResultCard;
|
|
1063
|
+
var EventResultCard = ({
|
|
1064
|
+
result,
|
|
1065
|
+
onClick,
|
|
1066
|
+
tags
|
|
1067
|
+
}) => {
|
|
1068
|
+
const formatDate = (dateString) => {
|
|
1069
|
+
const options = {
|
|
1070
|
+
weekday: "long",
|
|
1071
|
+
year: "numeric",
|
|
1072
|
+
month: "long",
|
|
1073
|
+
day: "numeric"
|
|
1074
|
+
};
|
|
1075
|
+
try {
|
|
1076
|
+
const date = new Date(dateString);
|
|
1077
|
+
return date.toLocaleDateString("en-US", options);
|
|
1078
|
+
} catch {
|
|
1079
|
+
return dateString;
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1082
|
+
const formattedDate = result.date ? formatDate(result.date) : "Date TBD";
|
|
1083
|
+
const location = result.location || "Location TBD";
|
|
1084
|
+
return /* @__PURE__ */ jsx(BaseSearchResultCard_default, { result, onClick, icon: /* @__PURE__ */ jsx(EventIcon, { color: "primary" }), tags, children: /* @__PURE__ */ jsxs(Box, { sx: { mb: 1 }, children: [
|
|
1085
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", mb: 0.5 }, children: [
|
|
1086
|
+
/* @__PURE__ */ jsx(CalendarTodayIcon, { sx: { mr: 1, fontSize: "small", color: "text.secondary" } }),
|
|
1087
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", children: formattedDate })
|
|
1088
|
+
] }),
|
|
1089
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", mb: 1 }, children: [
|
|
1090
|
+
/* @__PURE__ */ jsx(LocationOnIcon, { sx: { mr: 1, fontSize: "small", color: "text.secondary" } }),
|
|
1091
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", children: location })
|
|
1092
|
+
] })
|
|
1093
|
+
] }) });
|
|
1094
|
+
};
|
|
1095
|
+
var EventResultCard_default = EventResultCard;
|
|
1096
|
+
var ResultsContainer = ({
|
|
1097
|
+
results,
|
|
1098
|
+
onResultClick,
|
|
1099
|
+
tags
|
|
1100
|
+
}) => {
|
|
1101
|
+
if (results.length === 0 || !results.map) {
|
|
1102
|
+
return /* @__PURE__ */ jsx(Box2, { sx: { textAlign: "center", py: 4 }, children: "No results found. Try adjusting your filters." });
|
|
1103
|
+
}
|
|
1104
|
+
const onPlayerClick = (id) => {
|
|
1105
|
+
onResultClick == null ? void 0 : onResultClick(id, "player");
|
|
1106
|
+
};
|
|
1107
|
+
const onTableClick = (id) => {
|
|
1108
|
+
onResultClick == null ? void 0 : onResultClick(id, "table");
|
|
1109
|
+
};
|
|
1110
|
+
const onEventClick = (id) => {
|
|
1111
|
+
onResultClick == null ? void 0 : onResultClick(id, "event");
|
|
1112
|
+
};
|
|
1113
|
+
return /* @__PURE__ */ jsx(Box2, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: results.map((result) => {
|
|
1114
|
+
switch (result.type) {
|
|
1115
|
+
case "player":
|
|
1116
|
+
return /* @__PURE__ */ jsx(
|
|
1117
|
+
PlayerResultCard_default,
|
|
1118
|
+
{
|
|
1119
|
+
result,
|
|
1120
|
+
onClick: onPlayerClick,
|
|
1121
|
+
tags
|
|
1122
|
+
},
|
|
1123
|
+
result.id
|
|
1124
|
+
);
|
|
1125
|
+
case "table":
|
|
1126
|
+
return /* @__PURE__ */ jsx(
|
|
1127
|
+
TableResultCard_default,
|
|
1128
|
+
{
|
|
1129
|
+
result,
|
|
1130
|
+
onClick: onTableClick,
|
|
1131
|
+
tags
|
|
1132
|
+
},
|
|
1133
|
+
result.id
|
|
1134
|
+
);
|
|
1135
|
+
case "event":
|
|
1136
|
+
return /* @__PURE__ */ jsx(
|
|
1137
|
+
EventResultCard_default,
|
|
1138
|
+
{
|
|
1139
|
+
result,
|
|
1140
|
+
onClick: onEventClick,
|
|
1141
|
+
tags
|
|
1142
|
+
},
|
|
1143
|
+
result.id
|
|
1144
|
+
);
|
|
1145
|
+
default:
|
|
1146
|
+
console.error(`Unknown result type: ${result.type}`);
|
|
1147
|
+
return null;
|
|
1148
|
+
}
|
|
1149
|
+
}) });
|
|
1150
|
+
};
|
|
1151
|
+
var ResultsContainer_default = ResultsContainer;
|
|
1152
|
+
var ScrollableResultsList = ({
|
|
1153
|
+
results,
|
|
1154
|
+
tags,
|
|
1155
|
+
maxHeight = 400,
|
|
1156
|
+
onResultClick,
|
|
1157
|
+
emptyText
|
|
1158
|
+
}) => {
|
|
1159
|
+
const hasResults = Array.isArray(results) && results.length > 0;
|
|
1160
|
+
return /* @__PURE__ */ jsx(Box2, { sx: { maxHeight, overflowY: "auto", pr: 1 }, children: hasResults ? /* @__PURE__ */ jsx(ResultsContainer_default, { results, onResultClick, tags }) : /* @__PURE__ */ jsx(Box2, { sx: { textAlign: "center", py: 2 }, children: emptyText || "No results to display." }) });
|
|
1161
|
+
};
|
|
1162
|
+
var ScrollableResultsList_default = ScrollableResultsList;
|
|
1163
|
+
var TablesScrollableList = ({
|
|
1164
|
+
results,
|
|
1165
|
+
tags,
|
|
1166
|
+
maxHeight,
|
|
1167
|
+
onResultClick,
|
|
1168
|
+
sortBy = "availability"
|
|
1169
|
+
}) => {
|
|
1170
|
+
const tables = (results || []).filter((r) => (r == null ? void 0 : r.type) === "table");
|
|
1171
|
+
const getAvailableSlots = (r) => {
|
|
1172
|
+
const capacity = typeof r.capacity === "number" ? r.capacity : 0;
|
|
1173
|
+
const playersCount = typeof r.numPlayers === "number" ? r.numPlayers : 0;
|
|
1174
|
+
return Math.max(capacity - playersCount, 0);
|
|
1175
|
+
};
|
|
1176
|
+
const sortedTables = sortBy === "availability" ? [...tables].sort((a, b) => getAvailableSlots(b) - getAvailableSlots(a)) : tables;
|
|
1177
|
+
const handleClick = (id) => onResultClick == null ? void 0 : onResultClick(id);
|
|
1178
|
+
return /* @__PURE__ */ jsx(
|
|
1179
|
+
ScrollableResultsList_default,
|
|
1180
|
+
{
|
|
1181
|
+
results: sortedTables,
|
|
1182
|
+
tags,
|
|
1183
|
+
maxHeight,
|
|
1184
|
+
onResultClick: (id, type) => {
|
|
1185
|
+
if (type === "table") handleClick(id);
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
);
|
|
1189
|
+
};
|
|
1190
|
+
var TablesScrollableList_default = TablesScrollableList;
|
|
1191
|
+
var EventTablesCard = ({
|
|
1192
|
+
tables,
|
|
1193
|
+
tags,
|
|
1194
|
+
maxHeight = 450,
|
|
1195
|
+
onTableClick
|
|
1196
|
+
}) => {
|
|
1197
|
+
return /* @__PURE__ */ jsxs(Card10, { elevation: 6, sx: { width: "100%", boxShadow: "0px 8px 24px rgba(0, 0, 0, 0.15)" }, children: [
|
|
1198
|
+
/* @__PURE__ */ jsx(CardHeader4, { title: "Tables" }),
|
|
1199
|
+
/* @__PURE__ */ jsx(Divider2, {}),
|
|
1200
|
+
/* @__PURE__ */ jsx(CardContent10, { children: /* @__PURE__ */ jsx(TablesScrollableList_default, { results: tables, tags, maxHeight, onResultClick: onTableClick, sortBy: "availability" }) })
|
|
1201
|
+
] });
|
|
1202
|
+
};
|
|
1203
|
+
var EventTablesCard_default = EventTablesCard;
|
|
1204
|
+
function EventPageLayout({
|
|
1205
|
+
mergedEvent,
|
|
1206
|
+
isOwner,
|
|
1207
|
+
updateEvent,
|
|
1208
|
+
updateImages,
|
|
1209
|
+
attendees,
|
|
1210
|
+
numGames,
|
|
1211
|
+
tables,
|
|
1212
|
+
allTags
|
|
1213
|
+
}) {
|
|
1214
|
+
return /* @__PURE__ */ jsx(Grid9, { container: true, flexDirection: "column", children: /* @__PURE__ */ jsxs(EventEditProvider, { initialEvent: mergedEvent, value: { isOwner, updateEvent, updateImages }, children: [
|
|
1215
|
+
/* @__PURE__ */ jsx(Grid9, { children: /* @__PURE__ */ jsx(
|
|
1216
|
+
EventBanner,
|
|
1217
|
+
{
|
|
1218
|
+
attendees,
|
|
1219
|
+
numGames
|
|
1220
|
+
}
|
|
1221
|
+
) }),
|
|
1222
|
+
/* @__PURE__ */ jsxs(Grid9, { container: true, flexDirection: "row", spacing: 3, size: { xs: 12, md: 12 }, children: [
|
|
1223
|
+
/* @__PURE__ */ jsx(Grid9, { size: { xs: 12, md: 4 }, spacing: 3, padding: 3, children: /* @__PURE__ */ jsx(
|
|
1224
|
+
EventBasicInfo,
|
|
1225
|
+
{
|
|
1226
|
+
locationId: mergedEvent.location || "0"
|
|
1227
|
+
}
|
|
1228
|
+
) }),
|
|
1229
|
+
/* @__PURE__ */ jsx(Grid9, { size: { xs: 12, md: 8 }, spacing: 3, padding: 3, children: /* @__PURE__ */ jsx(EventTablesCard_default, { tables, tags: allTags }) })
|
|
1230
|
+
] }),
|
|
1231
|
+
/* @__PURE__ */ jsx(Grid9, {})
|
|
1232
|
+
] }) });
|
|
1233
|
+
}
|
|
1234
|
+
var PlayerDetails = ({
|
|
1235
|
+
age,
|
|
1236
|
+
yearsPlaying,
|
|
1237
|
+
discordUsername,
|
|
1238
|
+
preferredGames
|
|
1239
|
+
}) => {
|
|
1240
|
+
return /* @__PURE__ */ jsxs(
|
|
1241
|
+
Card,
|
|
1242
|
+
{
|
|
1243
|
+
sx: {
|
|
1244
|
+
margin: "1rem",
|
|
1245
|
+
background: "linear-gradient(135deg, rgba(25, 118, 210, 0.8), rgba(25, 118, 210, 1))",
|
|
1246
|
+
// Primary Blue Gradient
|
|
1247
|
+
boxShadow: "0px 8px 15px rgba(25, 118, 210, 0.3)",
|
|
1248
|
+
// Deep shadow based on the color
|
|
1249
|
+
borderRadius: "12px",
|
|
1250
|
+
// Rounded corners
|
|
1251
|
+
color: "#FFFFFF",
|
|
1252
|
+
// White as the base text color for contrast
|
|
1253
|
+
position: "relative",
|
|
1254
|
+
overflow: "hidden"
|
|
1255
|
+
// Ensures clean edges
|
|
1256
|
+
},
|
|
1257
|
+
className: "transition duration-300 transform hover:scale-105 hover:shadow-2xl",
|
|
1258
|
+
children: [
|
|
1259
|
+
/* @__PURE__ */ jsx(
|
|
1260
|
+
"div",
|
|
1261
|
+
{
|
|
1262
|
+
className: "absolute inset-0 bg-gradient-to-t from-white/10 to-transparent opacity-60",
|
|
1263
|
+
"aria-hidden": "true"
|
|
1264
|
+
}
|
|
1265
|
+
),
|
|
1266
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "relative p-6", children: [
|
|
1267
|
+
/* @__PURE__ */ jsx(
|
|
1268
|
+
Typography,
|
|
1269
|
+
{
|
|
1270
|
+
variant: "h5",
|
|
1271
|
+
className: "font-bold uppercase text-center tracking-wide mb-4",
|
|
1272
|
+
sx: {
|
|
1273
|
+
color: "#FFFFFF",
|
|
1274
|
+
// Bright white for high contrast
|
|
1275
|
+
textShadow: "0px 4px 8px rgba(0, 0, 0, 0.5)",
|
|
1276
|
+
// Stronger shadow for bold presence
|
|
1277
|
+
fontSize: "1.5rem"
|
|
1278
|
+
// Slightly larger title size
|
|
1279
|
+
},
|
|
1280
|
+
children: "Player Details"
|
|
1281
|
+
}
|
|
1282
|
+
),
|
|
1283
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
1284
|
+
age !== null && /* @__PURE__ */ jsxs(
|
|
1285
|
+
Typography,
|
|
1286
|
+
{
|
|
1287
|
+
variant: "body2",
|
|
1288
|
+
className: "text-sm font-medium",
|
|
1289
|
+
sx: {
|
|
1290
|
+
color: "#FFFFFF",
|
|
1291
|
+
textShadow: "0px 2px 6px rgba(0, 0, 0, 0.5)",
|
|
1292
|
+
fontWeight: "bold"
|
|
1293
|
+
},
|
|
1294
|
+
children: [
|
|
1295
|
+
/* @__PURE__ */ jsx("span", { className: "font-extrabold text-cyan-300", children: "Age:" }),
|
|
1296
|
+
" ",
|
|
1297
|
+
age
|
|
1298
|
+
]
|
|
1299
|
+
}
|
|
1300
|
+
),
|
|
1301
|
+
yearsPlaying !== null && /* @__PURE__ */ jsxs(
|
|
1302
|
+
Typography,
|
|
1303
|
+
{
|
|
1304
|
+
variant: "body2",
|
|
1305
|
+
className: "text-sm font-medium",
|
|
1306
|
+
sx: {
|
|
1307
|
+
color: "#FFFFFF",
|
|
1308
|
+
textShadow: "0px 2px 6px rgba(0, 0, 0, 0.5)",
|
|
1309
|
+
fontWeight: "bold"
|
|
1310
|
+
},
|
|
1311
|
+
children: [
|
|
1312
|
+
/* @__PURE__ */ jsx("span", { className: "font-extrabold text-cyan-300", children: "Years Playing:" }),
|
|
1313
|
+
" ",
|
|
1314
|
+
yearsPlaying
|
|
1315
|
+
]
|
|
1316
|
+
}
|
|
1317
|
+
),
|
|
1318
|
+
discordUsername && /* @__PURE__ */ jsxs(
|
|
1319
|
+
Typography,
|
|
1320
|
+
{
|
|
1321
|
+
variant: "body2",
|
|
1322
|
+
className: "text-sm font-medium",
|
|
1323
|
+
sx: {
|
|
1324
|
+
color: "#FFFFFF",
|
|
1325
|
+
textShadow: "0px 2px 6px rgba(0, 0, 0, 0.5)",
|
|
1326
|
+
fontWeight: "bold"
|
|
1327
|
+
},
|
|
1328
|
+
children: [
|
|
1329
|
+
/* @__PURE__ */ jsx("span", { className: "font-extrabold text-cyan-300", children: "Discord Username:" }),
|
|
1330
|
+
" ",
|
|
1331
|
+
discordUsername
|
|
1332
|
+
]
|
|
1333
|
+
}
|
|
1334
|
+
),
|
|
1335
|
+
preferredGames && preferredGames.length > 0 && /* @__PURE__ */ jsxs(
|
|
1336
|
+
Typography,
|
|
1337
|
+
{
|
|
1338
|
+
variant: "body2",
|
|
1339
|
+
className: "text-sm font-medium",
|
|
1340
|
+
sx: {
|
|
1341
|
+
color: "#FFFFFF",
|
|
1342
|
+
textShadow: "0px 2px 6px rgba(0, 0, 0, 0.5)",
|
|
1343
|
+
fontWeight: "bold"
|
|
1344
|
+
},
|
|
1345
|
+
children: [
|
|
1346
|
+
/* @__PURE__ */ jsx("span", { className: "font-extrabold text-cyan-300", children: "Preferred Games:" }),
|
|
1347
|
+
" ",
|
|
1348
|
+
preferredGames.join(", ")
|
|
1349
|
+
]
|
|
1350
|
+
}
|
|
1351
|
+
)
|
|
1352
|
+
] }),
|
|
1353
|
+
/* @__PURE__ */ jsx("div", { className: "mt-6 text-center", children: /* @__PURE__ */ jsx(
|
|
1354
|
+
Typography,
|
|
1355
|
+
{
|
|
1356
|
+
variant: "caption",
|
|
1357
|
+
className: "text-xs italic",
|
|
1358
|
+
sx: {
|
|
1359
|
+
color: "#BBDEFB",
|
|
1360
|
+
// Subtle light blue for footer text
|
|
1361
|
+
textShadow: "0px 1px 3px rgba(0, 0, 0, 0.2)"
|
|
1362
|
+
},
|
|
1363
|
+
children: "All information is player-submitted."
|
|
1364
|
+
}
|
|
1365
|
+
) })
|
|
1366
|
+
] })
|
|
1367
|
+
]
|
|
1368
|
+
}
|
|
1369
|
+
);
|
|
1370
|
+
};
|
|
1371
|
+
var PlayerDetailsCard_default = PlayerDetails;
|
|
1372
|
+
|
|
1373
|
+
// src/data/values.tsx
|
|
1374
|
+
var ProfilePictureSettings = {
|
|
1375
|
+
aspectRatio: 4 / 5};
|
|
1376
|
+
var { aspectRatio } = ProfilePictureSettings;
|
|
1377
|
+
var PlayerDisplayCard = ({
|
|
1378
|
+
profilePicture,
|
|
1379
|
+
username,
|
|
1380
|
+
bio,
|
|
1381
|
+
preferredPronouns
|
|
1382
|
+
}) => {
|
|
1383
|
+
const [imageSrc, setImageSrc] = useState("/man-walking-silhouette-clipart.jpg");
|
|
1384
|
+
useEffect(() => {
|
|
1385
|
+
async function validateImage() {
|
|
1386
|
+
const newImage = profilePicture || "/man-walking-silhouette-clipart.jpg";
|
|
1387
|
+
if (!profilePicture) {
|
|
1388
|
+
setImageSrc("/man-walking-silhouette-clipart.jpg");
|
|
1389
|
+
return;
|
|
1390
|
+
}
|
|
1391
|
+
const img = new Image();
|
|
1392
|
+
img.src = newImage;
|
|
1393
|
+
img.onload = () => {
|
|
1394
|
+
setImageSrc(newImage);
|
|
1395
|
+
};
|
|
1396
|
+
img.onerror = () => {
|
|
1397
|
+
setImageSrc("/man-walking-silhouette-clipart.jpg");
|
|
1398
|
+
};
|
|
1399
|
+
}
|
|
1400
|
+
validateImage();
|
|
1401
|
+
}, [profilePicture]);
|
|
1402
|
+
return /* @__PURE__ */ jsxs(
|
|
1403
|
+
Card,
|
|
1404
|
+
{
|
|
1405
|
+
sx: {
|
|
1406
|
+
margin: "1rem",
|
|
1407
|
+
background: "linear-gradient(135deg, rgba(25, 118, 210, 0.8), rgba(25, 118, 210, 1))",
|
|
1408
|
+
// Vibrant blue gradient
|
|
1409
|
+
boxShadow: "0px 8px 15px rgba(25, 118, 210, 0.3)",
|
|
1410
|
+
// Blue shadow to add depth
|
|
1411
|
+
borderRadius: "12px",
|
|
1412
|
+
// Smooth rounded corners
|
|
1413
|
+
color: "#FFFFFF",
|
|
1414
|
+
// White text for high contrast
|
|
1415
|
+
overflow: "hidden"
|
|
1416
|
+
// Clean edges
|
|
1417
|
+
},
|
|
1418
|
+
className: "transition duration-300 transform hover:scale-105 hover:shadow-2xl",
|
|
1419
|
+
children: [
|
|
1420
|
+
/* @__PURE__ */ jsx(
|
|
1421
|
+
CardMedia,
|
|
1422
|
+
{
|
|
1423
|
+
component: "img",
|
|
1424
|
+
image: imageSrc,
|
|
1425
|
+
alt: `${username}'s Profile Picture`,
|
|
1426
|
+
sx: {
|
|
1427
|
+
aspectRatio,
|
|
1428
|
+
height: "auto",
|
|
1429
|
+
// Updates to maintain aspect ratio and fill space nicely
|
|
1430
|
+
width: "100%",
|
|
1431
|
+
objectFit: "scale-down"
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
),
|
|
1435
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "relative p-6", children: [
|
|
1436
|
+
/* @__PURE__ */ jsx(
|
|
1437
|
+
Typography,
|
|
1438
|
+
{
|
|
1439
|
+
variant: "h5",
|
|
1440
|
+
component: "div",
|
|
1441
|
+
className: "font-bold text-lg uppercase text-center tracking-wide mb-2",
|
|
1442
|
+
sx: {
|
|
1443
|
+
color: "#FFFFFF",
|
|
1444
|
+
// Pure white for username
|
|
1445
|
+
fontSize: "1.5rem",
|
|
1446
|
+
textShadow: "0px 3px 6px rgba(0, 0, 0, 0.5)"
|
|
1447
|
+
// Strong shadow for visibility
|
|
1448
|
+
},
|
|
1449
|
+
children: username
|
|
1450
|
+
}
|
|
1451
|
+
),
|
|
1452
|
+
preferredPronouns && /* @__PURE__ */ jsx(
|
|
1453
|
+
Typography,
|
|
1454
|
+
{
|
|
1455
|
+
variant: "body2",
|
|
1456
|
+
className: "text-sm font-medium",
|
|
1457
|
+
sx: {
|
|
1458
|
+
color: "#E3F2FD",
|
|
1459
|
+
textShadow: "0px 2px 4px rgba(0, 0, 0, 0.3)",
|
|
1460
|
+
// Subtle shadow for readability
|
|
1461
|
+
fontWeight: "bold",
|
|
1462
|
+
// Emphasize key details
|
|
1463
|
+
marginBottom: "1rem"
|
|
1464
|
+
},
|
|
1465
|
+
children: preferredPronouns
|
|
1466
|
+
}
|
|
1467
|
+
),
|
|
1468
|
+
bio && /* @__PURE__ */ jsx(
|
|
1469
|
+
Typography,
|
|
1470
|
+
{
|
|
1471
|
+
variant: "body2",
|
|
1472
|
+
className: "text-sm font-light",
|
|
1473
|
+
sx: {
|
|
1474
|
+
color: "#E3F2FD",
|
|
1475
|
+
// Softer muted tone for secondary text
|
|
1476
|
+
textShadow: "0px 2px 4px rgba(0, 0, 0, 0.3)",
|
|
1477
|
+
// Subtle shadow for readability
|
|
1478
|
+
fontStyle: "italic"
|
|
1479
|
+
// Distinguish bio visually
|
|
1480
|
+
},
|
|
1481
|
+
children: bio
|
|
1482
|
+
}
|
|
1483
|
+
)
|
|
1484
|
+
] })
|
|
1485
|
+
]
|
|
1486
|
+
}
|
|
1487
|
+
);
|
|
1488
|
+
};
|
|
1489
|
+
var PlayerDisplayCard_default = PlayerDisplayCard;
|
|
1490
|
+
var PlayerPromptCard = ({ title, description }) => {
|
|
1491
|
+
return /* @__PURE__ */ jsx(
|
|
1492
|
+
Card,
|
|
1493
|
+
{
|
|
1494
|
+
sx: {
|
|
1495
|
+
margin: "1rem",
|
|
1496
|
+
background: "linear-gradient(135deg, rgba(25, 118, 210, 0.8), rgba(25, 118, 210, 1))",
|
|
1497
|
+
// Gradient color scheme
|
|
1498
|
+
boxShadow: "0px 8px 15px rgba(25, 118, 210, 0.3)",
|
|
1499
|
+
// Card shadow
|
|
1500
|
+
borderRadius: "12px",
|
|
1501
|
+
// Rounded corners
|
|
1502
|
+
color: "#FFFFFF",
|
|
1503
|
+
// Text contrast with the background
|
|
1504
|
+
overflow: "hidden"
|
|
1505
|
+
// Keeps consistent and clean card shape
|
|
1506
|
+
},
|
|
1507
|
+
className: "transition duration-300 transform hover:scale-105 hover:shadow-2xl",
|
|
1508
|
+
children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
|
|
1509
|
+
title && /* @__PURE__ */ jsx(
|
|
1510
|
+
Typography,
|
|
1511
|
+
{
|
|
1512
|
+
variant: "h5",
|
|
1513
|
+
className: "font-bold text-lg uppercase text-center tracking-wide mb-4",
|
|
1514
|
+
sx: {
|
|
1515
|
+
color: "#FFFFFF",
|
|
1516
|
+
// Bright white for high visibility
|
|
1517
|
+
textShadow: "0px 3px 6px rgba(0, 0, 0, 0.5)",
|
|
1518
|
+
// Strong text shadow for contrast
|
|
1519
|
+
fontSize: "1.5rem"
|
|
1520
|
+
},
|
|
1521
|
+
children: title
|
|
1522
|
+
}
|
|
1523
|
+
),
|
|
1524
|
+
description && /* @__PURE__ */ jsx(
|
|
1525
|
+
Typography,
|
|
1526
|
+
{
|
|
1527
|
+
variant: "body2",
|
|
1528
|
+
className: "text-sm font-medium text-center",
|
|
1529
|
+
sx: {
|
|
1530
|
+
color: "#E3F2FD",
|
|
1531
|
+
// Softer light blue for description
|
|
1532
|
+
textShadow: "0px 2px 4px rgba(0, 0, 0, 0.3)",
|
|
1533
|
+
// Subtle shadow
|
|
1534
|
+
lineHeight: 1.6,
|
|
1535
|
+
marginTop: "1rem"
|
|
1536
|
+
},
|
|
1537
|
+
children: description
|
|
1538
|
+
}
|
|
1539
|
+
)
|
|
1540
|
+
] })
|
|
1541
|
+
}
|
|
1542
|
+
);
|
|
1543
|
+
};
|
|
1544
|
+
var PlayerPromptCard_default = PlayerPromptCard;
|
|
1545
|
+
function PlayerTagsCard(props) {
|
|
1546
|
+
return /* @__PURE__ */ jsx(Grid9, { container: true, children: /* @__PURE__ */ jsx(Grid9, { size: { xs: 12, md: 3 }, children: /* @__PURE__ */ jsxs(Card10, { children: [
|
|
1547
|
+
/* @__PURE__ */ jsx(CardHeader4, { title: "Player Tags", style: {
|
|
1548
|
+
background: "linear-gradient(135deg, rgba(25, 118, 210, 0.8), rgba(25, 118, 210, 1))",
|
|
1549
|
+
color: "#FFFFFF",
|
|
1550
|
+
// Pure white for username
|
|
1551
|
+
fontSize: "1.5rem",
|
|
1552
|
+
textShadow: "0px 3px 6px rgba(0, 0, 0, 0.5)"
|
|
1553
|
+
// Strong shadow for visibility
|
|
1554
|
+
} }),
|
|
1555
|
+
/* @__PURE__ */ jsx(CardContent10, { children: renderLabels(props.PlayerTags) })
|
|
1556
|
+
] }) }) });
|
|
1557
|
+
}
|
|
1558
|
+
var renderLabels = (tags) => {
|
|
1559
|
+
return /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: tags.map((tag) => generateLabel(tag)) });
|
|
1560
|
+
};
|
|
1561
|
+
var generateLabel = (tag) => {
|
|
1562
|
+
let color = "#bfbcbb";
|
|
1563
|
+
if (tag.color) color = tag.color;
|
|
1564
|
+
return /* @__PURE__ */ jsx(
|
|
1565
|
+
"span",
|
|
1566
|
+
{
|
|
1567
|
+
className: "inline-block text-sm px-3 py-1 rounded-full outline-black outline-2 font-outlined",
|
|
1568
|
+
style: {
|
|
1569
|
+
background: color,
|
|
1570
|
+
color: "white",
|
|
1571
|
+
textShadow: "black 0.2em 0.2em 0.4em"
|
|
1572
|
+
},
|
|
1573
|
+
children: tag.label
|
|
1574
|
+
},
|
|
1575
|
+
tag.id
|
|
1576
|
+
);
|
|
1577
|
+
};
|
|
1578
|
+
function TagEditor({
|
|
1579
|
+
title = "Tags",
|
|
1580
|
+
selectedTags,
|
|
1581
|
+
possibleTags,
|
|
1582
|
+
onToggleTag
|
|
1583
|
+
}) {
|
|
1584
|
+
const [inputValue, setInputValue] = useState("");
|
|
1585
|
+
const selectedIds = useMemo(() => selectedTags.map((tag) => tag.id), [selectedTags]);
|
|
1586
|
+
const options = useMemo(
|
|
1587
|
+
() => possibleTags.map((tag) => ({ value: tag.id, label: tag.label })),
|
|
1588
|
+
[possibleTags]
|
|
1589
|
+
);
|
|
1590
|
+
return /* @__PURE__ */ jsx(Grid9, { container: true, children: /* @__PURE__ */ jsx(Grid9, { size: { xs: 12 }, children: /* @__PURE__ */ jsxs(Card10, { children: [
|
|
1591
|
+
/* @__PURE__ */ jsx(
|
|
1592
|
+
CardHeader4,
|
|
1593
|
+
{
|
|
1594
|
+
title,
|
|
1595
|
+
style: {
|
|
1596
|
+
background: "linear-gradient(135deg, rgba(25, 118, 210, 0.8), rgba(25, 118, 210, 1))",
|
|
1597
|
+
color: "#FFFFFF",
|
|
1598
|
+
fontSize: "1.5rem",
|
|
1599
|
+
textShadow: "0px 3px 6px rgba(0, 0, 0, 0.5)"
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
),
|
|
1603
|
+
/* @__PURE__ */ jsxs(CardContent10, { children: [
|
|
1604
|
+
/* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: selectedTags.map((tag) => /* @__PURE__ */ jsxs(
|
|
1605
|
+
"span",
|
|
1606
|
+
{
|
|
1607
|
+
className: "inline-block text-sm px-3 py-1 rounded-full outline-black outline-2 font-outlined",
|
|
1608
|
+
style: {
|
|
1609
|
+
background: tag.color || "#bfbcbb",
|
|
1610
|
+
color: "white",
|
|
1611
|
+
textShadow: "black 0.2em 0.2em 0.4em"
|
|
1612
|
+
},
|
|
1613
|
+
children: [
|
|
1614
|
+
tag.label,
|
|
1615
|
+
/* @__PURE__ */ jsx(
|
|
1616
|
+
"button",
|
|
1617
|
+
{
|
|
1618
|
+
type: "button",
|
|
1619
|
+
onClick: () => onToggleTag(tag.id),
|
|
1620
|
+
className: "ml-2 text-red-500 bg-white bg-opacity-50 rounded-full outline-black outline-2 font-outlined",
|
|
1621
|
+
children: "\xD7"
|
|
1622
|
+
}
|
|
1623
|
+
)
|
|
1624
|
+
]
|
|
1625
|
+
},
|
|
1626
|
+
tag.id
|
|
1627
|
+
)) }),
|
|
1628
|
+
/* @__PURE__ */ jsx(Grid9, { container: true, spacing: 3, children: /* @__PURE__ */ jsx(Grid9, { sx: { marginTop: 3, width: "100%" }, children: /* @__PURE__ */ jsx(
|
|
1629
|
+
Autocomplete,
|
|
1630
|
+
{
|
|
1631
|
+
options,
|
|
1632
|
+
filterOptions: (availableOptions, state) => availableOptions.filter(
|
|
1633
|
+
(option) => !selectedIds.includes(option.value) && option.label.toLowerCase().includes(state.inputValue.toLowerCase())
|
|
1634
|
+
).slice(0, 3),
|
|
1635
|
+
value: null,
|
|
1636
|
+
inputValue,
|
|
1637
|
+
onInputChange: (event, newInputValue) => {
|
|
1638
|
+
if (event && event.type === "change") {
|
|
1639
|
+
setInputValue(newInputValue);
|
|
1640
|
+
}
|
|
1641
|
+
},
|
|
1642
|
+
onChange: (event, newValue) => {
|
|
1643
|
+
if (newValue) {
|
|
1644
|
+
onToggleTag(newValue.value);
|
|
1645
|
+
}
|
|
1646
|
+
setInputValue("");
|
|
1647
|
+
},
|
|
1648
|
+
slots: { popper: CustomPopper },
|
|
1649
|
+
renderInput: (params) => /* @__PURE__ */ jsx(TextField3, { ...params, label: "Select Tags" })
|
|
1650
|
+
},
|
|
1651
|
+
selectedIds.join("-")
|
|
1652
|
+
) }) })
|
|
1653
|
+
] })
|
|
1654
|
+
] }) }) });
|
|
1655
|
+
}
|
|
1656
|
+
var CustomPopper = (props) => {
|
|
1657
|
+
return /* @__PURE__ */ jsx(
|
|
1658
|
+
Popper,
|
|
1659
|
+
{
|
|
1660
|
+
...props,
|
|
1661
|
+
modifiers: [
|
|
1662
|
+
{
|
|
1663
|
+
name: "preventOverflow",
|
|
1664
|
+
options: { boundary: "viewport" }
|
|
1665
|
+
},
|
|
1666
|
+
{
|
|
1667
|
+
name: "offset",
|
|
1668
|
+
options: { offset: [0, -10] }
|
|
1669
|
+
}
|
|
1670
|
+
],
|
|
1671
|
+
placement: "top-start"
|
|
1672
|
+
}
|
|
1673
|
+
);
|
|
1674
|
+
};
|
|
1675
|
+
function PlayerTagsEdit(props) {
|
|
1676
|
+
return /* @__PURE__ */ jsx(
|
|
1677
|
+
TagEditor,
|
|
1678
|
+
{
|
|
1679
|
+
title: "Player Tags",
|
|
1680
|
+
selectedTags: props.PlayerTags,
|
|
1681
|
+
possibleTags: props.possibleTags,
|
|
1682
|
+
onToggleTag: props.updatePlayerTags
|
|
1683
|
+
}
|
|
1684
|
+
);
|
|
1685
|
+
}
|
|
1686
|
+
var SORT_OPTIONS = [
|
|
1687
|
+
{ id: "relevance", label: "Relevance" },
|
|
1688
|
+
{ id: "newest", label: "Newest" },
|
|
1689
|
+
{ id: "popular", label: "Most Popular" }
|
|
1690
|
+
];
|
|
1691
|
+
var SortOptions = ({
|
|
1692
|
+
defaultValue: defaultValue2 = "relevance",
|
|
1693
|
+
onChange
|
|
1694
|
+
}) => {
|
|
1695
|
+
const handleSortChange = (event) => {
|
|
1696
|
+
onChange == null ? void 0 : onChange(event.target.value);
|
|
1697
|
+
};
|
|
1698
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1699
|
+
/* @__PURE__ */ jsx(Typography10, { variant: "h6", gutterBottom: true, children: "Sort By" }),
|
|
1700
|
+
/* @__PURE__ */ jsx(FormControl2, { children: /* @__PURE__ */ jsx(RadioGroup, { defaultValue: defaultValue2, onChange: handleSortChange, children: SORT_OPTIONS.map((option) => /* @__PURE__ */ jsx(
|
|
1701
|
+
FormControlLabel,
|
|
1702
|
+
{
|
|
1703
|
+
value: option.id,
|
|
1704
|
+
control: /* @__PURE__ */ jsx(Radio, {}),
|
|
1705
|
+
label: option.label
|
|
1706
|
+
},
|
|
1707
|
+
option.id
|
|
1708
|
+
)) }) })
|
|
1709
|
+
] });
|
|
1710
|
+
};
|
|
1711
|
+
var SortOptions_default = SortOptions;
|
|
1712
|
+
var TagsFilter = ({
|
|
1713
|
+
onChange,
|
|
1714
|
+
tags: Tags = []
|
|
1715
|
+
}) => {
|
|
1716
|
+
const [mustHaveTags, setMustHaveTags] = React7.useState([]);
|
|
1717
|
+
const [mustNotHaveTags, setMustNotHaveTags] = React7.useState([]);
|
|
1718
|
+
const [shouldHaveAtLeastOneTags, setShouldHaveAtLeastOneTags] = React7.useState([]);
|
|
1719
|
+
Tags = !!Tags ? Tags : [];
|
|
1720
|
+
const [inputValues, setInputValues] = React7.useState({
|
|
1721
|
+
mustHave: "",
|
|
1722
|
+
mustNotHave: "",
|
|
1723
|
+
shouldHaveAtLeastOne: ""
|
|
1724
|
+
});
|
|
1725
|
+
const tagOptions = React7.useMemo(() => {
|
|
1726
|
+
console.log("available tags: " + JSON.stringify(Tags));
|
|
1727
|
+
console.log(!Tags);
|
|
1728
|
+
if (!Tags || Tags.length == 0 || !Tags.map) return [];
|
|
1729
|
+
return Tags.map((tag) => ({
|
|
1730
|
+
value: tag.id,
|
|
1731
|
+
label: tag.label
|
|
1732
|
+
}));
|
|
1733
|
+
}, [Tags]);
|
|
1734
|
+
const handleTagChange = (tagId, category) => {
|
|
1735
|
+
let newTags = [];
|
|
1736
|
+
switch (category) {
|
|
1737
|
+
case "mustHave":
|
|
1738
|
+
newTags = mustHaveTags.includes(tagId) ? mustHaveTags.filter((id) => id !== tagId) : [...mustHaveTags, tagId];
|
|
1739
|
+
setMustHaveTags(newTags);
|
|
1740
|
+
break;
|
|
1741
|
+
case "mustNotHave":
|
|
1742
|
+
newTags = mustNotHaveTags.includes(tagId) ? mustNotHaveTags.filter((id) => id !== tagId) : [...mustNotHaveTags, tagId];
|
|
1743
|
+
setMustNotHaveTags(newTags);
|
|
1744
|
+
break;
|
|
1745
|
+
case "shouldHaveAtLeastOne":
|
|
1746
|
+
newTags = shouldHaveAtLeastOneTags.includes(tagId) ? shouldHaveAtLeastOneTags.filter((id) => id !== tagId) : [...shouldHaveAtLeastOneTags, tagId];
|
|
1747
|
+
setShouldHaveAtLeastOneTags(newTags);
|
|
1748
|
+
break;
|
|
1749
|
+
}
|
|
1750
|
+
if (onChange) {
|
|
1751
|
+
onChange({
|
|
1752
|
+
mustHave: category === "mustHave" ? newTags : mustHaveTags,
|
|
1753
|
+
mustNotHave: category === "mustNotHave" ? newTags : mustNotHaveTags,
|
|
1754
|
+
shouldHaveAtLeastOne: category === "shouldHaveAtLeastOne" ? newTags : shouldHaveAtLeastOneTags
|
|
1755
|
+
});
|
|
1756
|
+
}
|
|
1757
|
+
};
|
|
1758
|
+
const renderSelectedTags = (selectedTags, category) => {
|
|
1759
|
+
const tagValues = [];
|
|
1760
|
+
if (!Tags || Tags.length == 0 || !Tags.map) return null;
|
|
1761
|
+
Tags.forEach((tag) => {
|
|
1762
|
+
if (selectedTags.includes(tag.id)) {
|
|
1763
|
+
tagValues.push(tag);
|
|
1764
|
+
}
|
|
1765
|
+
});
|
|
1766
|
+
if (tagValues.length === 0) {
|
|
1767
|
+
return null;
|
|
1768
|
+
}
|
|
1769
|
+
return /* @__PURE__ */ jsx(Box2, { sx: { display: "flex", flexWrap: "wrap", gap: 1, mb: 2 }, children: tagValues.map((tag) => /* @__PURE__ */ jsxs(
|
|
1770
|
+
"span",
|
|
1771
|
+
{
|
|
1772
|
+
className: "inline-block text-sm px-3 py-1 rounded-full outline-black outline-2 font-outlined",
|
|
1773
|
+
style: {
|
|
1774
|
+
background: tag.color || "#bfbcbb",
|
|
1775
|
+
color: "white",
|
|
1776
|
+
textShadow: "black 0.2em 0.2em 0.4em"
|
|
1777
|
+
},
|
|
1778
|
+
children: [
|
|
1779
|
+
tag.label,
|
|
1780
|
+
/* @__PURE__ */ jsx(
|
|
1781
|
+
"button",
|
|
1782
|
+
{
|
|
1783
|
+
type: "button",
|
|
1784
|
+
onClick: () => handleTagChange(tag.id, category),
|
|
1785
|
+
className: "ml-2 text-red-500 bg-white bg-opacity-50 rounded-full outline-black outline-2 font-outlined",
|
|
1786
|
+
children: "\xD7"
|
|
1787
|
+
}
|
|
1788
|
+
)
|
|
1789
|
+
]
|
|
1790
|
+
},
|
|
1791
|
+
tag.id
|
|
1792
|
+
)) });
|
|
1793
|
+
};
|
|
1794
|
+
const createTagSelector = (category, label) => {
|
|
1795
|
+
const selectedTags = category === "mustHave" ? mustHaveTags : category === "mustNotHave" ? mustNotHaveTags : shouldHaveAtLeastOneTags;
|
|
1796
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1797
|
+
/* @__PURE__ */ jsx(Typography10, { variant: "subtitle1", gutterBottom: true, sx: { mt: 2 }, children: label }),
|
|
1798
|
+
renderSelectedTags(selectedTags, category),
|
|
1799
|
+
/* @__PURE__ */ jsx(
|
|
1800
|
+
Autocomplete,
|
|
1801
|
+
{
|
|
1802
|
+
options: tagOptions,
|
|
1803
|
+
filterOptions: (options, state) => {
|
|
1804
|
+
const tagsToExclude = /* @__PURE__ */ new Set();
|
|
1805
|
+
selectedTags.forEach((id) => tagsToExclude.add(id));
|
|
1806
|
+
if (category !== "mustHave") {
|
|
1807
|
+
mustHaveTags.forEach((id) => tagsToExclude.add(id));
|
|
1808
|
+
}
|
|
1809
|
+
if (category !== "mustNotHave") {
|
|
1810
|
+
mustNotHaveTags.forEach((id) => tagsToExclude.add(id));
|
|
1811
|
+
}
|
|
1812
|
+
if (category !== "shouldHaveAtLeastOne") {
|
|
1813
|
+
shouldHaveAtLeastOneTags.forEach((id) => tagsToExclude.add(id));
|
|
1814
|
+
}
|
|
1815
|
+
return options.filter(
|
|
1816
|
+
(option) => (
|
|
1817
|
+
// Exclude options already selected in any category
|
|
1818
|
+
!tagsToExclude.has(option.value) && // Filter based on user input
|
|
1819
|
+
option.label.toLowerCase().includes(state.inputValue.toLowerCase())
|
|
1820
|
+
)
|
|
1821
|
+
).slice(0, 3);
|
|
1822
|
+
},
|
|
1823
|
+
value: null,
|
|
1824
|
+
inputValue: inputValues[category],
|
|
1825
|
+
onInputChange: (event, newInputValue) => {
|
|
1826
|
+
if (event && event.type === "change") {
|
|
1827
|
+
setInputValues({
|
|
1828
|
+
...inputValues,
|
|
1829
|
+
[category]: newInputValue
|
|
1830
|
+
});
|
|
1831
|
+
}
|
|
1832
|
+
},
|
|
1833
|
+
onChange: (event, newValue) => {
|
|
1834
|
+
if (newValue) {
|
|
1835
|
+
handleTagChange(newValue.value, category);
|
|
1836
|
+
}
|
|
1837
|
+
setInputValues({
|
|
1838
|
+
...inputValues,
|
|
1839
|
+
[category]: ""
|
|
1840
|
+
});
|
|
1841
|
+
},
|
|
1842
|
+
slots: { popper: CustomPopper2 },
|
|
1843
|
+
renderInput: (params) => /* @__PURE__ */ jsx(TextField3, { ...params, label: `Select ${label}` })
|
|
1844
|
+
},
|
|
1845
|
+
`${category}-${selectedTags.join("-")}`
|
|
1846
|
+
)
|
|
1847
|
+
] });
|
|
1848
|
+
};
|
|
1849
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1850
|
+
/* @__PURE__ */ jsx(Typography10, { variant: "h6", gutterBottom: true, children: "Tags" }),
|
|
1851
|
+
createTagSelector("mustHave", "Must Have Tags"),
|
|
1852
|
+
/* @__PURE__ */ jsx(Divider2, { sx: { my: 2 } }),
|
|
1853
|
+
createTagSelector("mustNotHave", "Must Not Have Tags"),
|
|
1854
|
+
/* @__PURE__ */ jsx(Divider2, { sx: { my: 2 } }),
|
|
1855
|
+
createTagSelector("shouldHaveAtLeastOne", "Should Contain At Least One Tag")
|
|
1856
|
+
] });
|
|
1857
|
+
};
|
|
1858
|
+
var CustomPopper2 = (props) => {
|
|
1859
|
+
return /* @__PURE__ */ jsx(
|
|
1860
|
+
Popper,
|
|
1861
|
+
{
|
|
1862
|
+
...props,
|
|
1863
|
+
modifiers: [
|
|
1864
|
+
{
|
|
1865
|
+
name: "preventOverflow",
|
|
1866
|
+
options: {
|
|
1867
|
+
boundary: "viewport"
|
|
1868
|
+
// Prevent the Popper from going outside the viewport
|
|
1869
|
+
}
|
|
1870
|
+
},
|
|
1871
|
+
{
|
|
1872
|
+
name: "offset",
|
|
1873
|
+
options: {
|
|
1874
|
+
offset: [0, -10]
|
|
1875
|
+
// Set negative vertical offset (adjust value as needed)
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
],
|
|
1879
|
+
placement: "top-start"
|
|
1880
|
+
}
|
|
1881
|
+
);
|
|
1882
|
+
};
|
|
1883
|
+
var TagsFilter_default = TagsFilter;
|
|
1884
|
+
var FILTER_TYPES = [
|
|
1885
|
+
{ id: "player", label: "Players" },
|
|
1886
|
+
{ id: "event", label: "Events", disabled: true },
|
|
1887
|
+
{ id: "table", label: "Tables", disabled: true }
|
|
1888
|
+
];
|
|
1889
|
+
var TypeFilter = ({ onChange }) => {
|
|
1890
|
+
const [selectedTypes, setSelectedTypes] = React7.useState([]);
|
|
1891
|
+
const handleTypeChange = (typeId) => {
|
|
1892
|
+
const newSelectedTypes = selectedTypes.includes(typeId) ? selectedTypes.filter((id) => id !== typeId) : [...selectedTypes, typeId];
|
|
1893
|
+
setSelectedTypes(newSelectedTypes);
|
|
1894
|
+
onChange == null ? void 0 : onChange(newSelectedTypes);
|
|
1895
|
+
};
|
|
1896
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1897
|
+
/* @__PURE__ */ jsx(Typography10, { variant: "h6", gutterBottom: true, children: "Type" }),
|
|
1898
|
+
/* @__PURE__ */ jsx(FormGroup, { children: FILTER_TYPES.map((type) => /* @__PURE__ */ jsx(
|
|
1899
|
+
FormControlLabel,
|
|
1900
|
+
{
|
|
1901
|
+
control: /* @__PURE__ */ jsx(
|
|
1902
|
+
Checkbox,
|
|
1903
|
+
{
|
|
1904
|
+
checked: selectedTypes.includes(type.id),
|
|
1905
|
+
onChange: () => handleTypeChange(type.id),
|
|
1906
|
+
disabled: type.disabled
|
|
1907
|
+
}
|
|
1908
|
+
),
|
|
1909
|
+
label: type.label
|
|
1910
|
+
},
|
|
1911
|
+
type.id
|
|
1912
|
+
)) })
|
|
1913
|
+
] });
|
|
1914
|
+
};
|
|
1915
|
+
var TypeFilter_default = TypeFilter;
|
|
1916
|
+
var FiltersContainer = ({
|
|
1917
|
+
onTypeChange,
|
|
1918
|
+
onTagChange,
|
|
1919
|
+
onSubmit,
|
|
1920
|
+
tags
|
|
1921
|
+
}) => {
|
|
1922
|
+
return /* @__PURE__ */ jsxs(Box2, { children: [
|
|
1923
|
+
/* @__PURE__ */ jsx(TypeFilter_default, { onChange: onTypeChange }),
|
|
1924
|
+
/* @__PURE__ */ jsx(Divider2, { sx: { my: 2 } }),
|
|
1925
|
+
/* @__PURE__ */ jsx(
|
|
1926
|
+
TagsFilter_default,
|
|
1927
|
+
{
|
|
1928
|
+
tags,
|
|
1929
|
+
onChange: onTagChange
|
|
1930
|
+
}
|
|
1931
|
+
),
|
|
1932
|
+
/* @__PURE__ */ jsx(Divider2, { sx: { my: 2 } }),
|
|
1933
|
+
/* @__PURE__ */ jsx(Box2, { sx: { display: "flex", justifyContent: "center", mt: 2 }, children: /* @__PURE__ */ jsx(
|
|
1934
|
+
Button7,
|
|
1935
|
+
{
|
|
1936
|
+
variant: "contained",
|
|
1937
|
+
color: "primary",
|
|
1938
|
+
size: "large",
|
|
1939
|
+
startIcon: /* @__PURE__ */ jsx(SearchIcon, {}),
|
|
1940
|
+
onClick: onSubmit,
|
|
1941
|
+
sx: {
|
|
1942
|
+
width: "100%",
|
|
1943
|
+
py: 1.5,
|
|
1944
|
+
borderRadius: 2,
|
|
1945
|
+
boxShadow: "0px 4px 10px rgba(0, 0, 0, 0.1)",
|
|
1946
|
+
background: "linear-gradient(135deg, rgba(25, 118, 210, 0.8), rgba(25, 118, 210, 1))",
|
|
1947
|
+
"&:hover": {
|
|
1948
|
+
background: "linear-gradient(135deg, rgba(25, 118, 210, 0.9), rgba(25, 118, 210, 1))",
|
|
1949
|
+
boxShadow: "0px 6px 15px rgba(0, 0, 0, 0.2)"
|
|
1950
|
+
}
|
|
1951
|
+
},
|
|
1952
|
+
children: "Search"
|
|
1953
|
+
}
|
|
1954
|
+
) })
|
|
1955
|
+
] });
|
|
1956
|
+
};
|
|
1957
|
+
var FiltersContainer_default = FiltersContainer;
|
|
1958
|
+
var PlayersScrollableList = ({
|
|
1959
|
+
results,
|
|
1960
|
+
tags,
|
|
1961
|
+
maxHeight,
|
|
1962
|
+
onResultClick
|
|
1963
|
+
}) => {
|
|
1964
|
+
const players = (results || []).filter((r) => (r == null ? void 0 : r.type) === "player");
|
|
1965
|
+
const handleClick = (id) => onResultClick == null ? void 0 : onResultClick(id);
|
|
1966
|
+
return /* @__PURE__ */ jsx(
|
|
1967
|
+
ScrollableResultsList_default,
|
|
1968
|
+
{
|
|
1969
|
+
results: players,
|
|
1970
|
+
tags,
|
|
1971
|
+
maxHeight,
|
|
1972
|
+
onResultClick: (id, type) => {
|
|
1973
|
+
if (type === "player") handleClick(id);
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
);
|
|
1977
|
+
};
|
|
1978
|
+
var PlayersScrollableList_default = PlayersScrollableList;
|
|
1979
|
+
var SearchResultCard = ({
|
|
1980
|
+
result,
|
|
1981
|
+
onClick,
|
|
1982
|
+
tags
|
|
1983
|
+
}) => {
|
|
1984
|
+
return /* @__PURE__ */ jsx(BaseSearchResultCard_default, { result, onClick, tags });
|
|
1985
|
+
};
|
|
1986
|
+
var SearchResultCard_default = SearchResultCard;
|
|
1987
|
+
function SearchPageLayout({
|
|
1988
|
+
results,
|
|
1989
|
+
title = "Search Results",
|
|
1990
|
+
onTypeChange,
|
|
1991
|
+
onTagChange,
|
|
1992
|
+
onSubmit,
|
|
1993
|
+
onResultClick,
|
|
1994
|
+
validTags,
|
|
1995
|
+
allTags
|
|
1996
|
+
}) {
|
|
1997
|
+
"use client";
|
|
1998
|
+
const theme = useTheme();
|
|
1999
|
+
const isMobile = useMediaQuery(theme.breakpoints.down("md"));
|
|
2000
|
+
return /* @__PURE__ */ jsxs(Box2, { sx: { padding: 2 }, children: [
|
|
2001
|
+
/* @__PURE__ */ jsx(Card10, { sx: { marginBottom: 2 }, children: /* @__PURE__ */ jsx(
|
|
2002
|
+
CardHeader4,
|
|
2003
|
+
{
|
|
2004
|
+
title,
|
|
2005
|
+
style: {
|
|
2006
|
+
background: "linear-gradient(135deg, rgba(25, 118, 210, 0.8), rgba(25, 118, 210, 1))",
|
|
2007
|
+
color: "#FFFFFF",
|
|
2008
|
+
fontSize: "1.5rem",
|
|
2009
|
+
textShadow: "0px 3px 6px rgba(0, 0, 0, 0.5)"
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
) }),
|
|
2013
|
+
/* @__PURE__ */ jsxs(Grid9, { container: true, spacing: 2, children: [
|
|
2014
|
+
/* @__PURE__ */ jsx(Grid9, { size: { xs: 12, md: 3 }, children: /* @__PURE__ */ jsxs(Card10, { sx: { marginBottom: isMobile ? 2 : 0 }, children: [
|
|
2015
|
+
/* @__PURE__ */ jsx(
|
|
2016
|
+
CardHeader4,
|
|
2017
|
+
{
|
|
2018
|
+
title: "Filters",
|
|
2019
|
+
style: {
|
|
2020
|
+
background: "linear-gradient(135deg, rgba(25, 118, 210, 0.8), rgba(25, 118, 210, 1))",
|
|
2021
|
+
color: "#FFFFFF",
|
|
2022
|
+
fontSize: "1.5rem",
|
|
2023
|
+
textShadow: "0px 3px 6px rgba(0, 0, 0, 0.5)"
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
),
|
|
2027
|
+
/* @__PURE__ */ jsx(CardContent10, { children: /* @__PURE__ */ jsx(
|
|
2028
|
+
FiltersContainer_default,
|
|
2029
|
+
{
|
|
2030
|
+
onTypeChange,
|
|
2031
|
+
onTagChange,
|
|
2032
|
+
onSubmit,
|
|
2033
|
+
tags: validTags
|
|
2034
|
+
}
|
|
2035
|
+
) })
|
|
2036
|
+
] }) }),
|
|
2037
|
+
/* @__PURE__ */ jsx(Grid9, { size: { xs: 12, md: 9 }, children: /* @__PURE__ */ jsxs(Card10, { children: [
|
|
2038
|
+
/* @__PURE__ */ jsx(
|
|
2039
|
+
CardHeader4,
|
|
2040
|
+
{
|
|
2041
|
+
title: "Results",
|
|
2042
|
+
style: {
|
|
2043
|
+
background: "linear-gradient(135deg, rgba(25, 118, 210, 0.8), rgba(25, 118, 210, 1))",
|
|
2044
|
+
color: "#FFFFFF",
|
|
2045
|
+
fontSize: "1.5rem",
|
|
2046
|
+
textShadow: "0px 3px 6px rgba(0, 0, 0, 0.5)"
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
),
|
|
2050
|
+
/* @__PURE__ */ jsx(CardContent10, { children: /* @__PURE__ */ jsx(
|
|
2051
|
+
ResultsContainer_default,
|
|
2052
|
+
{
|
|
2053
|
+
results,
|
|
2054
|
+
onResultClick,
|
|
2055
|
+
tags: allTags
|
|
2056
|
+
}
|
|
2057
|
+
) })
|
|
2058
|
+
] }) })
|
|
2059
|
+
] })
|
|
2060
|
+
] });
|
|
2061
|
+
}
|
|
2062
|
+
var GameTableContext = React7.createContext(void 0);
|
|
2063
|
+
function GameTableProvider(props) {
|
|
2064
|
+
return /* @__PURE__ */ jsx(Fragment, { children: props.children });
|
|
2065
|
+
}
|
|
2066
|
+
function useGameTableContext() {
|
|
2067
|
+
const context = React7.useContext(GameTableContext);
|
|
2068
|
+
if (context) {
|
|
2069
|
+
return context;
|
|
2070
|
+
}
|
|
2071
|
+
throw new Error("useGameTableContext is deprecated in the package build. Pass table data through props instead.");
|
|
2072
|
+
}
|
|
2073
|
+
var ModalContext = createContext({
|
|
2074
|
+
showModal: (content) => {
|
|
2075
|
+
},
|
|
2076
|
+
hideModal: () => {
|
|
2077
|
+
}
|
|
2078
|
+
});
|
|
2079
|
+
var useModal = () => useContext(ModalContext);
|
|
2080
|
+
var Modal = ({ onClose, children }) => {
|
|
2081
|
+
const modalRef = useRef(null);
|
|
2082
|
+
const previouslyFocusedElement = useRef(null);
|
|
2083
|
+
useEffect(() => {
|
|
2084
|
+
var _a;
|
|
2085
|
+
if (children) {
|
|
2086
|
+
previouslyFocusedElement.current = document.activeElement;
|
|
2087
|
+
(_a = modalRef.current) == null ? void 0 : _a.focus();
|
|
2088
|
+
}
|
|
2089
|
+
return () => {
|
|
2090
|
+
var _a2;
|
|
2091
|
+
(_a2 = previouslyFocusedElement.current) == null ? void 0 : _a2.focus();
|
|
2092
|
+
};
|
|
2093
|
+
}, [children]);
|
|
2094
|
+
const handleOnClose = () => {
|
|
2095
|
+
onClose();
|
|
2096
|
+
};
|
|
2097
|
+
const handleKeyDown = (e) => {
|
|
2098
|
+
var _a;
|
|
2099
|
+
if (e.key !== "Tab") return;
|
|
2100
|
+
const focusableElements = (_a = modalRef.current) == null ? void 0 : _a.querySelectorAll(
|
|
2101
|
+
'button, [tabindex]:not([tabindex="-1"])'
|
|
2102
|
+
);
|
|
2103
|
+
if (!focusableElements || focusableElements.length === 0) return;
|
|
2104
|
+
const first = focusableElements[0];
|
|
2105
|
+
const last = focusableElements[focusableElements.length - 1];
|
|
2106
|
+
if (e.shiftKey) {
|
|
2107
|
+
if (document.activeElement === first) {
|
|
2108
|
+
e.preventDefault();
|
|
2109
|
+
last.focus();
|
|
2110
|
+
}
|
|
2111
|
+
} else {
|
|
2112
|
+
if (document.activeElement === last) {
|
|
2113
|
+
e.preventDefault();
|
|
2114
|
+
first.focus();
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
};
|
|
2118
|
+
return /* @__PURE__ */ jsx(
|
|
2119
|
+
"div",
|
|
2120
|
+
{
|
|
2121
|
+
className: "modal-overlay",
|
|
2122
|
+
onKeyDown: handleKeyDown,
|
|
2123
|
+
ref: modalRef,
|
|
2124
|
+
role: "dialog",
|
|
2125
|
+
tabIndex: -1,
|
|
2126
|
+
children: /* @__PURE__ */ jsxs("div", { className: "modal-container", children: [
|
|
2127
|
+
/* @__PURE__ */ jsx("div", { className: "modal-control-strip", children: /* @__PURE__ */ jsx("button", { onClick: handleOnClose, children: "X" }) }),
|
|
2128
|
+
/* @__PURE__ */ jsx("div", { className: "modal-content", children })
|
|
2129
|
+
] })
|
|
2130
|
+
}
|
|
2131
|
+
);
|
|
2132
|
+
};
|
|
2133
|
+
var Modal_default = Modal;
|
|
2134
|
+
var ModalProvider = ({ children }) => {
|
|
2135
|
+
const [modalContent, setModalContent] = useState(null);
|
|
2136
|
+
const showModal = (content) => setModalContent(content);
|
|
2137
|
+
const hideModal = () => setModalContent(null);
|
|
2138
|
+
return /* @__PURE__ */ jsxs(ModalContext.Provider, { value: { showModal, hideModal }, children: [
|
|
2139
|
+
children,
|
|
2140
|
+
modalContent && /* @__PURE__ */ jsx(Modal_default, { onClose: hideModal, children: modalContent })
|
|
2141
|
+
] });
|
|
2142
|
+
};
|
|
2143
|
+
var ModalProvider_default = ModalProvider;
|
|
2144
|
+
var PlayerHighlightsCard = function(props) {
|
|
2145
|
+
const {
|
|
2146
|
+
allTags,
|
|
2147
|
+
canChangeDungeonMaster,
|
|
2148
|
+
canEdit,
|
|
2149
|
+
handleAssignToDungeonMaster,
|
|
2150
|
+
isWaitList,
|
|
2151
|
+
player,
|
|
2152
|
+
removeFromTable
|
|
2153
|
+
} = props;
|
|
2154
|
+
return /* @__PURE__ */ jsx(Card, { elevation: 3, sx: { backgroundColor: canEdit ? "#fffbea" : "#f5f9fa", marginBottom: "6px" }, children: /* @__PURE__ */ jsxs(CardContent, { children: [
|
|
2155
|
+
/* @__PURE__ */ jsxs(Grid9, { container: true, spacing: 2, direction: "column", children: [
|
|
2156
|
+
/* @__PURE__ */ jsxs(Grid9, { container: true, direction: "row", children: [
|
|
2157
|
+
/* @__PURE__ */ jsx(Grid9, { children: /* @__PURE__ */ jsx(Image2, { alt: player.username + "'s profile pic", height: 64, src: player.miniPic || "", width: 64 }) }),
|
|
2158
|
+
/* @__PURE__ */ jsx(Grid9, { children: /* @__PURE__ */ jsx(Typography, { variant: "h5", children: player.username }) })
|
|
2159
|
+
] }),
|
|
2160
|
+
/* @__PURE__ */ jsx(Grid9, { children: renderTagsFromIds(player.tags, allTags) })
|
|
2161
|
+
] }),
|
|
2162
|
+
canEdit && /* @__PURE__ */ jsxs(Grid9, { children: [
|
|
2163
|
+
/* @__PURE__ */ jsx(Button7, { onClick: () => removeFromTable(player), children: isWaitList ? /* @__PURE__ */ jsx("p", { children: "Deny Player" }) : /* @__PURE__ */ jsx("p", { children: "Remove Player" }) }),
|
|
2164
|
+
canChangeDungeonMaster && /* @__PURE__ */ jsx(Button7, { onClick: () => {
|
|
2165
|
+
handleAssignToDungeonMaster(player);
|
|
2166
|
+
removeFromTable(player);
|
|
2167
|
+
}, children: /* @__PURE__ */ jsx("p", { children: "Assign to DungeonMaster" }) })
|
|
2168
|
+
] })
|
|
2169
|
+
] }) });
|
|
2170
|
+
};
|
|
2171
|
+
var DMHighlightsCard = function({ canEdit, player, allTags }) {
|
|
2172
|
+
return /* @__PURE__ */ jsxs(Card, { elevation: 3, sx: { backgroundColor: "#f5f9fa", marginBottom: "6px" }, children: [
|
|
2173
|
+
/* @__PURE__ */ jsx(CardHeader, { slotProps: { title: { variant: "h4" } }, title: "Game Master" }),
|
|
2174
|
+
/* @__PURE__ */ jsx(CardContent, { sx: { backgroundColor: canEdit ? "#fffbea" : "inherit" }, children: /* @__PURE__ */ jsxs(Grid9, { container: true, spacing: 2, direction: "column", children: [
|
|
2175
|
+
/* @__PURE__ */ jsx(Grid9, { children: /* @__PURE__ */ jsx(Typography, { variant: "h5", children: player.username }) }),
|
|
2176
|
+
/* @__PURE__ */ jsxs(Grid9, { container: true, direction: "row", children: [
|
|
2177
|
+
/* @__PURE__ */ jsx(Grid9, { children: /* @__PURE__ */ jsx(Image2, { alt: player.username + "'s profile pic", height: 120, src: player.imageUrl ? player.imageUrl : "", width: 256 }) }),
|
|
2178
|
+
/* @__PURE__ */ jsx(Grid9, { children: renderTagsFromIds(player.tags, allTags) }),
|
|
2179
|
+
/* @__PURE__ */ jsx(Typography, { children: player.description })
|
|
2180
|
+
] })
|
|
2181
|
+
] }) })
|
|
2182
|
+
] });
|
|
2183
|
+
};
|
|
2184
|
+
function TableActionsBar(props) {
|
|
2185
|
+
const { hideModal, showModal } = useModal();
|
|
2186
|
+
const {
|
|
2187
|
+
isInEditMode,
|
|
2188
|
+
numPlayers,
|
|
2189
|
+
onDeleteTable,
|
|
2190
|
+
onEditModeChange,
|
|
2191
|
+
onJoinWaitlist,
|
|
2192
|
+
onLeaveTable,
|
|
2193
|
+
onPromoteWaitlistPlayer,
|
|
2194
|
+
onSave,
|
|
2195
|
+
slots,
|
|
2196
|
+
tableStatus,
|
|
2197
|
+
waitlistPlayers
|
|
2198
|
+
} = props;
|
|
2199
|
+
const { isOwner, isPlayer, isDM, onWaitlist } = tableStatus;
|
|
2200
|
+
const canEditTable = isOwner && !isInEditMode;
|
|
2201
|
+
const canSaveTable = isOwner && isInEditMode;
|
|
2202
|
+
const canViewWaitlist = isOwner || isDM || waitlistPlayers.length > 0;
|
|
2203
|
+
const renderPlayerWaitlistModalContent = (canMovePlayersToTable) => {
|
|
2204
|
+
if (waitlistPlayers.length === 0) {
|
|
2205
|
+
return /* @__PURE__ */ jsx("p", { children: "Waitlist is empty!" });
|
|
2206
|
+
}
|
|
2207
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
|
|
2208
|
+
/* @__PURE__ */ jsx(CardHeader4, { slotProps: { title: { variant: "h4" } }, title: "Waitlist Players: " }),
|
|
2209
|
+
/* @__PURE__ */ jsx("ul", { className: "gap-8", children: waitlistPlayers.map((player) => /* @__PURE__ */ jsxs(
|
|
2210
|
+
"li",
|
|
2211
|
+
{
|
|
2212
|
+
className: `${canMovePlayersToTable ? "bg-amber-100 cursor-pointer" : "bg-gray-200"} mb-8 flex flex-row flex-start space-between justify-center items-center gap-3 p-2 rounded`,
|
|
2213
|
+
onClick: () => canMovePlayersToTable ? onPromoteWaitlistPlayer == null ? void 0 : onPromoteWaitlistPlayer(player.id) : void 0,
|
|
2214
|
+
tabIndex: 0,
|
|
2215
|
+
children: [
|
|
2216
|
+
/* @__PURE__ */ jsx(
|
|
2217
|
+
Image2,
|
|
2218
|
+
{
|
|
2219
|
+
alt: player.username + "'s profile pic",
|
|
2220
|
+
height: 64,
|
|
2221
|
+
src: player.miniPic || "",
|
|
2222
|
+
width: 64
|
|
2223
|
+
}
|
|
2224
|
+
),
|
|
2225
|
+
/* @__PURE__ */ jsx("div", { children: player.username })
|
|
2226
|
+
]
|
|
2227
|
+
},
|
|
2228
|
+
player.id
|
|
2229
|
+
)) }),
|
|
2230
|
+
/* @__PURE__ */ jsx("button", { onClick: () => hideModal(), children: "close modal" })
|
|
2231
|
+
] });
|
|
2232
|
+
};
|
|
2233
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, direction: "column", spacing: 1, children: [
|
|
2234
|
+
/* @__PURE__ */ jsx(Grid, { container: true, direction: "row", children: /* @__PURE__ */ jsxs(Typography, { color: "white", sx: { textShadow: "4px 4px 6px rgba(0, 0, 0, 0.5)" }, children: [
|
|
2235
|
+
"Players: ",
|
|
2236
|
+
numPlayers,
|
|
2237
|
+
" / ",
|
|
2238
|
+
slots
|
|
2239
|
+
] }) }),
|
|
2240
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, direction: "row", children: [
|
|
2241
|
+
!isOwner && !isPlayer && !isDM && !onWaitlist && /* @__PURE__ */ jsx(Button7, { onClick: () => onJoinWaitlist == null ? void 0 : onJoinWaitlist(), sx: buttonStyle, children: "Join Waitlist" }),
|
|
2242
|
+
!isOwner && (isPlayer || onWaitlist) && /* @__PURE__ */ jsx(Button7, { onClick: () => onLeaveTable == null ? void 0 : onLeaveTable(), sx: buttonStyle, children: onWaitlist ? "Leave Waitlist" : "Leave Table" }),
|
|
2243
|
+
canEditTable ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2244
|
+
/* @__PURE__ */ jsx(Button7, { onClick: () => onEditModeChange(true), sx: buttonStyle, endIcon: /* @__PURE__ */ jsx(EditIcon, {}), children: "Edit" }),
|
|
2245
|
+
canViewWaitlist ? /* @__PURE__ */ jsx(
|
|
2246
|
+
Button7,
|
|
2247
|
+
{
|
|
2248
|
+
endIcon: /* @__PURE__ */ jsx(ListIcon, {}),
|
|
2249
|
+
onClick: () => showModal(renderPlayerWaitlistModalContent(false)),
|
|
2250
|
+
sx: buttonStyle,
|
|
2251
|
+
children: "View Waitlist"
|
|
2252
|
+
}
|
|
2253
|
+
) : null
|
|
2254
|
+
] }) : canSaveTable ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2255
|
+
/* @__PURE__ */ jsx(Button7, { onClick: onSave, sx: buttonStyle, endIcon: /* @__PURE__ */ jsx(SaveIcon, {}), children: "Save" }),
|
|
2256
|
+
/* @__PURE__ */ jsx(Button7, { onClick: () => onEditModeChange(false), sx: buttonStyle, children: "Cancel" }),
|
|
2257
|
+
/* @__PURE__ */ jsx(
|
|
2258
|
+
Button7,
|
|
2259
|
+
{
|
|
2260
|
+
endIcon: /* @__PURE__ */ jsx(ListIcon, {}),
|
|
2261
|
+
onClick: () => showModal(renderPlayerWaitlistModalContent(true)),
|
|
2262
|
+
sx: buttonStyle,
|
|
2263
|
+
children: "Edit Waitlist"
|
|
2264
|
+
}
|
|
2265
|
+
)
|
|
2266
|
+
] }) : null,
|
|
2267
|
+
isOwner && /* @__PURE__ */ jsx(Button7, { onClick: () => onDeleteTable == null ? void 0 : onDeleteTable(), sx: buttonStyle, endIcon: /* @__PURE__ */ jsx(DeleteIcon, {}), children: "Delete Table" })
|
|
2268
|
+
] })
|
|
2269
|
+
] });
|
|
2270
|
+
}
|
|
2271
|
+
var buttonStyle = {
|
|
2272
|
+
marginLeft: "3px",
|
|
2273
|
+
backgroundColor: "blue",
|
|
2274
|
+
color: "white",
|
|
2275
|
+
borderRadius: "5px"
|
|
2276
|
+
};
|
|
2277
|
+
var AutoResizingTextarea = (props) => {
|
|
2278
|
+
const { isInEditMode, onChange, textareaRef, value } = props;
|
|
2279
|
+
useEffect(() => {
|
|
2280
|
+
if (isInEditMode && textareaRef.current) {
|
|
2281
|
+
const textarea = textareaRef.current;
|
|
2282
|
+
textarea.style.height = "auto";
|
|
2283
|
+
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
2284
|
+
}
|
|
2285
|
+
}, [isInEditMode, textareaRef, value]);
|
|
2286
|
+
return /* @__PURE__ */ jsx(
|
|
2287
|
+
"textarea",
|
|
2288
|
+
{
|
|
2289
|
+
ref: textareaRef,
|
|
2290
|
+
value,
|
|
2291
|
+
onChange: (e) => onChange(e.target.value),
|
|
2292
|
+
style: {
|
|
2293
|
+
backgroundColor: "#fffbea",
|
|
2294
|
+
overflow: "hidden",
|
|
2295
|
+
resize: "none",
|
|
2296
|
+
width: "100%"
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
);
|
|
2300
|
+
};
|
|
2301
|
+
var AutoResizingTextarea_default = AutoResizingTextarea;
|
|
2302
|
+
var NextGameCountdown = ({ nextGameTime }) => {
|
|
2303
|
+
const [timeLeft, setTimeLeft] = useState("");
|
|
2304
|
+
useEffect(() => {
|
|
2305
|
+
if (!nextGameTime) return;
|
|
2306
|
+
const timer = setInterval(() => {
|
|
2307
|
+
const now = (/* @__PURE__ */ new Date()).getTime();
|
|
2308
|
+
const distance = new Date(nextGameTime).getTime() - now;
|
|
2309
|
+
if (distance < 0) {
|
|
2310
|
+
clearInterval(timer);
|
|
2311
|
+
setTimeLeft("Started");
|
|
2312
|
+
return;
|
|
2313
|
+
}
|
|
2314
|
+
const days = Math.floor(distance / (1e3 * 60 * 60 * 24));
|
|
2315
|
+
const hours = Math.floor(distance % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60));
|
|
2316
|
+
const minutes = Math.floor(distance % (1e3 * 60 * 60) / (1e3 * 60));
|
|
2317
|
+
const seconds = Math.floor(distance % (1e3 * 60) / 1e3);
|
|
2318
|
+
let timeString = "";
|
|
2319
|
+
if (days > 0) timeString += `${days}d `;
|
|
2320
|
+
if (hours > 0 || days > 0) timeString += `${hours}h `;
|
|
2321
|
+
timeString += `${minutes}m ${seconds}s`;
|
|
2322
|
+
setTimeLeft(timeString);
|
|
2323
|
+
}, 1e3);
|
|
2324
|
+
return () => clearInterval(timer);
|
|
2325
|
+
}, [nextGameTime]);
|
|
2326
|
+
if (!nextGameTime) return null;
|
|
2327
|
+
return /* @__PURE__ */ jsxs(Typography, { variant: "body2", color: "primary", sx: { fontWeight: "bold" }, children: [
|
|
2328
|
+
"Next Game: ",
|
|
2329
|
+
timeLeft
|
|
2330
|
+
] });
|
|
2331
|
+
};
|
|
2332
|
+
function TablePageLayout(props) {
|
|
2333
|
+
var _a;
|
|
2334
|
+
const { allTags, dungeonMaster, onDeleteTable, onJoinWaitlist, onLeaveTable, onSaveDraft, players, table, tableStatus, waitlistPlayers } = props;
|
|
2335
|
+
const textAreaRef = useRef(null);
|
|
2336
|
+
const [isTableInEditMode, setIsTableInEditMode] = useState(false);
|
|
2337
|
+
const [currentDescription, setCurrentDescription] = useState(table.description);
|
|
2338
|
+
const [currentDungeonMaster, setCurrentDungeonMaster] = useState(dungeonMaster);
|
|
2339
|
+
const [currentPlayers, setCurrentPlayers] = useState(players);
|
|
2340
|
+
const [currentShortDescription, setCurrentShortDescription] = useState(table.shortDescription);
|
|
2341
|
+
const [currentTitle, setCurrentTitle] = useState(table.title);
|
|
2342
|
+
const [currentWaitlistPlayers, setCurrentWaitlistPlayers] = useState(waitlistPlayers);
|
|
2343
|
+
const [currentTagIds, setCurrentTagIds] = useState((_a = table.tags) != null ? _a : []);
|
|
2344
|
+
useEffect(() => {
|
|
2345
|
+
var _a2;
|
|
2346
|
+
setCurrentDescription(table.description);
|
|
2347
|
+
setCurrentDungeonMaster(dungeonMaster);
|
|
2348
|
+
setCurrentPlayers(players);
|
|
2349
|
+
setCurrentShortDescription(table.shortDescription);
|
|
2350
|
+
setCurrentTitle(table.title);
|
|
2351
|
+
setCurrentWaitlistPlayers(waitlistPlayers);
|
|
2352
|
+
setCurrentTagIds((_a2 = table.tags) != null ? _a2 : []);
|
|
2353
|
+
}, [dungeonMaster, players, table, waitlistPlayers]);
|
|
2354
|
+
const currentTags = useMemo(
|
|
2355
|
+
() => allTags.filter((tag) => currentTagIds.includes(tag.id)),
|
|
2356
|
+
[allTags, currentTagIds]
|
|
2357
|
+
);
|
|
2358
|
+
const handleAssignToDungeonMaster = (newDungeonMaster) => {
|
|
2359
|
+
setCurrentDungeonMaster(newDungeonMaster);
|
|
2360
|
+
};
|
|
2361
|
+
const handleRemovePlayerFromTable = (playerToRemove) => {
|
|
2362
|
+
setCurrentPlayers((prevState) => prevState.filter((player) => player.id !== playerToRemove.id));
|
|
2363
|
+
};
|
|
2364
|
+
const handlePromoteWaitlistPlayer = (playerIdToPromote) => {
|
|
2365
|
+
setCurrentWaitlistPlayers((prevWaitlist) => {
|
|
2366
|
+
const foundPlayer = prevWaitlist.find((player) => player.id === playerIdToPromote);
|
|
2367
|
+
if (!foundPlayer) {
|
|
2368
|
+
return prevWaitlist;
|
|
2369
|
+
}
|
|
2370
|
+
setCurrentPlayers((prevPlayers) => [...prevPlayers, foundPlayer]);
|
|
2371
|
+
return prevWaitlist.filter((player) => player.id !== playerIdToPromote);
|
|
2372
|
+
});
|
|
2373
|
+
};
|
|
2374
|
+
const handleToggleTag = (tagId) => {
|
|
2375
|
+
setCurrentTagIds(
|
|
2376
|
+
(prevState) => prevState.includes(tagId) ? prevState.filter((id) => id !== tagId) : [...prevState, tagId]
|
|
2377
|
+
);
|
|
2378
|
+
};
|
|
2379
|
+
const handleSaveTable = () => {
|
|
2380
|
+
const nextDraft = {
|
|
2381
|
+
...table,
|
|
2382
|
+
description: currentDescription,
|
|
2383
|
+
dungeonMaster: String(currentDungeonMaster.id),
|
|
2384
|
+
players: currentPlayers.map((player) => player.id),
|
|
2385
|
+
shortDescription: currentShortDescription,
|
|
2386
|
+
tags: currentTagIds,
|
|
2387
|
+
title: currentTitle,
|
|
2388
|
+
waitlist: currentWaitlistPlayers.map((player) => player.id)
|
|
2389
|
+
};
|
|
2390
|
+
void (onSaveDraft == null ? void 0 : onSaveDraft(nextDraft));
|
|
2391
|
+
setIsTableInEditMode(false);
|
|
2392
|
+
};
|
|
2393
|
+
return /* @__PURE__ */ jsx(
|
|
2394
|
+
Card,
|
|
2395
|
+
{
|
|
2396
|
+
sx: {
|
|
2397
|
+
backgroundColor: isTableInEditMode ? "lightsalmon" : "white",
|
|
2398
|
+
borderRadius: "5%",
|
|
2399
|
+
p: 2,
|
|
2400
|
+
boxShadow: "0px 8px 15px rgba(25, 118, 210, 0.3)"
|
|
2401
|
+
},
|
|
2402
|
+
children: /* @__PURE__ */ jsxs(Grid9, { container: true, direction: "column", children: [
|
|
2403
|
+
/* @__PURE__ */ jsxs(
|
|
2404
|
+
Grid9,
|
|
2405
|
+
{
|
|
2406
|
+
container: true,
|
|
2407
|
+
direction: "column",
|
|
2408
|
+
spacing: 1,
|
|
2409
|
+
sx: {
|
|
2410
|
+
px: 2,
|
|
2411
|
+
py: 1.5,
|
|
2412
|
+
borderRadius: 2,
|
|
2413
|
+
background: "linear-gradient(135deg, rgba(25,118,210,0.8), rgba(25,118,210,1))",
|
|
2414
|
+
textShadow: "4px 4px 6px rgba(0, 0, 0, 0.5)"
|
|
2415
|
+
},
|
|
2416
|
+
children: [
|
|
2417
|
+
/* @__PURE__ */ jsx(Box, { children: isTableInEditMode ? /* @__PURE__ */ jsx(
|
|
2418
|
+
"input",
|
|
2419
|
+
{
|
|
2420
|
+
onChange: (e) => setCurrentTitle(e.target.value),
|
|
2421
|
+
style: { backgroundColor: "#fffbea" },
|
|
2422
|
+
tabIndex: 0,
|
|
2423
|
+
type: "text",
|
|
2424
|
+
value: currentTitle
|
|
2425
|
+
}
|
|
2426
|
+
) : /* @__PURE__ */ jsx(
|
|
2427
|
+
CardHeader,
|
|
2428
|
+
{
|
|
2429
|
+
title: currentTitle,
|
|
2430
|
+
sx: {
|
|
2431
|
+
p: 0,
|
|
2432
|
+
"& .MuiCardHeader-title": {
|
|
2433
|
+
color: "white",
|
|
2434
|
+
fontWeight: 700
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
) }),
|
|
2439
|
+
isTableInEditMode ? /* @__PURE__ */ jsx(
|
|
2440
|
+
"input",
|
|
2441
|
+
{
|
|
2442
|
+
onChange: (e) => setCurrentShortDescription(e.target.value),
|
|
2443
|
+
style: { backgroundColor: "#fffbea" },
|
|
2444
|
+
tabIndex: 0,
|
|
2445
|
+
type: "text",
|
|
2446
|
+
value: currentShortDescription
|
|
2447
|
+
}
|
|
2448
|
+
) : /* @__PURE__ */ jsx(Typography, { sx: { color: "white", opacity: 0.95 }, children: currentShortDescription }),
|
|
2449
|
+
/* @__PURE__ */ jsx(Grid9, { container: true, children: isTableInEditMode ? renderEditableTags(currentTags, allTags, handleToggleTag) : renderTags(currentTagIds, allTags) }),
|
|
2450
|
+
/* @__PURE__ */ jsx(
|
|
2451
|
+
TableActionsBar,
|
|
2452
|
+
{
|
|
2453
|
+
isInEditMode: isTableInEditMode,
|
|
2454
|
+
numPlayers: currentPlayers.length,
|
|
2455
|
+
onDeleteTable,
|
|
2456
|
+
onEditModeChange: setIsTableInEditMode,
|
|
2457
|
+
onJoinWaitlist,
|
|
2458
|
+
onLeaveTable,
|
|
2459
|
+
onPromoteWaitlistPlayer: handlePromoteWaitlistPlayer,
|
|
2460
|
+
onSave: handleSaveTable,
|
|
2461
|
+
slots: table.capacity || 0,
|
|
2462
|
+
tableStatus,
|
|
2463
|
+
waitlistPlayers: currentWaitlistPlayers
|
|
2464
|
+
}
|
|
2465
|
+
)
|
|
2466
|
+
]
|
|
2467
|
+
}
|
|
2468
|
+
),
|
|
2469
|
+
/* @__PURE__ */ jsxs(Grid9, { container: true, spacing: 2, sx: { mt: 2 }, children: [
|
|
2470
|
+
/* @__PURE__ */ jsx(Grid9, { size: { xs: 12, md: 8 }, children: /* @__PURE__ */ jsx(Card, { sx: { height: "100%" }, children: /* @__PURE__ */ jsx(CardContent, { children: isTableInEditMode ? /* @__PURE__ */ jsx(
|
|
2471
|
+
AutoResizingTextarea_default,
|
|
2472
|
+
{
|
|
2473
|
+
isInEditMode: isTableInEditMode,
|
|
2474
|
+
onChange: setCurrentDescription,
|
|
2475
|
+
textareaRef: textAreaRef,
|
|
2476
|
+
value: currentDescription
|
|
2477
|
+
}
|
|
2478
|
+
) : /* @__PURE__ */ jsx(Typography, { sx: { whiteSpace: "pre-wrap" }, children: currentDescription }) }) }) }),
|
|
2479
|
+
/* @__PURE__ */ jsxs(Grid9, { size: { xs: 12, md: 4 }, children: [
|
|
2480
|
+
/* @__PURE__ */ jsx(DMHighlightsCard, { canEdit: isTableInEditMode, player: currentDungeonMaster, allTags }),
|
|
2481
|
+
/* @__PURE__ */ jsxs(Card, { sx: { height: "100%" }, children: [
|
|
2482
|
+
/* @__PURE__ */ jsx(CardHeader, { slotProps: { title: { variant: "h4" } }, title: "Players: " }),
|
|
2483
|
+
/* @__PURE__ */ jsx(CardContent, { children: currentPlayers.map((player) => /* @__PURE__ */ jsx(
|
|
2484
|
+
PlayerHighlightsCard,
|
|
2485
|
+
{
|
|
2486
|
+
allTags,
|
|
2487
|
+
canChangeDungeonMaster: tableStatus.isOwner || tableStatus.isDM,
|
|
2488
|
+
canEdit: isTableInEditMode,
|
|
2489
|
+
handleAssignToDungeonMaster,
|
|
2490
|
+
player,
|
|
2491
|
+
removeFromTable: handleRemovePlayerFromTable
|
|
2492
|
+
},
|
|
2493
|
+
player.id
|
|
2494
|
+
)) })
|
|
2495
|
+
] })
|
|
2496
|
+
] })
|
|
2497
|
+
] })
|
|
2498
|
+
] })
|
|
2499
|
+
}
|
|
2500
|
+
);
|
|
2501
|
+
}
|
|
2502
|
+
var renderTags = function(tags, allTags) {
|
|
2503
|
+
if (!tags || !allTags) {
|
|
2504
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
2505
|
+
}
|
|
2506
|
+
return /* @__PURE__ */ jsx(Grid9, { container: true, spacing: 1, sx: { pb: 1.5 }, children: tags.map((tagId) => {
|
|
2507
|
+
const tag = allTags.find((potentialTag) => tagId === potentialTag.id);
|
|
2508
|
+
return tag ? generateTagsDisplay(tag) : /* @__PURE__ */ jsx(Fragment, {});
|
|
2509
|
+
}) });
|
|
2510
|
+
};
|
|
2511
|
+
var renderEditableTags = function(selectedTags, allTags, onToggleTag) {
|
|
2512
|
+
return /* @__PURE__ */ jsx(Grid9, { size: { xs: 12 }, sx: { pb: 1.5 }, children: /* @__PURE__ */ jsx(
|
|
2513
|
+
TagEditor,
|
|
2514
|
+
{
|
|
2515
|
+
title: "Table Tags",
|
|
2516
|
+
possibleTags: allTags.filter((tag) => {
|
|
2517
|
+
var _a;
|
|
2518
|
+
return (_a = tag.appliesTo) == null ? void 0 : _a.tables;
|
|
2519
|
+
}),
|
|
2520
|
+
selectedTags,
|
|
2521
|
+
onToggleTag
|
|
2522
|
+
}
|
|
2523
|
+
) });
|
|
2524
|
+
};
|
|
2525
|
+
var TablePageLayout_default = TablePageLayout;
|
|
2526
|
+
|
|
2527
|
+
export { AutoResizingTextarea_default as AutoResizingTextarea, BaseSearchResultCard_default as BaseSearchResultCard, CANDIDATE_TIMEZONES, DMHighlightsCard, EventBanner, EventBannerEdit, EventBasicInfo, EventBasicInfoEdit, EventEditProvider, EventPageLayout, EventResultCard_default as EventResultCard, EventTablesCard_default as EventTablesCard, FiltersContainer_default as FiltersContainer, GameTableProvider, ModalContext, ModalProvider_default as ModalProvider, NextGameCountdown, PlayerDetailsCard_default as PlayerDetailsCard, PlayerDisplayCard_default as PlayerDisplayCard, PlayerHighlightsCard, PlayerPromptCard_default as PlayerPromptCard, PlayerResultCard_default as PlayerResultCard, PlayerTagsCard, PlayerTagsEdit, PlayersScrollableList_default as PlayersScrollableList, ResultsContainer_default as ResultsContainer, ScrollableResultsList_default as ScrollableResultsList, SearchPageLayout, SearchResultCard_default as SearchResultCard, SortOptions_default as SortOptions, TableActionsBar, TablePageLayout_default as TablePageLayout, TableResultCard_default as TableResultCard, TablesScrollableList_default as TablesScrollableList, TagEditor, TagsFilter_default as TagsFilter, TypeFilter_default as TypeFilter, generateTagsDisplay, renderTagsFromIds, useEventEdit, useGameTableContext, useModal };
|
|
2528
|
+
//# sourceMappingURL=index.mjs.map
|
|
2529
|
+
//# sourceMappingURL=index.mjs.map
|