@mbpockets/shared-ui 0.1.21 → 0.2.5

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.
Files changed (205) hide show
  1. package/dist/EventPage/editMode/index.cjs.map +1 -1
  2. package/dist/EventPage/editMode/index.d.cts +1 -1
  3. package/dist/EventPage/editMode/index.d.ts +1 -1
  4. package/dist/EventPage/editMode/index.mjs.map +1 -1
  5. package/dist/EventPage/editMode.cjs.map +1 -1
  6. package/dist/EventPage/editMode.d.cts +1 -1
  7. package/dist/EventPage/editMode.d.ts +1 -1
  8. package/dist/EventPage/editMode.mjs.map +1 -1
  9. package/dist/EventPage/index.cjs +122 -65
  10. package/dist/EventPage/index.cjs.map +1 -1
  11. package/dist/EventPage/index.d.cts +1 -1
  12. package/dist/EventPage/index.d.ts +1 -1
  13. package/dist/EventPage/index.mjs +122 -65
  14. package/dist/EventPage/index.mjs.map +1 -1
  15. package/dist/EventPage.cjs +122 -65
  16. package/dist/EventPage.cjs.map +1 -1
  17. package/dist/EventPage.d.cts +4 -4
  18. package/dist/EventPage.d.ts +4 -4
  19. package/dist/EventPage.mjs +122 -65
  20. package/dist/EventPage.mjs.map +1 -1
  21. package/dist/PlayerPage/index.cjs +12 -8
  22. package/dist/PlayerPage/index.cjs.map +1 -1
  23. package/dist/PlayerPage/index.mjs +12 -8
  24. package/dist/PlayerPage/index.mjs.map +1 -1
  25. package/dist/PlayerPage.cjs +12 -8
  26. package/dist/PlayerPage.cjs.map +1 -1
  27. package/dist/PlayerPage.mjs +12 -8
  28. package/dist/PlayerPage.mjs.map +1 -1
  29. package/dist/ProfilePage/index.cjs +12 -8
  30. package/dist/ProfilePage/index.cjs.map +1 -1
  31. package/dist/ProfilePage/index.mjs +12 -8
  32. package/dist/ProfilePage/index.mjs.map +1 -1
  33. package/dist/ProfilePage.cjs +12 -8
  34. package/dist/ProfilePage.cjs.map +1 -1
  35. package/dist/ProfilePage.mjs +12 -8
  36. package/dist/ProfilePage.mjs.map +1 -1
  37. package/dist/SearchPage/Filters/index.cjs +38 -18
  38. package/dist/SearchPage/Filters/index.cjs.map +1 -1
  39. package/dist/SearchPage/Filters/index.d.cts +2 -1
  40. package/dist/SearchPage/Filters/index.d.ts +2 -1
  41. package/dist/SearchPage/Filters/index.mjs +34 -17
  42. package/dist/SearchPage/Filters/index.mjs.map +1 -1
  43. package/dist/SearchPage/Filters.cjs +38 -18
  44. package/dist/SearchPage/Filters.cjs.map +1 -1
  45. package/dist/SearchPage/Filters.d.cts +13 -1
  46. package/dist/SearchPage/Filters.d.ts +13 -1
  47. package/dist/SearchPage/Filters.mjs +34 -17
  48. package/dist/SearchPage/Filters.mjs.map +1 -1
  49. package/dist/SearchPage/Results/index.cjs +87 -49
  50. package/dist/SearchPage/Results/index.cjs.map +1 -1
  51. package/dist/SearchPage/Results/index.mjs +87 -49
  52. package/dist/SearchPage/Results/index.mjs.map +1 -1
  53. package/dist/SearchPage/Results.cjs +87 -49
  54. package/dist/SearchPage/Results.cjs.map +1 -1
  55. package/dist/SearchPage/Results.d.cts +10 -3
  56. package/dist/SearchPage/Results.d.ts +10 -3
  57. package/dist/SearchPage/Results.mjs +87 -49
  58. package/dist/SearchPage/Results.mjs.map +1 -1
  59. package/dist/SearchPage/index.cjs +208 -101
  60. package/dist/SearchPage/index.cjs.map +1 -1
  61. package/dist/SearchPage/index.d.cts +2 -2
  62. package/dist/SearchPage/index.d.ts +2 -2
  63. package/dist/SearchPage/index.mjs +204 -100
  64. package/dist/SearchPage/index.mjs.map +1 -1
  65. package/dist/SearchPage.cjs +208 -101
  66. package/dist/SearchPage.cjs.map +1 -1
  67. package/dist/SearchPage.d.cts +25 -3
  68. package/dist/SearchPage.d.ts +25 -3
  69. package/dist/SearchPage.mjs +204 -100
  70. package/dist/SearchPage.mjs.map +1 -1
  71. package/dist/TablePage/EditComponents/index.cjs +296 -0
  72. package/dist/TablePage/EditComponents/index.cjs.map +1 -0
  73. package/dist/TablePage/EditComponents/index.d.cts +3 -0
  74. package/dist/TablePage/EditComponents/index.d.ts +3 -0
  75. package/dist/TablePage/EditComponents/index.mjs +286 -0
  76. package/dist/TablePage/EditComponents/index.mjs.map +1 -0
  77. package/dist/TablePage/EditComponents.cjs +296 -0
  78. package/dist/TablePage/EditComponents.cjs.map +1 -0
  79. package/dist/TablePage/EditComponents.d.cts +21 -0
  80. package/dist/TablePage/EditComponents.d.ts +21 -0
  81. package/dist/TablePage/EditComponents.mjs +286 -0
  82. package/dist/TablePage/EditComponents.mjs.map +1 -0
  83. package/dist/TablePage/ModalProvider/index.cjs +59 -58
  84. package/dist/TablePage/ModalProvider/index.cjs.map +1 -1
  85. package/dist/TablePage/ModalProvider/index.d.cts +1 -1
  86. package/dist/TablePage/ModalProvider/index.d.ts +1 -1
  87. package/dist/TablePage/ModalProvider/index.mjs +50 -59
  88. package/dist/TablePage/ModalProvider/index.mjs.map +1 -1
  89. package/dist/TablePage/ModalProvider.cjs +59 -58
  90. package/dist/TablePage/ModalProvider.cjs.map +1 -1
  91. package/dist/TablePage/ModalProvider.d.cts +7 -2
  92. package/dist/TablePage/ModalProvider.d.ts +7 -2
  93. package/dist/TablePage/ModalProvider.mjs +50 -59
  94. package/dist/TablePage/ModalProvider.mjs.map +1 -1
  95. package/dist/TablePage/index.cjs +555 -331
  96. package/dist/TablePage/index.cjs.map +1 -1
  97. package/dist/TablePage/index.d.cts +3 -2
  98. package/dist/TablePage/index.d.ts +3 -2
  99. package/dist/TablePage/index.mjs +539 -320
  100. package/dist/TablePage/index.mjs.map +1 -1
  101. package/dist/TablePage/players/index.cjs +24 -4
  102. package/dist/TablePage/players/index.cjs.map +1 -1
  103. package/dist/TablePage/players/index.mjs +24 -4
  104. package/dist/TablePage/players/index.mjs.map +1 -1
  105. package/dist/TablePage/players.cjs +24 -4
  106. package/dist/TablePage/players.cjs.map +1 -1
  107. package/dist/TablePage/players.mjs +24 -4
  108. package/dist/TablePage/players.mjs.map +1 -1
  109. package/dist/TablePage.cjs +555 -331
  110. package/dist/TablePage.cjs.map +1 -1
  111. package/dist/TablePage.d.cts +4 -1
  112. package/dist/TablePage.d.ts +4 -1
  113. package/dist/TablePage.mjs +539 -320
  114. package/dist/TablePage.mjs.map +1 -1
  115. package/dist/{index-D7WHhl3Q.d.ts → index-B23RQop0.d.ts} +12 -12
  116. package/dist/{index-DC0kK3aC.d.cts → index-Csj8S4A4.d.cts} +12 -12
  117. package/dist/index.cjs +890 -426
  118. package/dist/index.cjs.map +1 -1
  119. package/dist/index.d.cts +5 -4
  120. package/dist/index.d.ts +5 -4
  121. package/dist/index.mjs +871 -423
  122. package/dist/index.mjs.map +1 -1
  123. package/dist/mocks/{EventDB.cjs → EventDetails.cjs} +203 -3
  124. package/dist/mocks/EventDetails.cjs.map +1 -0
  125. package/dist/mocks/EventDetails.d.cts +6 -0
  126. package/dist/mocks/EventDetails.d.ts +6 -0
  127. package/dist/mocks/{EventDB.mjs → EventDetails.mjs} +203 -3
  128. package/dist/mocks/EventDetails.mjs.map +1 -0
  129. package/dist/mocks/Tables.cjs +1 -1
  130. package/dist/mocks/Tables.cjs.map +1 -1
  131. package/dist/mocks/Tables.mjs +1 -1
  132. package/dist/mocks/Tables.mjs.map +1 -1
  133. package/dist/mocks/Tags.cjs +200 -0
  134. package/dist/mocks/Tags.cjs.map +1 -1
  135. package/dist/mocks/Tags.mjs +200 -0
  136. package/dist/mocks/Tags.mjs.map +1 -1
  137. package/dist/mocks/index.cjs +202 -2
  138. package/dist/mocks/index.cjs.map +1 -1
  139. package/dist/mocks/index.d.cts +1 -1
  140. package/dist/mocks/index.d.ts +1 -1
  141. package/dist/mocks/index.mjs +202 -2
  142. package/dist/mocks/index.mjs.map +1 -1
  143. package/dist/mocks.cjs +202 -2
  144. package/dist/mocks.cjs.map +1 -1
  145. package/dist/mocks.d.cts +1 -1
  146. package/dist/mocks.d.ts +1 -1
  147. package/dist/mocks.mjs +202 -2
  148. package/dist/mocks.mjs.map +1 -1
  149. package/dist/shared/index.cjs +327 -64
  150. package/dist/shared/index.cjs.map +1 -1
  151. package/dist/shared/index.d.cts +1 -1
  152. package/dist/shared/index.d.ts +1 -1
  153. package/dist/shared/index.mjs +324 -64
  154. package/dist/shared/index.mjs.map +1 -1
  155. package/dist/shared.cjs +327 -64
  156. package/dist/shared.cjs.map +1 -1
  157. package/dist/shared.d.cts +25 -2
  158. package/dist/shared.d.ts +25 -2
  159. package/dist/shared.mjs +324 -64
  160. package/dist/shared.mjs.map +1 -1
  161. package/dist/types/event.d.cts +2 -3
  162. package/dist/types/event.d.ts +2 -3
  163. package/dist/types/index.d.cts +2 -2
  164. package/dist/types/index.d.ts +2 -2
  165. package/dist/types/search.d.cts +7 -1
  166. package/dist/types/search.d.ts +7 -1
  167. package/dist/types/tables.d.cts +1 -0
  168. package/dist/types/tables.d.ts +1 -0
  169. package/dist/types.d.cts +2 -2
  170. package/dist/types.d.ts +2 -2
  171. package/package.json +9 -2
  172. package/dist/TablePage/ModalProvider/index.css +0 -49
  173. package/dist/TablePage/ModalProvider/index.css.map +0 -1
  174. package/dist/TablePage/ModalProvider.css +0 -49
  175. package/dist/TablePage/ModalProvider.css.map +0 -1
  176. package/dist/TablePage/index.css +0 -49
  177. package/dist/TablePage/index.css.map +0 -1
  178. package/dist/TablePage.css +0 -49
  179. package/dist/TablePage.css.map +0 -1
  180. package/dist/index.css +0 -49
  181. package/dist/index.css.map +0 -1
  182. package/dist/mocks/EventDB.cjs.map +0 -1
  183. package/dist/mocks/EventDB.d.cts +0 -6
  184. package/dist/mocks/EventDB.d.ts +0 -6
  185. package/dist/mocks/EventDB.mjs.map +0 -1
  186. package/dist/shared/Modal/index.cjs +0 -64
  187. package/dist/shared/Modal/index.cjs.map +0 -1
  188. package/dist/shared/Modal/index.css +0 -49
  189. package/dist/shared/Modal/index.css.map +0 -1
  190. package/dist/shared/Modal/index.d.cts +0 -2
  191. package/dist/shared/Modal/index.d.ts +0 -2
  192. package/dist/shared/Modal/index.mjs +0 -62
  193. package/dist/shared/Modal/index.mjs.map +0 -1
  194. package/dist/shared/Modal.cjs +0 -64
  195. package/dist/shared/Modal.cjs.map +0 -1
  196. package/dist/shared/Modal.css +0 -49
  197. package/dist/shared/Modal.css.map +0 -1
  198. package/dist/shared/Modal.d.cts +0 -9
  199. package/dist/shared/Modal.d.ts +0 -9
  200. package/dist/shared/Modal.mjs +0 -62
  201. package/dist/shared/Modal.mjs.map +0 -1
  202. package/dist/shared/index.css +0 -49
  203. package/dist/shared/index.css.map +0 -1
  204. package/dist/shared.css +0 -49
  205. package/dist/shared.css.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,15 +1,15 @@
1
1
  "use client";
2
2
  import React7, { createContext, useState, useEffect, useContext, useMemo, useRef } from 'react';
3
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, CardMedia, CardHeader, useTheme, useMediaQuery, NoSsr } from '@mui/material';
4
+ import { Box, Grid, TextField, Tooltip, IconButton, Button, CircularProgress, Dialog, DialogTitle, DialogContent, DialogActions, Card, CardContent, Typography, FormControl, InputLabel, Select, MenuItem, CardMedia, CardHeader, useTheme, useMediaQuery, NoSsr, Link, FormControlLabel as FormControlLabel$1, Checkbox as Checkbox$1 } from '@mui/material';
5
5
  import DeleteIcon from '@mui/icons-material/Delete';
6
- import EditIcon from '@mui/icons-material/Edit';
6
+ import EditIcon3 from '@mui/icons-material/Edit';
7
7
  import AddIcon from '@mui/icons-material/Add';
8
8
  import ColorizeIcon from '@mui/icons-material/Colorize';
9
9
  import CancelIcon from '@mui/icons-material/Cancel';
10
10
  import CheckCircleIcon from '@mui/icons-material/CheckCircle';
11
11
  import Box2 from '@mui/material/Box';
12
- import Grid8 from '@mui/material/Grid';
12
+ import Grid10 from '@mui/material/Grid';
13
13
  import Card10 from '@mui/material/Card';
14
14
  import CardContent10 from '@mui/material/CardContent';
15
15
  import CardHeader4 from '@mui/material/CardHeader';
@@ -17,6 +17,7 @@ import Divider3 from '@mui/material/Divider';
17
17
  import Typography4 from '@mui/material/Typography';
18
18
  import Pagination from '@mui/material/Pagination';
19
19
  import Avatar from '@mui/material/Avatar';
20
+ import { useRouter } from 'next/navigation';
20
21
  import Chip2 from '@mui/material/Chip';
21
22
  import LinearProgress from '@mui/material/LinearProgress';
22
23
  import PersonIcon from '@mui/icons-material/Person';
@@ -27,19 +28,29 @@ import LocationOnIcon from '@mui/icons-material/LocationOn';
27
28
  import EventIcon from '@mui/icons-material/Event';
28
29
  import Autocomplete from '@mui/material/Autocomplete';
29
30
  import Popper from '@mui/material/Popper';
31
+ import FormControl2 from '@mui/material/FormControl';
32
+ import Select2 from '@mui/material/Select';
33
+ import MenuItem2 from '@mui/material/MenuItem';
30
34
  import FormControlLabel from '@mui/material/FormControlLabel';
31
35
  import Checkbox from '@mui/material/Checkbox';
32
- import FormControl2 from '@mui/material/FormControl';
33
36
  import RadioGroup from '@mui/material/RadioGroup';
34
37
  import Radio from '@mui/material/Radio';
35
- import TextField4 from '@mui/material/TextField';
38
+ import TextField7 from '@mui/material/TextField';
36
39
  import FormGroup from '@mui/material/FormGroup';
37
- import Button7 from '@mui/material/Button';
40
+ import Button8 from '@mui/material/Button';
38
41
  import SearchIcon from '@mui/icons-material/Search';
39
42
  import CircularProgress3 from '@mui/material/CircularProgress';
43
+ import CasinoIcon from '@mui/icons-material/Casino';
44
+ import Dialog3 from '@mui/material/Dialog';
45
+ import DialogContent3 from '@mui/material/DialogContent';
46
+ import DialogActions3 from '@mui/material/DialogActions';
47
+ import IconButton3 from '@mui/material/IconButton';
48
+ import CloseIcon from '@mui/icons-material/Close';
49
+ import ReactMarkdown from 'react-markdown';
40
50
  import Image2 from 'next/image';
41
51
  import ListIcon from '@mui/icons-material/List';
42
52
  import SaveIcon from '@mui/icons-material/Save';
53
+ import DialogTitle3 from '@mui/material/DialogTitle';
43
54
 
44
55
  // src/components/EventPage/editMode/EventBannerEdit.tsx
45
56
  var defaultValue = {
@@ -128,12 +139,29 @@ function Chip({ tag, removeCallback }) {
128
139
  function generateTagsDisplay(tag) {
129
140
  return /* @__PURE__ */ jsx(Chip, { tag }, tag.id);
130
141
  }
131
- function renderTagsFromIds(ids, legalTags) {
142
+ function renderTagsFromIds(ids, legalTags, options = {}) {
132
143
  if (!ids || !legalTags || legalTags.length === 0) {
133
144
  return /* @__PURE__ */ jsx(Fragment, {});
134
145
  }
146
+ const { showEventTag = false, eventTagId } = options;
135
147
  const validTags = ids.map((id) => legalTags.find((tag) => tag.id === id)).filter((tag) => Boolean(tag));
136
- return validTags.map((tag) => generateTagsDisplay(tag));
148
+ const sortedTags = [...validTags].sort((a, b) => {
149
+ if (showEventTag && eventTagId !== void 0) {
150
+ if (a.id === eventTagId && b.id === eventTagId) return 0;
151
+ if (a.id === eventTagId) return -1;
152
+ if (b.id === eventTagId) return 1;
153
+ }
154
+ const priorityOrder = ["Organizer Run", "Display Only"];
155
+ const aIndex = priorityOrder.indexOf(a.label);
156
+ const bIndex = priorityOrder.indexOf(b.label);
157
+ if (aIndex !== -1 && bIndex !== -1) {
158
+ return aIndex - bIndex;
159
+ }
160
+ if (aIndex !== -1) return -1;
161
+ if (bIndex !== -1) return 1;
162
+ return 0;
163
+ });
164
+ return sortedTags.map((tag) => generateTagsDisplay(tag));
137
165
  }
138
166
  function EventBannerEdit({
139
167
  initialValue,
@@ -357,7 +385,7 @@ function EventBannerEdit({
357
385
  children: [
358
386
  link.text,
359
387
  /* @__PURE__ */ jsxs(Box, { sx: { ml: 1, display: "flex" }, children: [
360
- /* @__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" }) }) }),
388
+ /* @__PURE__ */ jsx(Tooltip, { title: "Edit Link", children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => openEditLink(index), sx: { color: "white", p: 0.2 }, children: /* @__PURE__ */ jsx(EditIcon3, { fontSize: "inherit" }) }) }),
361
389
  /* @__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" }) }) })
362
390
  ] })
363
391
  ]
@@ -484,7 +512,7 @@ function EventBasicInfo(props) {
484
512
  );
485
513
  }
486
514
  function EventBasicInfoView({ description, locationId, startingDate, endingDate, timeInfo, timezone, isOwner, onEdit }) {
487
- return /* @__PURE__ */ jsx(Grid8, { sx: { position: "relative" }, children: /* @__PURE__ */ jsx(Card, { style: {
515
+ return /* @__PURE__ */ jsx(Grid10, { sx: { position: "relative" }, children: /* @__PURE__ */ jsx(Card, { style: {
488
516
  boxShadow: "0px 4px 10px rgba(0, 0, 0, 0.1)",
489
517
  background: "linear-gradient(135deg, rgba(225, 225, 225, 1), rgba(250, 250, 250, 1))"
490
518
  }, children: /* @__PURE__ */ jsxs(CardContent, { children: [
@@ -768,7 +796,7 @@ function EventBannerView({
768
796
  }) {
769
797
  const backgroundColor = bannerColor || "linear-gradient(135deg, rgba(25,118,210,0.8), rgba(25,118,210,1))";
770
798
  return /* @__PURE__ */ jsxs(
771
- Grid8,
799
+ Grid10,
772
800
  {
773
801
  sx: {
774
802
  background: backgroundColor,
@@ -776,7 +804,7 @@ function EventBannerView({
776
804
  position: "relative"
777
805
  },
778
806
  children: [
779
- /* @__PURE__ */ jsxs(Grid8, { children: [
807
+ /* @__PURE__ */ jsxs(Grid10, { children: [
780
808
  /* @__PURE__ */ jsxs(
781
809
  Box,
782
810
  {
@@ -835,7 +863,7 @@ function EventBannerView({
835
863
  }
836
864
  ),
837
865
  /* @__PURE__ */ jsxs(
838
- Grid8,
866
+ Grid10,
839
867
  {
840
868
  display: "flex",
841
869
  justifyContent: "center",
@@ -943,6 +971,11 @@ var generateLink = function(link) {
943
971
  link.text
944
972
  );
945
973
  };
974
+
975
+ // src/data/values.tsx
976
+ var DEFAULT_PROFILE_PIC = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHdpZHRoPSIyNTYiIGhlaWdodD0iMjU2IiB2aWV3Qm94PSIwIDAgMjU2IDI1NiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnIHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMDsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiAxMDsgZmlsbDogbm9uZTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMS40MDY1OTM0MDY1OTM0MDE2IDEuNDA2NTkzNDA2NTkzNDAxNikgc2NhbGUoMi44MSAyLjgxKSI+Cgk8cGF0aCBkPSJNIDQ1IDg4IGMgLTExLjA0OSAwIC0yMS4xOCAtMi4wMDMgLTI5LjAyMSAtOC42MzQgQyA2LjIxMiA3MS4xMDUgMCA1OC43NjQgMCA0NSBDIDAgMjAuMTg3IDIwLjE4NyAwIDQ1IDAgYyAyNC44MTMgMCA0NSAyMC4xODcgNDUgNDUgYyAwIDEzLjc2NSAtNi4yMTIgMjYuMTA1IC0xNS45NzkgMzQuMzY2IEMgNjYuMTgxIDg1Ljk5OCA1Ni4wNDkgODggNDUgODggeiIgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWxpbmVqb2luOiBtaXRlcjsgc3Ryb2tlLW1pdGVybGltaXQ6IDEwOyBmaWxsOiByZ2IoMjE0LDIxNCwyMTQpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IiB0cmFuc2Zvcm09IiBtYXRyaXgoMSAwIDAgMSAwIDApICIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+Cgk8cGF0aCBkPSJNIDQ1IDYwLjcxIGMgLTExLjQ3OSAwIC0yMC44MTggLTkuMzM5IC0yMC44MTggLTIwLjgxNyBjIDAgLTExLjQ3OSA5LjMzOSAtMjAuODE4IDIwLjgxOCAtMjAuODE4IGMgMTEuNDc5IDAgMjAuODE3IDkuMzM5IDIwLjgxNyAyMC44MTggQyA2NS44MTcgNTEuMzcxIDU2LjQ3OSA2MC43MSA0NSA2MC43MSB6IiBzdHlsZT0ic3Ryb2tlOiBub25lOyBzdHJva2Utd2lkdGg6IDE7IHN0cm9rZS1kYXNoYXJyYXk6IG5vbmU7IHN0cm9rZS1saW5lY2FwOiBidXR0OyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogMTA7IGZpbGw6IHJnYigxNjUsMTY0LDE2NCk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHRyYW5zZm9ybT0iIG1hdHJpeCgxIDAgMCAxIDAgMCkgIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KCTxwYXRoIGQ9Ik0gNDUgOTAgYyAtMTAuNjEzIDAgLTIwLjkyMiAtMy43NzMgLTI5LjAyOCAtMTAuNjI1IGMgLTAuNjQ4IC0wLjU0OCAtMC44OCAtMS40NDQgLTAuNTc5IC0yLjIzNyBDIDIwLjAzNCA2NC45MTkgMzEuOTMzIDU2LjcxIDQ1IDU2LjcxIHMgMjQuOTY2IDguMjA5IDI5LjYwNyAyMC40MjggYyAwLjMwMSAwLjc5MyAwLjA2OSAxLjY4OSAtMC41NzkgMi4yMzcgQyA2NS45MjIgODYuMjI3IDU1LjYxMyA5MCA0NSA5MCB6IiBzdHlsZT0ic3Ryb2tlOiBub25lOyBzdHJva2Utd2lkdGg6IDE7IHN0cm9rZS1kYXNoYXJyYXk6IG5vbmU7IHN0cm9rZS1saW5lY2FwOiBidXR0OyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogMTA7IGZpbGw6IHJnYigxNjUsMTY0LDE2NCk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHRyYW5zZm9ybT0iIG1hdHJpeCgxIDAgMCAxIDAgMCkgIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KPC9nPgo8L3N2Zz4=";
977
+ var ProfilePictureSettings = {
978
+ aspectRatio: 4 / 5};
946
979
  var NextGameLabel = ({ nextGameTime }) => {
947
980
  const date = typeof nextGameTime === "string" ? new Date(nextGameTime) : nextGameTime;
948
981
  return /* @__PURE__ */ jsxs(Typography, { variant: "caption", sx: { display: "block", mb: 1, color: "primary.main", fontWeight: "bold" }, children: [
@@ -956,17 +989,22 @@ var BaseSearchResultCard = ({
956
989
  onClick,
957
990
  children,
958
991
  icon,
959
- tags
992
+ tags,
993
+ showEventTag,
994
+ eventTagId
960
995
  }) => {
996
+ const router = useRouter();
961
997
  const handleClick = (e) => {
998
+ const url = `/${result.type}/${result.id}`;
999
+ if (e.ctrlKey || e.metaKey || e.shiftKey) {
1000
+ e.stopPropagation();
1001
+ window.open(url, "_blank");
1002
+ return;
1003
+ }
962
1004
  if (onClick) {
963
- if (e.ctrlKey || e.metaKey || e.shiftKey) {
964
- e.stopPropagation();
965
- const url = `/${result.type}/${result.id}`;
966
- window.open(url, "_blank");
967
- } else {
968
- onClick(result.id);
969
- }
1005
+ onClick(result.id);
1006
+ } else {
1007
+ router.push(url);
970
1008
  }
971
1009
  };
972
1010
  return /* @__PURE__ */ jsx(
@@ -975,7 +1013,7 @@ var BaseSearchResultCard = ({
975
1013
  elevation: 6,
976
1014
  sx: {
977
1015
  width: "100%",
978
- cursor: onClick ? "pointer" : "default",
1016
+ cursor: "pointer",
979
1017
  boxShadow: "0px 8px 24px rgba(0, 0, 0, 0.15)",
980
1018
  transition: "box-shadow 0.3s ease-in-out",
981
1019
  "&:hover": {
@@ -994,11 +1032,10 @@ var BaseSearchResultCard = ({
994
1032
  result.type === "table" ? /* @__PURE__ */ jsx(Typography4, { variant: "body1", children: (() => {
995
1033
  var _a, _b;
996
1034
  const full = (_b = (_a = result.fullDescription) != null ? _a : result.description) != null ? _b : "";
997
- if (typeof full !== "string") return "";
998
1035
  const text = full || "";
999
1036
  return text.length > 200 ? `${text.slice(0, 200).trimEnd()}...` : text;
1000
1037
  })() }) : /* @__PURE__ */ jsx(Typography4, { variant: "body1", children: result.description }),
1001
- result.tags && result.tags.length > 0 && /* @__PURE__ */ jsx(Box2, { sx: { mt: 1, display: "flex", flexWrap: "wrap", gap: 1 }, children: renderTagsFromIds(result.tags, tags) })
1038
+ result.tags && result.tags.length > 0 && /* @__PURE__ */ jsx(Box2, { sx: { mt: 1, display: "flex", flexWrap: "wrap", gap: 1 }, children: renderTagsFromIds(result.tags, tags, { showEventTag, eventTagId }) })
1002
1039
  ] })
1003
1040
  ] })
1004
1041
  }
@@ -1040,7 +1077,7 @@ var PlayerResultCard = ({
1040
1077
  const playerIcon = /* @__PURE__ */ jsx(
1041
1078
  Avatar,
1042
1079
  {
1043
- src: result.imageUrl,
1080
+ src: result.imageUrl || DEFAULT_PROFILE_PIC,
1044
1081
  alt: result.title,
1045
1082
  sx: {
1046
1083
  width: 40,
@@ -1056,7 +1093,9 @@ var PlayerResultCard_default = PlayerResultCard;
1056
1093
  var TableResultCard = ({
1057
1094
  result,
1058
1095
  onClick,
1059
- tags
1096
+ tags,
1097
+ showEventTag,
1098
+ eventTagId
1060
1099
  }) => {
1061
1100
  const rawCapacity = result.capacity;
1062
1101
  const hasDefinedCapacity = typeof rawCapacity === "number" && Number.isFinite(rawCapacity) && rawCapacity > 0;
@@ -1074,40 +1113,51 @@ var TableResultCard = ({
1074
1113
  }
1075
1114
  }
1076
1115
  );
1077
- return /* @__PURE__ */ jsx(BaseSearchResultCard_default, { result, onClick, icon: tableIcon, tags, children: /* @__PURE__ */ jsxs(Box2, { sx: { mb: 2 }, children: [
1078
- /* @__PURE__ */ jsxs(Box2, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 1 }, children: [
1079
- /* @__PURE__ */ jsxs(Typography4, { variant: "body2", children: [
1080
- /* @__PURE__ */ jsx("strong", { children: "Players:" }),
1081
- " ",
1082
- hasDefinedCapacity ? `${activePlayers}/${capacity}` : activePlayers
1083
- ] }),
1084
- typeof hasDM === "boolean" && /* @__PURE__ */ jsx(
1085
- Chip2,
1086
- {
1087
- icon: hasDM ? /* @__PURE__ */ jsx(SupervisorAccountIcon, {}) : /* @__PURE__ */ jsx(PersonIcon, {}),
1088
- label: hasDM ? "DM Present" : "No DM",
1089
- color: hasDM ? "success" : "warning",
1090
- size: "small"
1091
- }
1092
- )
1093
- ] }),
1094
- /* @__PURE__ */ jsx(
1095
- LinearProgress,
1096
- {
1097
- variant: "determinate",
1098
- value: occupancyPercentage,
1099
- sx: {
1100
- height: 10,
1101
- borderRadius: 5,
1102
- backgroundColor: "#e0e0e0",
1103
- "& .MuiLinearProgress-bar": {
1104
- backgroundColor: hasDefinedCapacity ? availableSlots > 0 ? "#4caf50" : "#f44336" : "#2196f3"
1116
+ return /* @__PURE__ */ jsx(
1117
+ BaseSearchResultCard_default,
1118
+ {
1119
+ result,
1120
+ onClick,
1121
+ icon: tableIcon,
1122
+ tags,
1123
+ showEventTag,
1124
+ eventTagId,
1125
+ children: /* @__PURE__ */ jsxs(Box2, { sx: { mb: 2 }, children: [
1126
+ /* @__PURE__ */ jsxs(Box2, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 1 }, children: [
1127
+ /* @__PURE__ */ jsxs(Typography4, { variant: "body2", children: [
1128
+ /* @__PURE__ */ jsx("strong", { children: "Players:" }),
1129
+ " ",
1130
+ hasDefinedCapacity ? `${activePlayers}/${capacity}` : activePlayers
1131
+ ] }),
1132
+ typeof hasDM === "boolean" && /* @__PURE__ */ jsx(
1133
+ Chip2,
1134
+ {
1135
+ icon: hasDM ? /* @__PURE__ */ jsx(SupervisorAccountIcon, {}) : /* @__PURE__ */ jsx(PersonIcon, {}),
1136
+ label: hasDM ? "DM Present" : "No DM",
1137
+ color: hasDM ? "success" : "warning",
1138
+ size: "small"
1139
+ }
1140
+ )
1141
+ ] }),
1142
+ /* @__PURE__ */ jsx(
1143
+ LinearProgress,
1144
+ {
1145
+ variant: "determinate",
1146
+ value: occupancyPercentage,
1147
+ sx: {
1148
+ height: 10,
1149
+ borderRadius: 5,
1150
+ backgroundColor: "#e0e0e0",
1151
+ "& .MuiLinearProgress-bar": {
1152
+ backgroundColor: hasDefinedCapacity ? availableSlots > 0 ? "#4caf50" : "#f44336" : "#2196f3"
1153
+ }
1154
+ }
1105
1155
  }
1106
- }
1107
- }
1108
- ),
1109
- hasDefinedCapacity && /* @__PURE__ */ jsx(Typography4, { variant: "body2", sx: { mt: 0.5, textAlign: "right" }, children: availableSlots > 0 ? `${availableSlots} slot${availableSlots !== 1 ? "s" : ""} available` : "Table full" })
1110
- ] }) });
1156
+ ),
1157
+ hasDefinedCapacity && /* @__PURE__ */ jsx(Typography4, { variant: "body2", sx: { mt: 0.5, textAlign: "right" }, children: availableSlots > 0 ? `${availableSlots} slot${availableSlots !== 1 ? "s" : ""} available` : "Table full" })
1158
+ ] })
1159
+ }
1160
+ );
1111
1161
  };
1112
1162
  var TableResultCard_default = TableResultCard;
1113
1163
  var EventResultCard = ({
@@ -1125,7 +1175,7 @@ var EventResultCard = ({
1125
1175
  try {
1126
1176
  const date = new Date(dateString);
1127
1177
  return date.toLocaleDateString("en-US", options);
1128
- } catch (error) {
1178
+ } catch (__) {
1129
1179
  return dateString;
1130
1180
  }
1131
1181
  };
@@ -1170,20 +1220,22 @@ var ResultsContainer = ({
1170
1220
  onResultClick,
1171
1221
  tags,
1172
1222
  pagination,
1173
- onPacketChange
1223
+ onPacketChange,
1224
+ showEventTag,
1225
+ eventTagId
1174
1226
  }) => {
1175
1227
  if (!results || results.length === 0 || !results.map) {
1176
1228
  return /* @__PURE__ */ jsx(Box2, { sx: { textAlign: "center", py: 4 }, children: "No results found. Try adjusting your filters." });
1177
1229
  }
1178
- const onPlayerClick = (id) => {
1179
- onResultClick == null ? void 0 : onResultClick(id, "player");
1180
- };
1181
- const onTableClick = (id) => {
1182
- onResultClick == null ? void 0 : onResultClick(id, "table");
1183
- };
1184
- const onEventClick = (id) => {
1185
- onResultClick == null ? void 0 : onResultClick(id, "event");
1186
- };
1230
+ const onPlayerClick = onResultClick ? (id) => {
1231
+ onResultClick(id, "player");
1232
+ } : void 0;
1233
+ const onTableClick = onResultClick ? (id) => {
1234
+ onResultClick(id, "table");
1235
+ } : void 0;
1236
+ const onEventClick = onResultClick ? (id) => {
1237
+ onResultClick(id, "event");
1238
+ } : void 0;
1187
1239
  const handlePacketChange = (_event, packet) => {
1188
1240
  onPacketChange == null ? void 0 : onPacketChange(packet);
1189
1241
  };
@@ -1199,7 +1251,7 @@ var ResultsContainer = ({
1199
1251
  pagination.totalResults,
1200
1252
  " results"
1201
1253
  ] }) }),
1202
- results.map((result, index) => {
1254
+ results.map((result) => {
1203
1255
  switch (result.type) {
1204
1256
  case "player":
1205
1257
  return /* @__PURE__ */ jsx(
@@ -1217,7 +1269,9 @@ var ResultsContainer = ({
1217
1269
  {
1218
1270
  result,
1219
1271
  onClick: onTableClick,
1220
- tags
1272
+ tags,
1273
+ showEventTag,
1274
+ eventTagId
1221
1275
  },
1222
1276
  result.id
1223
1277
  );
@@ -1253,17 +1307,30 @@ var ScrollableResultsList = ({
1253
1307
  tags,
1254
1308
  maxHeight = 400,
1255
1309
  onResultClick,
1256
- emptyText
1310
+ emptyText,
1311
+ showEventTag,
1312
+ eventTagId
1257
1313
  }) => {
1258
1314
  const hasResults = Array.isArray(results) && results.length > 0;
1259
- 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." }) });
1315
+ return /* @__PURE__ */ jsx(Box2, { sx: { maxHeight, overflowY: "auto", pr: 1 }, children: hasResults ? /* @__PURE__ */ jsx(
1316
+ ResultsContainer_default,
1317
+ {
1318
+ results,
1319
+ onResultClick,
1320
+ tags,
1321
+ showEventTag,
1322
+ eventTagId
1323
+ }
1324
+ ) : /* @__PURE__ */ jsx(Box2, { sx: { textAlign: "center", py: 2 }, children: emptyText || "No results to display." }) });
1260
1325
  };
1261
1326
  var ScrollableResultsList_default = ScrollableResultsList;
1262
1327
  var TablesScrollableList = ({
1263
1328
  results,
1264
1329
  tags,
1265
1330
  maxHeight,
1266
- onResultClick
1331
+ onResultClick,
1332
+ showEventTag,
1333
+ eventTagId
1267
1334
  }) => {
1268
1335
  const tables = (results || []).filter((r) => (r == null ? void 0 : r.type) === "table");
1269
1336
  const handleClick = (id) => onResultClick == null ? void 0 : onResultClick(id);
@@ -1275,7 +1342,9 @@ var TablesScrollableList = ({
1275
1342
  maxHeight,
1276
1343
  onResultClick: (id, type) => {
1277
1344
  if (type === "table") handleClick(id);
1278
- }
1345
+ },
1346
+ showEventTag,
1347
+ eventTagId
1279
1348
  }
1280
1349
  );
1281
1350
  };
@@ -1303,24 +1372,24 @@ function EventPageLayout({
1303
1372
  tables,
1304
1373
  allTags
1305
1374
  }) {
1306
- return /* @__PURE__ */ jsx(Grid8, { container: true, flexDirection: "column", children: /* @__PURE__ */ jsxs(EventEditProvider, { initialEvent: mergedEvent, value: { isOwner, updateEvent, updateImages }, children: [
1307
- /* @__PURE__ */ jsx(Grid8, { children: /* @__PURE__ */ jsx(
1375
+ return /* @__PURE__ */ jsx(Grid10, { container: true, flexDirection: "column", children: /* @__PURE__ */ jsxs(EventEditProvider, { initialEvent: mergedEvent, value: { isOwner, updateEvent, updateImages }, children: [
1376
+ /* @__PURE__ */ jsx(Grid10, { children: /* @__PURE__ */ jsx(
1308
1377
  EventBanner,
1309
1378
  {
1310
1379
  attendees,
1311
1380
  numGames
1312
1381
  }
1313
1382
  ) }),
1314
- /* @__PURE__ */ jsxs(Grid8, { container: true, flexDirection: "row", spacing: 3, size: { xs: 12, md: 12 }, children: [
1315
- /* @__PURE__ */ jsx(Grid8, { size: { xs: 12, md: 4 }, spacing: 3, padding: 3, children: /* @__PURE__ */ jsx(
1383
+ /* @__PURE__ */ jsxs(Grid10, { container: true, flexDirection: "row", spacing: 3, size: { xs: 12, md: 12 }, children: [
1384
+ /* @__PURE__ */ jsx(Grid10, { size: { xs: 12, md: 4 }, spacing: 3, padding: 3, children: /* @__PURE__ */ jsx(
1316
1385
  EventBasicInfo,
1317
1386
  {
1318
1387
  locationId: mergedEvent.location || "0"
1319
1388
  }
1320
1389
  ) }),
1321
- /* @__PURE__ */ jsx(Grid8, { size: { xs: 12, md: 8 }, spacing: 3, padding: 3, children: /* @__PURE__ */ jsx(EventTablesCard_default, { tables, tags: allTags }) })
1390
+ /* @__PURE__ */ jsx(Grid10, { size: { xs: 12, md: 8 }, spacing: 3, padding: 3, children: /* @__PURE__ */ jsx(EventTablesCard_default, { tables, tags: allTags }) })
1322
1391
  ] }),
1323
- /* @__PURE__ */ jsx(Grid8, {})
1392
+ /* @__PURE__ */ jsx(Grid10, {})
1324
1393
  ] }) });
1325
1394
  }
1326
1395
  var PlayerDetailsCard = ({
@@ -1479,19 +1548,18 @@ var PlayerDetailsCard = ({
1479
1548
  );
1480
1549
  };
1481
1550
  var PlayerDetailsCard_default = PlayerDetailsCard;
1482
-
1483
- // src/data/values.tsx
1484
- var ProfilePictureSettings = {
1485
- aspectRatio: 4 / 5};
1486
- var PlayerDisplayCard = ({ profilePicture, username, bio, preferredPronouns }) => {
1487
- const defaultImg = "/man-walking-silhouette-clipart.jpg";
1488
- const [imageSrc, setImageSrc] = useState(defaultImg);
1489
- const { aspectRatio } = ProfilePictureSettings;
1551
+ var PlayerDisplayCard = ({
1552
+ profilePicture,
1553
+ username,
1554
+ bio,
1555
+ preferredPronouns
1556
+ }) => {
1557
+ const [imageSrc, setImageSrc] = useState(DEFAULT_PROFILE_PIC);
1490
1558
  useEffect(() => {
1491
1559
  async function validateImage() {
1492
- const newImage = profilePicture || defaultImg;
1560
+ const newImage = profilePicture || DEFAULT_PROFILE_PIC;
1493
1561
  if (!profilePicture) {
1494
- setImageSrc(defaultImg);
1562
+ setImageSrc(DEFAULT_PROFILE_PIC);
1495
1563
  return;
1496
1564
  }
1497
1565
  const img = new Image();
@@ -1500,7 +1568,7 @@ var PlayerDisplayCard = ({ profilePicture, username, bio, preferredPronouns }) =
1500
1568
  setImageSrc(newImage);
1501
1569
  };
1502
1570
  img.onerror = () => {
1503
- setImageSrc(defaultImg);
1571
+ setImageSrc(DEFAULT_PROFILE_PIC);
1504
1572
  };
1505
1573
  }
1506
1574
  validateImage();
@@ -1530,7 +1598,7 @@ var PlayerDisplayCard = ({ profilePicture, username, bio, preferredPronouns }) =
1530
1598
  image: imageSrc,
1531
1599
  alt: `${username}'s Profile Picture`,
1532
1600
  sx: {
1533
- aspectRatio,
1601
+ aspectRatio: ProfilePictureSettings.aspectRatio,
1534
1602
  height: "auto",
1535
1603
  // Updates to maintain aspect ratio and fill space nicely
1536
1604
  width: "100%",
@@ -1849,6 +1917,24 @@ function PlayerPageLayout({
1849
1917
  ] }) })
1850
1918
  ] }) }) });
1851
1919
  }
1920
+ var DistanceFilter = ({ distances, selectedDistance, onChange }) => {
1921
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1922
+ /* @__PURE__ */ jsx(Typography4, { variant: "h6", gutterBottom: true, children: "Distance" }),
1923
+ /* @__PURE__ */ jsx(FormControl2, { fullWidth: true, size: "small", children: /* @__PURE__ */ jsxs(
1924
+ Select2,
1925
+ {
1926
+ value: selectedDistance !== void 0 ? selectedDistance : "",
1927
+ onChange: (e) => onChange(Number(e.target.value)),
1928
+ displayEmpty: true,
1929
+ children: [
1930
+ /* @__PURE__ */ jsx(MenuItem2, { value: "", children: /* @__PURE__ */ jsx("em", { children: "Any Distance" }) }),
1931
+ distances.map((option) => /* @__PURE__ */ jsx(MenuItem2, { value: option.value, children: option.display }, option.value))
1932
+ ]
1933
+ }
1934
+ ) })
1935
+ ] });
1936
+ };
1937
+ var DistanceFilter_default = DistanceFilter;
1852
1938
  var ExpiredTablesFilter = ({
1853
1939
  includeExpiredTables,
1854
1940
  onChange
@@ -1917,13 +2003,13 @@ var TagsFilter = ({
1917
2003
  shouldHaveAtLeastOne: ""
1918
2004
  });
1919
2005
  const tagOptions = React7.useMemo(() => {
2006
+ var _a;
1920
2007
  console.log("available tags: " + JSON.stringify(Tags));
1921
2008
  console.log(!Tags);
1922
- if (!Tags || Tags.length === 0 || !Tags.map) return [];
1923
- return Tags.map((tag) => ({
2009
+ return (_a = Tags == null ? void 0 : Tags.map((tag) => ({
1924
2010
  value: tag.id,
1925
2011
  label: tag.label
1926
- }));
2012
+ }))) != null ? _a : [];
1927
2013
  }, [Tags]);
1928
2014
  const handleTagChange = (tagId, category) => {
1929
2015
  let newTags = [];
@@ -1951,8 +2037,7 @@ var TagsFilter = ({
1951
2037
  };
1952
2038
  const renderSelectedTags = (selectedTags, category) => {
1953
2039
  const tagValues = [];
1954
- if (!Tags || Tags.length === 0 || !Tags.map) return null;
1955
- Tags.forEach((tag) => {
2040
+ Tags == null ? void 0 : Tags.forEach((tag) => {
1956
2041
  if (selectedTags.includes(tag.id)) {
1957
2042
  tagValues.push(tag);
1958
2043
  }
@@ -2018,7 +2103,7 @@ var TagsFilter = ({
2018
2103
  });
2019
2104
  },
2020
2105
  slots: { popper: CustomPopper2 },
2021
- renderInput: (params) => /* @__PURE__ */ jsx(TextField4, { ...params, label: `Select ${label}` })
2106
+ renderInput: (params) => /* @__PURE__ */ jsx(TextField7, { ...params, label: `Select ${label}` })
2022
2107
  },
2023
2108
  `${category}-${selectedTags.join("-")}`
2024
2109
  )
@@ -2090,7 +2175,7 @@ var TextSearchCard = ({ onChange, selectedTypes, initialTextSearch }) => {
2090
2175
  /* @__PURE__ */ jsx(Typography4, { variant: "h6", gutterBottom: true, children: "Text Search" }),
2091
2176
  /* @__PURE__ */ jsxs(Box2, { sx: { mb: 2 }, children: [
2092
2177
  /* @__PURE__ */ jsx(
2093
- TextField4,
2178
+ TextField7,
2094
2179
  {
2095
2180
  fullWidth: true,
2096
2181
  label: "Search in title and description",
@@ -2139,9 +2224,7 @@ var TypeFilter = ({ types, initialSelectedTypes = [], onChange }) => {
2139
2224
  Checkbox,
2140
2225
  {
2141
2226
  checked: selectedTypes.includes(type.id),
2142
- onChange: () => handleTypeChange(type.id),
2143
- disabled: type.id === "event",
2144
- title: type.id === "event" ? "Coming soon! Currently only player and table search are supported." : ""
2227
+ onChange: () => handleTypeChange(type.id)
2145
2228
  }
2146
2229
  ),
2147
2230
  label: type.label
@@ -2156,10 +2239,13 @@ var FiltersContainer = ({
2156
2239
  initialSelectedTags,
2157
2240
  initialTextSearch,
2158
2241
  includeExpiredTables = false,
2242
+ distance,
2243
+ distances,
2159
2244
  onTypeChange,
2160
2245
  onTagChange,
2161
2246
  onTextSearchChange,
2162
2247
  onIncludeExpiredTablesChange,
2248
+ onDistanceChange,
2163
2249
  onSubmit,
2164
2250
  tags,
2165
2251
  searchTypes
@@ -2174,7 +2260,10 @@ var FiltersContainer = ({
2174
2260
  onTypeChange(types);
2175
2261
  }
2176
2262
  };
2177
- return /* @__PURE__ */ jsxs(Box2, { children: [
2263
+ return /* @__PURE__ */ jsxs(Box2, { component: "form", onSubmit: (e) => {
2264
+ e.preventDefault();
2265
+ if (onSubmit) onSubmit();
2266
+ }, children: [
2178
2267
  /* @__PURE__ */ jsx(
2179
2268
  TypeFilter_default,
2180
2269
  {
@@ -2184,6 +2273,16 @@ var FiltersContainer = ({
2184
2273
  }
2185
2274
  ),
2186
2275
  /* @__PURE__ */ jsx(Divider3, { sx: { my: 2 } }),
2276
+ /* @__PURE__ */ jsx(
2277
+ DistanceFilter_default,
2278
+ {
2279
+ distances,
2280
+ selectedDistance: distance,
2281
+ onChange: onDistanceChange || (() => {
2282
+ })
2283
+ }
2284
+ ),
2285
+ /* @__PURE__ */ jsx(Divider3, { sx: { my: 2 } }),
2187
2286
  /* @__PURE__ */ jsx(
2188
2287
  TextSearchCard_default,
2189
2288
  {
@@ -2214,13 +2313,13 @@ var FiltersContainer = ({
2214
2313
  /* @__PURE__ */ jsx(Divider3, { sx: { my: 2 } })
2215
2314
  ] }),
2216
2315
  /* @__PURE__ */ jsx(Box2, { sx: { display: "flex", justifyContent: "center", mt: 2 }, children: /* @__PURE__ */ jsx(
2217
- Button7,
2316
+ Button8,
2218
2317
  {
2318
+ type: "submit",
2219
2319
  variant: "contained",
2220
2320
  color: "primary",
2221
2321
  size: "large",
2222
2322
  startIcon: /* @__PURE__ */ jsx(SearchIcon, {}),
2223
- onClick: onSubmit,
2224
2323
  sx: {
2225
2324
  width: "100%",
2226
2325
  py: 1.5,
@@ -2280,11 +2379,13 @@ function SearchPageLayout({
2280
2379
  query: "",
2281
2380
  titleOnly: false
2282
2381
  },
2283
- includeExpiredTables: initialIncludeExpiredTables = false,
2382
+ initialDistance,
2383
+ distances,
2284
2384
  onTypeChange,
2285
2385
  onTagChange,
2286
2386
  onTextSearchChange,
2287
2387
  onIncludeExpiredTablesChange,
2388
+ onDistanceChange,
2288
2389
  onSubmit,
2289
2390
  onResultClick,
2290
2391
  onPacketChange,
@@ -2292,14 +2393,16 @@ function SearchPageLayout({
2292
2393
  validTags,
2293
2394
  allTags,
2294
2395
  searchTypes,
2295
- isLoading = false
2396
+ isLoading = false,
2397
+ eventTagId
2296
2398
  }) {
2297
2399
  const theme = useTheme();
2298
2400
  const isMobile = useMediaQuery(theme.breakpoints.down("md"));
2299
2401
  const [selectedTypes, setSelectedTypes] = useState(initialSelectedTypes);
2300
2402
  const [selectedTags, setSelectedTags] = useState(initialSelectedTags);
2301
2403
  const [textSearch, setTextSearch] = useState(initialTextSearch);
2302
- const [includeExpiredTables, setIncludeExpiredTables] = useState(initialIncludeExpiredTables);
2404
+ const [includeExpiredTables, setIncludeExpiredTables] = useState(false);
2405
+ const [distance, setDistance] = useState(initialDistance);
2303
2406
  useEffect(() => {
2304
2407
  setSelectedTypes(initialSelectedTypes);
2305
2408
  }, [initialSelectedTypes]);
@@ -2310,8 +2413,8 @@ function SearchPageLayout({
2310
2413
  setTextSearch(initialTextSearch);
2311
2414
  }, [initialTextSearch]);
2312
2415
  useEffect(() => {
2313
- setIncludeExpiredTables(initialIncludeExpiredTables);
2314
- }, [initialIncludeExpiredTables]);
2416
+ setDistance(initialDistance);
2417
+ }, [initialDistance]);
2315
2418
  const handleTypeChange = (types) => {
2316
2419
  setSelectedTypes(types);
2317
2420
  if (onTypeChange) onTypeChange(types);
@@ -2328,12 +2431,17 @@ function SearchPageLayout({
2328
2431
  setIncludeExpiredTables(include);
2329
2432
  if (onIncludeExpiredTablesChange) onIncludeExpiredTablesChange(include);
2330
2433
  };
2434
+ const handleDistanceChange = (dist) => {
2435
+ setDistance(dist);
2436
+ if (onDistanceChange) onDistanceChange(dist);
2437
+ };
2331
2438
  const handleSubmit = () => {
2332
2439
  const currentCriteria = {
2333
2440
  selectedTypes,
2334
2441
  selectedTags,
2335
2442
  textSearch,
2336
- includeExpiredTables
2443
+ includeExpiredTables,
2444
+ distance
2337
2445
  };
2338
2446
  if (onSubmit) {
2339
2447
  onSubmit(currentCriteria);
@@ -2352,8 +2460,8 @@ function SearchPageLayout({
2352
2460
  }
2353
2461
  }
2354
2462
  ) }),
2355
- /* @__PURE__ */ jsxs(Grid8, { container: true, spacing: 2, children: [
2356
- /* @__PURE__ */ jsx(Grid8, { size: { xs: 12, md: 3 }, children: /* @__PURE__ */ jsxs(Card10, { sx: { marginBottom: isMobile ? 2 : 0 }, children: [
2463
+ /* @__PURE__ */ jsxs(Grid10, { container: true, spacing: 2, children: [
2464
+ /* @__PURE__ */ jsx(Grid10, { size: { xs: 12, md: 3 }, children: /* @__PURE__ */ jsxs(Card10, { sx: { marginBottom: isMobile ? 2 : 0 }, children: [
2357
2465
  /* @__PURE__ */ jsx(
2358
2466
  CardHeader4,
2359
2467
  {
@@ -2373,17 +2481,20 @@ function SearchPageLayout({
2373
2481
  initialSelectedTags: selectedTags,
2374
2482
  initialTextSearch: textSearch,
2375
2483
  includeExpiredTables,
2484
+ distance,
2485
+ distances,
2376
2486
  onTypeChange: handleTypeChange,
2377
2487
  onTagChange: handleTagChange,
2378
2488
  onTextSearchChange: handleTextSearchChange,
2379
2489
  onIncludeExpiredTablesChange: handleIncludeExpiredTablesChange,
2490
+ onDistanceChange: handleDistanceChange,
2380
2491
  onSubmit: handleSubmit,
2381
2492
  tags: validTags,
2382
2493
  searchTypes
2383
2494
  }
2384
2495
  ) })
2385
2496
  ] }) }),
2386
- /* @__PURE__ */ jsx(Grid8, { size: { xs: 12, md: 9 }, children: /* @__PURE__ */ jsxs(Card10, { children: [
2497
+ /* @__PURE__ */ jsx(Grid10, { size: { xs: 12, md: 9 }, children: /* @__PURE__ */ jsxs(Card10, { children: [
2387
2498
  /* @__PURE__ */ jsx(
2388
2499
  CardHeader4,
2389
2500
  {
@@ -2403,13 +2514,255 @@ function SearchPageLayout({
2403
2514
  pagination,
2404
2515
  onPacketChange,
2405
2516
  onResultClick,
2406
- tags: allTags
2517
+ tags: allTags,
2518
+ showEventTag: true,
2519
+ eventTagId
2407
2520
  }
2408
2521
  ) })
2409
2522
  ] }) })
2410
2523
  ] })
2411
2524
  ] });
2412
2525
  }
2526
+
2527
+ // src/components/shared/NameGenerator.ts
2528
+ var getRandomTitle = () => {
2529
+ const randomPrefix = titlePrefixes[Math.random() * titlePrefixes.length | 0];
2530
+ const randomMiddle = tileMiddle[Math.random() * tileMiddle.length | 0];
2531
+ const randomSuffix = titleSuffixes[Math.random() * titleSuffixes.length | 0];
2532
+ return `${randomPrefix} ${randomMiddle} ${randomSuffix}`;
2533
+ };
2534
+ var getRandomTagline = () => taglines[Math.random() * taglines.length | 0];
2535
+ var titlePrefixes = [
2536
+ "The Knights of The",
2537
+ "The Fellowship of The",
2538
+ "The Order of The",
2539
+ "The Infamous",
2540
+ "The Legendary",
2541
+ "The Dubious",
2542
+ "The Sworn Guardians of The",
2543
+ "The Ancient Guild of The",
2544
+ "The Unstoppable",
2545
+ "The Misfit",
2546
+ "The Chaotic",
2547
+ "The Brave",
2548
+ "The Forgotten",
2549
+ "The Wandering",
2550
+ "The Noble Council of The",
2551
+ "The Dread Pirates of The",
2552
+ "The Honorable Society of The",
2553
+ "The Cursed",
2554
+ "The Unlikely Heroes of The",
2555
+ "The Elders of The",
2556
+ "The Seekers of The",
2557
+ "The Champions of The",
2558
+ "The Heralds of The",
2559
+ "The Disciples of The",
2560
+ "The Ragtag Band of The",
2561
+ "The Cult of The"
2562
+ ];
2563
+ var tileMiddle = [
2564
+ "Round",
2565
+ "Kitchen",
2566
+ "Deepest",
2567
+ "Sorcery",
2568
+ "Munchkin",
2569
+ "Shenanigan",
2570
+ "Secret",
2571
+ "Dungeon",
2572
+ "Fireside",
2573
+ "Tabletop",
2574
+ "Midnight",
2575
+ "Tavern",
2576
+ "Goblin",
2577
+ "Dragon",
2578
+ "Critical",
2579
+ "Natural Twenty",
2580
+ "Counterspell",
2581
+ "Nat One",
2582
+ "Cardboard",
2583
+ "Dice Tower",
2584
+ "Campaign",
2585
+ "Lore",
2586
+ "Awkward",
2587
+ "Unhinged",
2588
+ "Chaotic Neutral",
2589
+ "Homebrew",
2590
+ "Side Quest"
2591
+ ];
2592
+ var titleSuffixes = [
2593
+ "Table",
2594
+ "Dungeon",
2595
+ "Cave",
2596
+ "Crew",
2597
+ "Team",
2598
+ "League",
2599
+ "Horde",
2600
+ "Party",
2601
+ "Conclave",
2602
+ "Collective",
2603
+ "Alliance",
2604
+ "Syndicate",
2605
+ "Guild",
2606
+ "Cabal",
2607
+ "Council",
2608
+ "Expedition",
2609
+ "Enclave",
2610
+ "Consortium",
2611
+ "Troupe",
2612
+ "Vanguard",
2613
+ "Cohort",
2614
+ "Brotherhood",
2615
+ "Sisterhood",
2616
+ "Pantheon",
2617
+ "Assembly",
2618
+ "Coven"
2619
+ ];
2620
+ var taglines = [
2621
+ "Everyone is welcome!",
2622
+ "Looking for serious players.",
2623
+ "Get in nerds, we're gaming!",
2624
+ "If you aren't there, you're square.",
2625
+ "It will be legendary!",
2626
+ "Beginners welcome \u2014 we were all level 1 once.",
2627
+ "No experience necessary. Snacks encouraged.",
2628
+ "Roleplayers, board gamers, and chaos gremlins welcome.",
2629
+ "We don't metagame. Much.",
2630
+ "All alignments accepted. True Neutral gets the snacks.",
2631
+ "Where every session is a one-shot... until it isn't.",
2632
+ "Homebrew rules may apply.",
2633
+ "Warning: may contain excessive lore.",
2634
+ "Critical failures celebrated as much as critical hits.",
2635
+ "No powergamers. Okay, maybe one powergamer.",
2636
+ "We finish campaigns. (Eventually.)",
2637
+ "Veteran players seeking worthy companions.",
2638
+ "Casuals only \u2014 we're here for the vibes.",
2639
+ "Serious about fun, not about rules.",
2640
+ "Min-maxers need not apply.",
2641
+ "For those who read the rulebook... and those who definitely didn't.",
2642
+ "Roll for initiative. Arrive on time.",
2643
+ "Side quests are the main quest here.",
2644
+ "Chaotic good energy required.",
2645
+ "If you bring snacks, you can name the first NPC.",
2646
+ "We read the rulebook so you don't have to.",
2647
+ "Wargamers only \u2014 no take-backs, no mercy.",
2648
+ "Everyone welcome. Meeple provided.",
2649
+ "We always play the longest game on the shelf.",
2650
+ "Worker placement. Resource management. Existential dread.",
2651
+ "No phones at the table! We're here for the game.",
2652
+ "Someone always flips the table. Metaphorically. Usually.",
2653
+ "We have a designated rules lawyer. It's fine.",
2654
+ "Cooperative games only \u2014 we can't handle another Monopoly incident.",
2655
+ "Teaching time is half the fun!"
2656
+ ];
2657
+ function TagSelector({ initialTagIDs, allTags, onTagChange }) {
2658
+ const [tagList, updateTagList] = useState(initialTagIDs);
2659
+ const [inputValue, setInputValue] = useState("");
2660
+ const toggleTag = (id) => tagList.find((t) => t === id) ? removeTag(id) : addTag(id);
2661
+ const addTag = (id) => {
2662
+ const newList = [...tagList, id];
2663
+ updateTagList(newList);
2664
+ onTagChange(newList);
2665
+ };
2666
+ const removeTag = (id) => {
2667
+ const newList = tagList.filter((t) => t !== id);
2668
+ updateTagList(newList);
2669
+ onTagChange(newList);
2670
+ };
2671
+ const selectedTags = useMemo(() => allTags.filter((tag) => tagList.includes(tag.id)), [allTags, tagList]);
2672
+ const options = useMemo(
2673
+ () => allTags.map((tag) => ({ value: tag.id, label: tag.label })),
2674
+ [allTags]
2675
+ );
2676
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2677
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: selectedTags.map((tag) => /* @__PURE__ */ jsx(
2678
+ Chip,
2679
+ {
2680
+ tag,
2681
+ removeCallback: () => toggleTag(tag.id)
2682
+ },
2683
+ tag.id
2684
+ )) }),
2685
+ /* @__PURE__ */ jsx(Grid10, { container: true, spacing: 3, children: /* @__PURE__ */ jsx(Grid10, { sx: { marginTop: 3, width: "100%", minWidth: "550px" }, children: /* @__PURE__ */ jsx(
2686
+ Autocomplete,
2687
+ {
2688
+ options,
2689
+ filterOptions: (availableOptions, state) => availableOptions.filter(
2690
+ (option) => !tagList.includes(option.value) && option.label.toLowerCase().includes(state.inputValue.toLowerCase())
2691
+ ),
2692
+ value: null,
2693
+ inputValue,
2694
+ onInputChange: (event, newInputValue) => {
2695
+ if (event && event.type === "change") {
2696
+ setInputValue(newInputValue);
2697
+ }
2698
+ },
2699
+ onChange: (event, newValue) => {
2700
+ if (newValue) {
2701
+ toggleTag(newValue.value);
2702
+ }
2703
+ setInputValue("");
2704
+ },
2705
+ renderInput: (params) => /* @__PURE__ */ jsx(TextField7, { ...params, label: "Select Tags" })
2706
+ },
2707
+ tagList.join("-")
2708
+ ) }) })
2709
+ ] });
2710
+ }
2711
+ function EditTableDetailsForm({ initialTitle, initialSubtitle, onTitleChange, onSubtitleChange, allowEditingTitles, initialTagIDs, allTags, onTagChange }) {
2712
+ const [title, setTitle] = useState(initialTitle);
2713
+ const [subtitle, setSubtitle] = useState(initialSubtitle);
2714
+ const handleTitleChange = (newTitle) => {
2715
+ setTitle(newTitle);
2716
+ onTitleChange(newTitle);
2717
+ };
2718
+ const handleSubtitleChange = (newSubtitle) => {
2719
+ setSubtitle(newSubtitle);
2720
+ onSubtitleChange(newSubtitle);
2721
+ };
2722
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2723
+ allowEditingTitles && /* @__PURE__ */ jsxs(Box, { className: "flex flex-col gap-4 mb-8", children: [
2724
+ /* @__PURE__ */ jsxs(Box, { className: "inline-flex", children: [
2725
+ /* @__PURE__ */ jsx(
2726
+ TextField7,
2727
+ {
2728
+ sx: { minWidth: "400px" },
2729
+ label: "Title",
2730
+ onChange: (e) => handleTitleChange(e.target.value),
2731
+ variant: "filled",
2732
+ value: title
2733
+ }
2734
+ ),
2735
+ /* @__PURE__ */ jsx(Tooltip, { title: "Randomize", children: /* @__PURE__ */ jsx(
2736
+ CasinoIcon,
2737
+ {
2738
+ sx: { cursor: "pointer", alignSelf: "center", ml: 1 },
2739
+ onClick: () => handleTitleChange(getRandomTitle())
2740
+ }
2741
+ ) })
2742
+ ] }),
2743
+ /* @__PURE__ */ jsxs(Box, { className: "inline-flex min-w-96", children: [
2744
+ /* @__PURE__ */ jsx(
2745
+ TextField7,
2746
+ {
2747
+ sx: { minWidth: "400px" },
2748
+ label: "Short Description or Tagline",
2749
+ onChange: (e) => handleSubtitleChange(e.target.value),
2750
+ variant: "filled",
2751
+ value: subtitle
2752
+ }
2753
+ ),
2754
+ /* @__PURE__ */ jsx(Tooltip, { title: "Randomize", children: /* @__PURE__ */ jsx(
2755
+ CasinoIcon,
2756
+ {
2757
+ sx: { cursor: "pointer", alignSelf: "center", ml: 1 },
2758
+ onClick: () => handleSubtitleChange(getRandomTagline())
2759
+ }
2760
+ ) })
2761
+ ] })
2762
+ ] }),
2763
+ /* @__PURE__ */ jsx(TagSelector, { initialTagIDs, allTags, onTagChange })
2764
+ ] });
2765
+ }
2413
2766
  var GameTableContext = React7.createContext(void 0);
2414
2767
  function GameTableProvider(props) {
2415
2768
  return /* @__PURE__ */ jsx(Fragment, { children: props.children });
@@ -2422,76 +2775,206 @@ function useGameTableContext() {
2422
2775
  throw new Error("useGameTableContext is deprecated in the package build. Pass table data through props instead.");
2423
2776
  }
2424
2777
  var ModalContext = createContext({
2425
- showModal: (content) => {
2778
+ showModal: () => {
2426
2779
  },
2427
2780
  hideModal: () => {
2428
2781
  }
2429
2782
  });
2430
2783
  var useModal = () => useContext(ModalContext);
2431
- var Modal = ({ onClose, children }) => {
2432
- const modalRef = useRef(null);
2433
- const previouslyFocusedElement = useRef(null);
2784
+ var AutoResizingTextarea = (props) => {
2785
+ const { isInEditMode, onChange, textareaRef, value } = props;
2434
2786
  useEffect(() => {
2435
- var _a;
2436
- if (children) {
2437
- previouslyFocusedElement.current = document.activeElement;
2438
- (_a = modalRef.current) == null ? void 0 : _a.focus();
2787
+ if (isInEditMode && textareaRef.current) {
2788
+ const textarea = textareaRef.current;
2789
+ textarea.style.height = "auto";
2790
+ textarea.style.height = `${textarea.scrollHeight}px`;
2439
2791
  }
2440
- return () => {
2441
- var _a2;
2442
- (_a2 = previouslyFocusedElement.current) == null ? void 0 : _a2.focus();
2443
- };
2444
- }, [children]);
2445
- const handleOnClose = () => {
2446
- onClose();
2447
- };
2448
- const handleKeyDown = (e) => {
2449
- var _a;
2450
- if (e.key !== "Tab") return;
2451
- const focusableElements = (_a = modalRef.current) == null ? void 0 : _a.querySelectorAll(
2452
- 'button, [tabindex]:not([tabindex="-1"])'
2453
- );
2454
- if (!focusableElements || focusableElements.length === 0) return;
2455
- const first = focusableElements[0];
2456
- const last = focusableElements[focusableElements.length - 1];
2457
- if (e.shiftKey) {
2458
- if (document.activeElement === first) {
2459
- e.preventDefault();
2460
- last.focus();
2792
+ }, [isInEditMode, textareaRef, value]);
2793
+ return /* @__PURE__ */ jsx(
2794
+ "textarea",
2795
+ {
2796
+ ref: textareaRef,
2797
+ value,
2798
+ onChange: (e) => onChange(e.target.value),
2799
+ style: {
2800
+ backgroundColor: "#fffbea",
2801
+ overflow: "hidden",
2802
+ resize: "none",
2803
+ width: "100%"
2461
2804
  }
2462
- } else {
2463
- if (document.activeElement === last) {
2464
- e.preventDefault();
2465
- first.focus();
2805
+ }
2806
+ );
2807
+ };
2808
+ var AutoResizingTextarea_default = AutoResizingTextarea;
2809
+ var NextGameCountdown = ({ nextGameTime }) => {
2810
+ const [timeLeft, setTimeLeft] = useState("");
2811
+ useEffect(() => {
2812
+ if (!nextGameTime) return;
2813
+ const timer = setInterval(() => {
2814
+ const now = (/* @__PURE__ */ new Date()).getTime();
2815
+ const distance = new Date(nextGameTime).getTime() - now;
2816
+ if (distance < 0) {
2817
+ clearInterval(timer);
2818
+ setTimeLeft("Started");
2819
+ return;
2466
2820
  }
2821
+ const days = Math.floor(distance / (1e3 * 60 * 60 * 24));
2822
+ const hours = Math.floor(distance % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60));
2823
+ const minutes = Math.floor(distance % (1e3 * 60 * 60) / (1e3 * 60));
2824
+ const seconds = Math.floor(distance % (1e3 * 60) / 1e3);
2825
+ let timeString = "";
2826
+ if (days > 0) timeString += `${days}d `;
2827
+ if (hours > 0 || days > 0) timeString += `${hours}h `;
2828
+ timeString += `${minutes}m ${seconds}s`;
2829
+ setTimeLeft(timeString);
2830
+ }, 1e3);
2831
+ return () => clearInterval(timer);
2832
+ }, [nextGameTime]);
2833
+ if (!nextGameTime) return null;
2834
+ return /* @__PURE__ */ jsxs(Typography, { variant: "body2", color: "primary", sx: { fontWeight: "bold" }, children: [
2835
+ "Next Game: ",
2836
+ timeLeft
2837
+ ] });
2838
+ };
2839
+ function TagEditor({
2840
+ title,
2841
+ selectedTags,
2842
+ possibleTags,
2843
+ onToggleTag
2844
+ }) {
2845
+ const selectedIds = useMemo(() => selectedTags.map((tag) => tag.id), [selectedTags]);
2846
+ const onTagChange = (newSelectedIds) => {
2847
+ const addedTags = newSelectedIds.filter((id) => !selectedIds.includes(id));
2848
+ const removedTags = selectedIds.filter((id) => !newSelectedIds.includes(id));
2849
+ addedTags.forEach((id) => onToggleTag(id));
2850
+ removedTags.forEach((id) => onToggleTag(id));
2851
+ };
2852
+ return /* @__PURE__ */ jsx(Grid10, { container: true, children: /* @__PURE__ */ jsx(Grid10, { size: { xs: 12 }, children: /* @__PURE__ */ jsxs(Card10, { children: [
2853
+ title ? /* @__PURE__ */ jsx(
2854
+ CardHeader4,
2855
+ {
2856
+ title,
2857
+ style: {
2858
+ background: "linear-gradient(135deg, rgba(25, 118, 210, 0.8), rgba(25, 118, 210, 1))",
2859
+ color: "#FFFFFF",
2860
+ fontSize: "1.5rem",
2861
+ textShadow: "0px 3px 6px rgba(0, 0, 0, 0.5)"
2862
+ }
2863
+ }
2864
+ ) : "",
2865
+ /* @__PURE__ */ jsx(CardContent10, { children: /* @__PURE__ */ jsx(TagSelector, { initialTagIDs: selectedIds, allTags: possibleTags, onTagChange }) })
2866
+ ] }) }) });
2867
+ }
2868
+ var UserAgreementModal = ({
2869
+ open,
2870
+ onClose,
2871
+ markdownContent,
2872
+ requirements,
2873
+ onAccept,
2874
+ title = "User Agreement",
2875
+ forceAgreement = false
2876
+ }) => {
2877
+ const [checkedState, setCheckedState] = useState(
2878
+ new Array(requirements.length).fill(false)
2879
+ );
2880
+ const handleCheckboxChange = (index) => {
2881
+ const updatedCheckedState = checkedState.map(
2882
+ (item, i) => i === index ? !item : item
2883
+ );
2884
+ setCheckedState(updatedCheckedState);
2885
+ };
2886
+ const isAllRequiredChecked = requirements.every((req, index) => {
2887
+ if (req.required) {
2888
+ return checkedState[index];
2889
+ }
2890
+ return true;
2891
+ });
2892
+ const handleAccept = () => {
2893
+ if (isAllRequiredChecked) {
2894
+ onAccept();
2467
2895
  }
2468
2896
  };
2469
- return /* @__PURE__ */ jsx(
2470
- "div",
2897
+ const handleClose = (event, reason) => {
2898
+ if (forceAgreement) return;
2899
+ if (onClose) onClose();
2900
+ };
2901
+ return /* @__PURE__ */ jsxs(
2902
+ Dialog,
2471
2903
  {
2472
- className: "modal-overlay",
2473
- onKeyDown: handleKeyDown,
2474
- ref: modalRef,
2475
- role: "dialog",
2476
- tabIndex: -1,
2477
- children: /* @__PURE__ */ jsxs("div", { className: "modal-container", children: [
2478
- /* @__PURE__ */ jsx("div", { className: "modal-control-strip", children: /* @__PURE__ */ jsx("button", { onClick: handleOnClose, children: "X" }) }),
2479
- /* @__PURE__ */ jsx("div", { className: "modal-content", children })
2480
- ] })
2904
+ open,
2905
+ onClose: handleClose,
2906
+ maxWidth: "md",
2907
+ fullWidth: true,
2908
+ disableEscapeKeyDown: forceAgreement,
2909
+ children: [
2910
+ /* @__PURE__ */ jsx(DialogTitle, { children: title }),
2911
+ /* @__PURE__ */ jsxs(DialogContent, { dividers: true, children: [
2912
+ /* @__PURE__ */ jsx(Box, { sx: { mb: 3 }, children: /* @__PURE__ */ jsx(
2913
+ ReactMarkdown,
2914
+ {
2915
+ components: {
2916
+ h1: ({ node, ...props }) => /* @__PURE__ */ jsx(Typography, { variant: "h4", gutterBottom: true, ...props }),
2917
+ h2: ({ node, ...props }) => /* @__PURE__ */ jsx(Typography, { variant: "h5", gutterBottom: true, ...props }),
2918
+ h3: ({ node, ...props }) => /* @__PURE__ */ jsx(Typography, { variant: "h6", gutterBottom: true, ...props }),
2919
+ h4: ({ node, ...props }) => /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", gutterBottom: true, ...props }),
2920
+ h5: ({ node, ...props }) => /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", gutterBottom: true, ...props }),
2921
+ h6: ({ node, ...props }) => /* @__PURE__ */ jsx(Typography, { variant: "caption", gutterBottom: true, ...props }),
2922
+ p: ({ node, ...props }) => /* @__PURE__ */ jsx(Typography, { variant: "body1", gutterBottom: true, ...props }),
2923
+ li: ({ node, ...props }) => /* @__PURE__ */ jsx(Box, { component: "li", sx: { mb: 1, ml: 2 }, ...props }),
2924
+ ul: ({ node, ...props }) => /* @__PURE__ */ jsx(Box, { component: "ul", sx: { mb: 2 }, ...props }),
2925
+ ol: ({ node, ...props }) => /* @__PURE__ */ jsx(Box, { component: "ol", sx: { mb: 2 }, ...props }),
2926
+ a: ({ node, ...props }) => /* @__PURE__ */ jsx(Link, { ...props, target: "_blank", rel: "noopener" })
2927
+ },
2928
+ children: markdownContent
2929
+ }
2930
+ ) }),
2931
+ /* @__PURE__ */ jsx(Box, { sx: { display: "flex", flexDirection: "column", gap: 1 }, children: requirements.map((req, index) => /* @__PURE__ */ jsx(Box, { sx: { display: "flex", alignItems: "flex-start" }, children: /* @__PURE__ */ jsx(
2932
+ FormControlLabel$1,
2933
+ {
2934
+ control: /* @__PURE__ */ jsx(
2935
+ Checkbox$1,
2936
+ {
2937
+ checked: checkedState[index],
2938
+ onChange: () => handleCheckboxChange(index)
2939
+ }
2940
+ ),
2941
+ label: /* @__PURE__ */ jsxs(Typography, { variant: "body2", children: [
2942
+ req.statement,
2943
+ req.link && req.linkText && /* @__PURE__ */ jsxs(Fragment, { children: [
2944
+ " ",
2945
+ /* @__PURE__ */ jsx(Link, { href: req.link, target: "_blank", rel: "noopener", children: req.linkText })
2946
+ ] }),
2947
+ req.required && /* @__PURE__ */ jsx(
2948
+ Typography,
2949
+ {
2950
+ component: "span",
2951
+ color: "error",
2952
+ sx: { ml: 0.5 },
2953
+ children: "*"
2954
+ }
2955
+ )
2956
+ ] })
2957
+ }
2958
+ ) }, index)) })
2959
+ ] }),
2960
+ /* @__PURE__ */ jsxs(DialogActions, { children: [
2961
+ !forceAgreement && /* @__PURE__ */ jsx(Button, { onClick: onClose, color: "inherit", children: "Cancel" }),
2962
+ /* @__PURE__ */ jsx(
2963
+ Button,
2964
+ {
2965
+ onClick: handleAccept,
2966
+ variant: "contained",
2967
+ disabled: !isAllRequiredChecked,
2968
+ fullWidth: forceAgreement,
2969
+ children: "Accept"
2970
+ }
2971
+ )
2972
+ ] })
2973
+ ]
2481
2974
  }
2482
2975
  );
2483
2976
  };
2484
- var Modal_default = Modal;
2485
- var ModalProvider = ({ children }) => {
2486
- const [modalContent, setModalContent] = useState(null);
2487
- const showModal = (content) => setModalContent(content);
2488
- const hideModal = () => setModalContent(null);
2489
- return /* @__PURE__ */ jsxs(ModalContext.Provider, { value: { showModal, hideModal }, children: [
2490
- children,
2491
- modalContent && /* @__PURE__ */ jsx(Modal_default, { onClose: hideModal, children: modalContent })
2492
- ] });
2493
- };
2494
- var ModalProvider_default = ModalProvider;
2977
+ var UserAgreementModal_default = UserAgreementModal;
2495
2978
  var PlayerHighlightsCard = function(props) {
2496
2979
  const {
2497
2980
  allTags,
@@ -2503,16 +2986,16 @@ var PlayerHighlightsCard = function(props) {
2503
2986
  removeFromTable
2504
2987
  } = props;
2505
2988
  return /* @__PURE__ */ jsx(Card, { elevation: 3, sx: { backgroundColor: canEdit ? "#fffbea" : "#f5f9fa", marginBottom: "6px" }, children: /* @__PURE__ */ jsxs(CardContent, { children: [
2506
- /* @__PURE__ */ jsxs(Grid8, { container: true, spacing: 2, direction: "column", children: [
2507
- /* @__PURE__ */ jsxs(Grid8, { container: true, direction: "row", children: [
2508
- /* @__PURE__ */ jsx(Grid8, { children: /* @__PURE__ */ jsx(Image2, { alt: player.username + "'s profile pic", height: 64, src: player.miniPic || "", width: 64 }) }),
2509
- /* @__PURE__ */ jsx(Grid8, { children: /* @__PURE__ */ jsx(Typography, { variant: "h5", children: player.username }) })
2989
+ /* @__PURE__ */ jsxs(Grid10, { container: true, spacing: 2, direction: "column", children: [
2990
+ /* @__PURE__ */ jsxs(Grid10, { container: true, direction: "row", children: [
2991
+ /* @__PURE__ */ jsx(Grid10, { children: /* @__PURE__ */ jsx(Image2, { alt: player.username + "'s profile pic", height: 64, src: player.miniPic || DEFAULT_PROFILE_PIC, width: 64 }) }),
2992
+ /* @__PURE__ */ jsx(Grid10, { children: /* @__PURE__ */ jsx(Typography, { variant: "h5", children: player.username }) })
2510
2993
  ] }),
2511
- /* @__PURE__ */ jsx(Grid8, { children: renderTagsFromIds(player.tags, allTags) })
2994
+ /* @__PURE__ */ jsx(Grid10, { children: renderTagsFromIds(player.tags, allTags) })
2512
2995
  ] }),
2513
- canEdit && /* @__PURE__ */ jsxs(Grid8, { children: [
2514
- /* @__PURE__ */ jsx(Button7, { onClick: () => removeFromTable(player), children: isWaitList ? /* @__PURE__ */ jsx("p", { children: "Deny Player" }) : /* @__PURE__ */ jsx("p", { children: "Remove Player" }) }),
2515
- canChangeDungeonMaster && /* @__PURE__ */ jsx(Button7, { onClick: () => {
2996
+ canEdit && /* @__PURE__ */ jsxs(Grid10, { children: [
2997
+ /* @__PURE__ */ jsx(Button8, { onClick: () => removeFromTable(player), children: isWaitList ? /* @__PURE__ */ jsx("p", { children: "Deny Player" }) : /* @__PURE__ */ jsx("p", { children: "Remove Player" }) }),
2998
+ canChangeDungeonMaster && /* @__PURE__ */ jsx(Button8, { onClick: () => {
2516
2999
  handleAssignToDungeonMaster(player);
2517
3000
  removeFromTable(player);
2518
3001
  }, children: /* @__PURE__ */ jsx("p", { children: "Assign to DungeonMaster" }) })
@@ -2522,11 +3005,11 @@ var PlayerHighlightsCard = function(props) {
2522
3005
  var DMHighlightsCard = function({ canEdit, player, allTags }) {
2523
3006
  return /* @__PURE__ */ jsxs(Card, { elevation: 3, sx: { backgroundColor: "#f5f9fa", marginBottom: "6px" }, children: [
2524
3007
  /* @__PURE__ */ jsx(CardHeader, { slotProps: { title: { variant: "h4" } }, title: "Game Master" }),
2525
- /* @__PURE__ */ jsx(CardContent, { sx: { backgroundColor: canEdit ? "#fffbea" : "inherit" }, children: /* @__PURE__ */ jsxs(Grid8, { container: true, spacing: 2, direction: "column", children: [
2526
- /* @__PURE__ */ jsx(Grid8, { children: /* @__PURE__ */ jsx(Typography, { variant: "h5", children: player.username }) }),
2527
- /* @__PURE__ */ jsxs(Grid8, { container: true, direction: "row", children: [
2528
- /* @__PURE__ */ jsx(Grid8, { children: /* @__PURE__ */ jsx(Image2, { alt: player.username + "'s profile pic", height: 120, src: player.imageUrl ? player.imageUrl : "", width: 256 }) }),
2529
- /* @__PURE__ */ jsx(Grid8, { children: renderTagsFromIds(player.tags, allTags) }),
3008
+ /* @__PURE__ */ jsx(CardContent, { sx: { backgroundColor: canEdit ? "#fffbea" : "inherit" }, children: /* @__PURE__ */ jsxs(Grid10, { container: true, spacing: 2, direction: "column", children: [
3009
+ /* @__PURE__ */ jsx(Grid10, { children: /* @__PURE__ */ jsx(Typography, { variant: "h5", children: player.username }) }),
3010
+ /* @__PURE__ */ jsxs(Grid10, { container: true, direction: "row", children: [
3011
+ /* @__PURE__ */ jsx(Grid10, { children: /* @__PURE__ */ jsx(Image2, { alt: player.username + "'s profile pic", height: 120, src: player.imageUrl || DEFAULT_PROFILE_PIC, width: 256 }) }),
3012
+ /* @__PURE__ */ jsx(Grid10, { children: renderTagsFromIds(player.tags, allTags) }),
2530
3013
  /* @__PURE__ */ jsx(Typography, { children: player.description })
2531
3014
  ] })
2532
3015
  ] }) })
@@ -2555,12 +3038,11 @@ function TableActionsBar(props) {
2555
3038
  if (waitlistPlayers.length === 0) {
2556
3039
  return /* @__PURE__ */ jsx("p", { children: "Waitlist is empty!" });
2557
3040
  }
2558
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
2559
- /* @__PURE__ */ jsx(CardHeader4, { slotProps: { title: { variant: "h4" } }, title: "Waitlist Players: " }),
2560
- /* @__PURE__ */ jsx("ul", { className: "gap-8", children: waitlistPlayers.map((player) => /* @__PURE__ */ jsxs(
3041
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
3042
+ /* @__PURE__ */ jsx("ul", { className: "gap-8 px-6", children: waitlistPlayers.map((player) => /* @__PURE__ */ jsxs(
2561
3043
  "li",
2562
3044
  {
2563
- 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`,
3045
+ className: `${canMovePlayersToTable ? "bg-amber-100 cursor-pointer" : "bg-gray-200"} mb-8 flex flex-row flex-start space-between items-center gap-3 p-2 rounded`,
2564
3046
  onClick: () => canMovePlayersToTable ? onPromoteWaitlistPlayer == null ? void 0 : onPromoteWaitlistPlayer(player.id) : void 0,
2565
3047
  tabIndex: 0,
2566
3048
  children: [
@@ -2569,7 +3051,7 @@ function TableActionsBar(props) {
2569
3051
  {
2570
3052
  alt: player.username + "'s profile pic",
2571
3053
  height: 64,
2572
- src: player.miniPic || "",
3054
+ src: player.miniPic || DEFAULT_PROFILE_PIC,
2573
3055
  width: 64
2574
3056
  }
2575
3057
  ),
@@ -2578,7 +3060,7 @@ function TableActionsBar(props) {
2578
3060
  },
2579
3061
  player.id
2580
3062
  )) }),
2581
- /* @__PURE__ */ jsx("button", { onClick: () => hideModal(), children: "close modal" })
3063
+ /* @__PURE__ */ jsx(DialogActions3, { children: /* @__PURE__ */ jsx(Button8, { onClick: () => hideModal(), children: "Close" }) })
2582
3064
  ] });
2583
3065
  };
2584
3066
  return /* @__PURE__ */ jsxs(Grid, { container: true, direction: "column", spacing: 1, children: [
@@ -2589,33 +3071,45 @@ function TableActionsBar(props) {
2589
3071
  slots
2590
3072
  ] }) }),
2591
3073
  /* @__PURE__ */ jsxs(Grid, { container: true, direction: "row", children: [
2592
- !isOwner && !isPlayer && !isDM && !onWaitlist && /* @__PURE__ */ jsx(Button7, { onClick: () => onJoinWaitlist == null ? void 0 : onJoinWaitlist(), sx: buttonStyle, children: "Join Waitlist" }),
2593
- !isOwner && (isPlayer || onWaitlist) && /* @__PURE__ */ jsx(Button7, { onClick: () => onLeaveTable == null ? void 0 : onLeaveTable(), sx: buttonStyle, children: onWaitlist ? "Leave Waitlist" : "Leave Table" }),
3074
+ !isOwner && !isPlayer && !isDM && !onWaitlist && /* @__PURE__ */ jsx(Button8, { onClick: () => onJoinWaitlist == null ? void 0 : onJoinWaitlist(), sx: buttonStyle, children: "Join Waitlist" }),
3075
+ !isOwner && (isPlayer || onWaitlist) && /* @__PURE__ */ jsx(Button8, { onClick: () => onLeaveTable == null ? void 0 : onLeaveTable(), sx: buttonStyle, children: onWaitlist ? "Leave Waitlist" : "Leave Table" }),
2594
3076
  canEditTable ? /* @__PURE__ */ jsxs(Fragment, { children: [
2595
- /* @__PURE__ */ jsx(Button7, { onClick: () => onEditModeChange(true), sx: buttonStyle, endIcon: /* @__PURE__ */ jsx(EditIcon, {}), children: "Edit" }),
3077
+ /* @__PURE__ */ jsx(Button8, { onClick: () => onEditModeChange(true), sx: buttonStyle, endIcon: /* @__PURE__ */ jsx(EditIcon3, {}), children: "Edit" }),
2596
3078
  canViewWaitlist ? /* @__PURE__ */ jsx(
2597
- Button7,
3079
+ Button8,
2598
3080
  {
2599
3081
  endIcon: /* @__PURE__ */ jsx(ListIcon, {}),
2600
- onClick: () => showModal(renderPlayerWaitlistModalContent(false)),
3082
+ onClick: () => showModal(renderPlayerWaitlistModalContent(false), "Waitlist Players:"),
2601
3083
  sx: buttonStyle,
2602
3084
  children: "View Waitlist"
2603
3085
  }
2604
3086
  ) : null
2605
3087
  ] }) : canSaveTable ? /* @__PURE__ */ jsxs(Fragment, { children: [
2606
- /* @__PURE__ */ jsx(Button7, { onClick: onSave, sx: buttonStyle, endIcon: /* @__PURE__ */ jsx(SaveIcon, {}), children: "Save" }),
2607
- /* @__PURE__ */ jsx(Button7, { onClick: () => onEditModeChange(false), sx: buttonStyle, children: "Cancel" }),
3088
+ /* @__PURE__ */ jsx(Button8, { onClick: onSave, sx: buttonStyle, endIcon: /* @__PURE__ */ jsx(SaveIcon, {}), children: "Save" }),
3089
+ /* @__PURE__ */ jsx(Button8, { onClick: () => onEditModeChange(false), sx: buttonStyle, children: "Cancel" }),
2608
3090
  /* @__PURE__ */ jsx(
2609
- Button7,
3091
+ Button8,
2610
3092
  {
2611
3093
  endIcon: /* @__PURE__ */ jsx(ListIcon, {}),
2612
- onClick: () => showModal(renderPlayerWaitlistModalContent(true)),
3094
+ onClick: () => showModal(renderPlayerWaitlistModalContent(true), "Waitlist Players:"),
2613
3095
  sx: buttonStyle,
2614
3096
  children: "Edit Waitlist"
2615
3097
  }
2616
3098
  )
2617
3099
  ] }) : null,
2618
- isOwner && /* @__PURE__ */ jsx(Button7, { onClick: () => onDeleteTable == null ? void 0 : onDeleteTable(), sx: buttonStyle, endIcon: /* @__PURE__ */ jsx(DeleteIcon, {}), children: "Delete Table" })
3100
+ isOwner && /* @__PURE__ */ jsx(
3101
+ Button8,
3102
+ {
3103
+ onClick: () => showModal(
3104
+ /* @__PURE__ */ jsx(Typography, { children: "Are you sure you want to delete this table? This action cannot be undone." }),
3105
+ "Delete Table",
3106
+ { acceptText: "Delete", onAccept: () => onDeleteTable == null ? void 0 : onDeleteTable() }
3107
+ ),
3108
+ sx: buttonStyle,
3109
+ endIcon: /* @__PURE__ */ jsx(DeleteIcon, {}),
3110
+ children: "Delete Table"
3111
+ }
3112
+ )
2619
3113
  ] })
2620
3114
  ] });
2621
3115
  }
@@ -2625,165 +3119,82 @@ var buttonStyle = {
2625
3119
  color: "white",
2626
3120
  borderRadius: "5px"
2627
3121
  };
2628
- var AutoResizingTextarea = (props) => {
2629
- const { isInEditMode, onChange, textareaRef, value } = props;
2630
- useEffect(() => {
2631
- if (isInEditMode && textareaRef.current) {
2632
- const textarea = textareaRef.current;
2633
- textarea.style.height = "auto";
2634
- textarea.style.height = `${textarea.scrollHeight}px`;
2635
- }
2636
- }, [isInEditMode, textareaRef, value]);
2637
- return /* @__PURE__ */ jsx(
2638
- "textarea",
2639
- {
2640
- ref: textareaRef,
2641
- value,
2642
- onChange: (e) => onChange(e.target.value),
2643
- style: {
2644
- backgroundColor: "#fffbea",
2645
- overflow: "hidden",
2646
- resize: "none",
2647
- width: "100%"
2648
- }
2649
- }
2650
- );
2651
- };
2652
- var AutoResizingTextarea_default = AutoResizingTextarea;
2653
- var NextGameCountdown = ({ nextGameTime }) => {
2654
- const [timeLeft, setTimeLeft] = useState("");
2655
- useEffect(() => {
2656
- if (!nextGameTime) return;
2657
- const timer = setInterval(() => {
2658
- const now = (/* @__PURE__ */ new Date()).getTime();
2659
- const distance = new Date(nextGameTime).getTime() - now;
2660
- if (distance < 0) {
2661
- clearInterval(timer);
2662
- setTimeLeft("Started");
2663
- return;
2664
- }
2665
- const days = Math.floor(distance / (1e3 * 60 * 60 * 24));
2666
- const hours = Math.floor(distance % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60));
2667
- const minutes = Math.floor(distance % (1e3 * 60 * 60) / (1e3 * 60));
2668
- const seconds = Math.floor(distance % (1e3 * 60) / 1e3);
2669
- let timeString = "";
2670
- if (days > 0) timeString += `${days}d `;
2671
- if (hours > 0 || days > 0) timeString += `${hours}h `;
2672
- timeString += `${minutes}m ${seconds}s`;
2673
- setTimeLeft(timeString);
2674
- }, 1e3);
2675
- return () => clearInterval(timer);
2676
- }, [nextGameTime]);
2677
- if (!nextGameTime) return null;
2678
- return /* @__PURE__ */ jsxs(Typography, { variant: "body2", color: "primary", sx: { fontWeight: "bold" }, children: [
2679
- "Next Game: ",
2680
- timeLeft
2681
- ] });
2682
- };
2683
- function TagEditor({
2684
- title = "Tags",
2685
- selectedTags,
2686
- possibleTags,
2687
- onToggleTag
2688
- }) {
2689
- const [inputValue, setInputValue] = useState("");
2690
- const selectedIds = useMemo(() => selectedTags.map((tag) => tag.id), [selectedTags]);
2691
- const options = useMemo(
2692
- () => possibleTags.map((tag) => ({ value: tag.id, label: tag.label })),
2693
- [possibleTags]
2694
- );
2695
- return /* @__PURE__ */ jsx(Grid8, { container: true, children: /* @__PURE__ */ jsx(Grid8, { size: { xs: 12 }, children: /* @__PURE__ */ jsxs(Card10, { children: [
2696
- /* @__PURE__ */ jsx(
2697
- CardHeader4,
2698
- {
2699
- title,
2700
- style: {
2701
- background: "linear-gradient(135deg, rgba(25, 118, 210, 0.8), rgba(25, 118, 210, 1))",
2702
- color: "#FFFFFF",
2703
- fontSize: "1.5rem",
2704
- textShadow: "0px 3px 6px rgba(0, 0, 0, 0.5)"
2705
- }
2706
- }
2707
- ),
2708
- /* @__PURE__ */ jsxs(CardContent10, { children: [
2709
- /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: selectedTags.map((tag) => /* @__PURE__ */ jsx(
2710
- Chip,
2711
- {
2712
- tag,
2713
- removeCallback: () => onToggleTag(tag.id)
2714
- },
2715
- tag.id
2716
- )) }),
2717
- /* @__PURE__ */ jsx(Grid8, { container: true, spacing: 3, children: /* @__PURE__ */ jsx(Grid8, { sx: { marginTop: 3, width: "100%" }, children: /* @__PURE__ */ jsx(
2718
- Autocomplete,
2719
- {
2720
- options,
2721
- filterOptions: (availableOptions, state) => availableOptions.filter(
2722
- (option) => !selectedIds.includes(option.value) && option.label.toLowerCase().includes(state.inputValue.toLowerCase())
2723
- ).slice(0, 3),
2724
- value: null,
2725
- inputValue,
2726
- onInputChange: (event, newInputValue) => {
2727
- if (event && event.type === "change") {
2728
- setInputValue(newInputValue);
2729
- }
2730
- },
2731
- onChange: (event, newValue) => {
2732
- if (newValue) {
2733
- onToggleTag(newValue.value);
2734
- }
2735
- setInputValue("");
2736
- },
2737
- slots: { popper: CustomPopper3 },
2738
- renderInput: (params) => /* @__PURE__ */ jsx(TextField4, { ...params, label: "Select Tags" })
2739
- },
2740
- selectedIds.join("-")
2741
- ) }) })
2742
- ] })
2743
- ] }) }) });
2744
- }
2745
- var CustomPopper3 = (props) => {
2746
- return /* @__PURE__ */ jsx(
2747
- Popper,
2748
- {
2749
- ...props,
2750
- modifiers: [
2751
- {
2752
- name: "preventOverflow",
2753
- options: { boundary: "viewport" }
2754
- },
2755
- {
2756
- name: "offset",
2757
- options: { offset: [0, -10] }
2758
- }
2759
- ],
2760
- placement: "top-start"
2761
- }
2762
- );
2763
- };
2764
3122
  function TablePageLayout(props) {
2765
3123
  var _a;
2766
- const { allTags, dungeonMaster, onDeleteTable, onJoinWaitlist, onLeaveTable, onSaveDraft, players, table, tableStatus, waitlistPlayers } = props;
3124
+ const { hideModal, showModal } = useModal();
3125
+ const { allTags, dungeonMaster, onDeleteTable, onJoinWaitlist, onLeaveTable, onSaveDraft, players, table, tableStatus, waitlistPlayers, startWithEditTitle, eventTagId } = props;
3126
+ const canEdit = tableStatus.isOwner;
2767
3127
  const textAreaRef = useRef(null);
2768
3128
  const [isTableInEditMode, setIsTableInEditMode] = useState(false);
3129
+ const [currentTitle, setCurrentTitle] = useState(table.title);
3130
+ const [currentSubtitle, setCurrentSubtitle] = useState(table.shortDescription);
2769
3131
  const [currentDescription, setCurrentDescription] = useState(table.description);
2770
3132
  const [currentDungeonMaster, setCurrentDungeonMaster] = useState(dungeonMaster);
2771
3133
  const [currentPlayers, setCurrentPlayers] = useState(players);
2772
- const [currentShortDescription, setCurrentShortDescription] = useState(table.shortDescription);
2773
- const [currentTitle, setCurrentTitle] = useState(table.title);
2774
3134
  const [currentWaitlistPlayers, setCurrentWaitlistPlayers] = useState(waitlistPlayers);
2775
3135
  const [currentTagIds, setCurrentTagIds] = useState((_a = table.tags) != null ? _a : []);
3136
+ const pendingEdits = useRef({ title: currentTitle, subtitle: currentSubtitle, tags: currentTagIds });
3137
+ const handleSaveTable = (tableData = {}) => {
3138
+ const nextDraft = {
3139
+ ...table,
3140
+ description: currentDescription,
3141
+ dungeonMaster: String(currentDungeonMaster.id),
3142
+ players: currentPlayers.map((player) => player.id),
3143
+ shortDescription: currentSubtitle,
3144
+ tags: currentTagIds,
3145
+ title: currentTitle,
3146
+ waitlist: currentWaitlistPlayers.map((player) => player.id),
3147
+ ...tableData
3148
+ };
3149
+ void (onSaveDraft == null ? void 0 : onSaveDraft(nextDraft));
3150
+ setIsTableInEditMode(false);
3151
+ };
3152
+ const clean = (text) => text.replaceAll(
3153
+ /\b(n[i1!]g+(er|a|e)s?|f[a@]g|f[a@]g+[o0]ts?|k[i1!]k[e3]s?|ch[i1!]nks?|w[e3]tb[a@]cks?|r[a@]gh[e3][a@]ds?|t[o0]w[e3]lh[e3][a@]ds?|r[e3]t[a@]rd(ed|s)?|c[o0][o0]ns?|tr[a@]nn(y|i[e3]s?)|g[o0][o0]ks?)\b/gi,
3154
+ "dudes"
3155
+ );
3156
+ const editTableDetails = () => {
3157
+ if (!canEdit) {
3158
+ return;
3159
+ }
3160
+ pendingEdits.current = {
3161
+ title: currentTitle,
3162
+ subtitle: currentSubtitle,
3163
+ tags: currentTagIds
3164
+ };
3165
+ const editContent = /* @__PURE__ */ jsx(
3166
+ EditTableDetailsForm,
3167
+ {
3168
+ initialTitle: currentTitle,
3169
+ initialSubtitle: currentSubtitle,
3170
+ onTitleChange: (t) => pendingEdits.current.title = t,
3171
+ onSubtitleChange: (s) => pendingEdits.current.subtitle = s,
3172
+ onTagChange: (t) => pendingEdits.current.tags = t,
3173
+ initialTagIDs: currentTagIds,
3174
+ allTags: allTags.filter((t) => t.appliesTo.tables),
3175
+ allowEditingTitles: true
3176
+ }
3177
+ );
3178
+ showModal(editContent, "Edit Table Details", {
3179
+ acceptText: "Save",
3180
+ onAccept: () => {
3181
+ setCurrentTitle(clean(pendingEdits.current.title));
3182
+ setCurrentSubtitle(clean(pendingEdits.current.subtitle));
3183
+ setCurrentTagIds(pendingEdits.current.tags);
3184
+ handleSaveTable({
3185
+ title: clean(pendingEdits.current.title),
3186
+ shortDescription: clean(pendingEdits.current.subtitle),
3187
+ tags: pendingEdits.current.tags
3188
+ });
3189
+ }
3190
+ });
3191
+ };
2776
3192
  useEffect(() => {
2777
- var _a2;
2778
- setCurrentDescription(table.description);
2779
- setCurrentDungeonMaster(dungeonMaster);
2780
- setCurrentPlayers(players);
2781
- setCurrentShortDescription(table.shortDescription);
2782
- setCurrentTitle(table.title);
2783
- setCurrentWaitlistPlayers(waitlistPlayers);
2784
- setCurrentTagIds((_a2 = table.tags) != null ? _a2 : []);
2785
- }, [dungeonMaster, players, table, waitlistPlayers]);
2786
- const currentTags = useMemo(
3193
+ if (startWithEditTitle) {
3194
+ editTableDetails();
3195
+ }
3196
+ });
3197
+ useMemo(
2787
3198
  () => allTags.filter((tag) => currentTagIds.includes(tag.id)),
2788
3199
  [allTags, currentTagIds]
2789
3200
  );
@@ -2803,37 +3214,17 @@ function TablePageLayout(props) {
2803
3214
  return prevWaitlist.filter((player) => player.id !== playerIdToPromote);
2804
3215
  });
2805
3216
  };
2806
- const handleToggleTag = (tagId) => {
2807
- setCurrentTagIds(
2808
- (prevState) => prevState.includes(tagId) ? prevState.filter((id) => id !== tagId) : [...prevState, tagId]
2809
- );
2810
- };
2811
- const handleSaveTable = () => {
2812
- const nextDraft = {
2813
- ...table,
2814
- description: currentDescription,
2815
- dungeonMaster: String(currentDungeonMaster.id),
2816
- players: currentPlayers.map((player) => player.id),
2817
- shortDescription: currentShortDescription,
2818
- tags: currentTagIds,
2819
- title: currentTitle,
2820
- waitlist: currentWaitlistPlayers.map((player) => player.id)
2821
- };
2822
- void (onSaveDraft == null ? void 0 : onSaveDraft(nextDraft));
2823
- setIsTableInEditMode(false);
2824
- };
2825
3217
  return /* @__PURE__ */ jsx(
2826
3218
  Card,
2827
3219
  {
2828
3220
  sx: {
2829
3221
  backgroundColor: isTableInEditMode ? "lightsalmon" : "white",
2830
- borderRadius: "5%",
2831
3222
  p: 2,
2832
3223
  boxShadow: "0px 8px 15px rgba(25, 118, 210, 0.3)"
2833
3224
  },
2834
- children: /* @__PURE__ */ jsxs(Grid8, { container: true, direction: "column", children: [
3225
+ children: /* @__PURE__ */ jsxs(Grid10, { container: true, direction: "column", children: [
2835
3226
  /* @__PURE__ */ jsxs(
2836
- Grid8,
3227
+ Grid10,
2837
3228
  {
2838
3229
  container: true,
2839
3230
  direction: "column",
@@ -2846,39 +3237,49 @@ function TablePageLayout(props) {
2846
3237
  textShadow: "4px 4px 6px rgba(0, 0, 0, 0.5)"
2847
3238
  },
2848
3239
  children: [
2849
- /* @__PURE__ */ jsx(Box, { children: isTableInEditMode ? /* @__PURE__ */ jsx(
2850
- "input",
2851
- {
2852
- onChange: (e) => setCurrentTitle(e.target.value),
2853
- style: { backgroundColor: "#fffbea" },
2854
- tabIndex: 0,
2855
- type: "text",
2856
- value: currentTitle
2857
- }
2858
- ) : /* @__PURE__ */ jsx(
2859
- CardHeader,
3240
+ /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(
3241
+ Box,
2860
3242
  {
2861
- title: currentTitle,
2862
- sx: {
2863
- p: 0,
2864
- "& .MuiCardHeader-title": {
2865
- color: "white",
2866
- fontWeight: 700
2867
- }
2868
- }
3243
+ className: `flex items-center gap-1 ${canEdit ? "cursor-pointer" : ""}`,
3244
+ sx: { "&:hover .edit-icon": { opacity: 1 } },
3245
+ onClick: editTableDetails,
3246
+ children: [
3247
+ /* @__PURE__ */ jsx(
3248
+ CardHeader,
3249
+ {
3250
+ title: currentTitle,
3251
+ sx: {
3252
+ p: 0,
3253
+ "& .MuiCardHeader-title": {
3254
+ color: "white",
3255
+ fontWeight: 700
3256
+ }
3257
+ }
3258
+ }
3259
+ ),
3260
+ canEdit ? /* @__PURE__ */ jsx(EditIcon3, { className: "edit-icon text-white", sx: { opacity: 0, transition: "opacity 0.2s" } }) : ""
3261
+ ]
2869
3262
  }
2870
3263
  ) }),
2871
- isTableInEditMode ? /* @__PURE__ */ jsx(
2872
- "input",
3264
+ /* @__PURE__ */ jsxs(
3265
+ Box,
2873
3266
  {
2874
- onChange: (e) => setCurrentShortDescription(e.target.value),
2875
- style: { backgroundColor: "#fffbea" },
2876
- tabIndex: 0,
2877
- type: "text",
2878
- value: currentShortDescription
3267
+ className: `flex items-center gap-1 ${canEdit ? "cursor-pointer" : ""}`,
3268
+ sx: { "&:hover .edit-icon": { opacity: 1 } },
3269
+ onClick: editTableDetails,
3270
+ children: [
3271
+ /* @__PURE__ */ jsx(
3272
+ Typography,
3273
+ {
3274
+ sx: { color: "white", opacity: 0.95 },
3275
+ children: currentSubtitle
3276
+ }
3277
+ ),
3278
+ canEdit ? /* @__PURE__ */ jsx(EditIcon3, { className: "edit-icon text-white", sx: { opacity: 0, transition: "opacity 0.2s", fontSize: "medium" } }) : ""
3279
+ ]
2879
3280
  }
2880
- ) : /* @__PURE__ */ jsx(Typography, { sx: { color: "white", opacity: 0.95 }, children: currentShortDescription }),
2881
- /* @__PURE__ */ jsx(Grid8, { container: true, children: isTableInEditMode ? renderEditableTags(currentTags, allTags, handleToggleTag) : renderTags(currentTagIds, allTags) }),
3281
+ ),
3282
+ /* @__PURE__ */ jsx(Grid10, { container: true, onClick: editTableDetails, className: `${canEdit ? "cursor-pointer" : ""}`, children: renderTags(currentTagIds, allTags, canEdit, table.eventTagId || eventTagId) }),
2882
3283
  /* @__PURE__ */ jsx(
2883
3284
  TableActionsBar,
2884
3285
  {
@@ -2898,8 +3299,8 @@ function TablePageLayout(props) {
2898
3299
  ]
2899
3300
  }
2900
3301
  ),
2901
- /* @__PURE__ */ jsxs(Grid8, { container: true, spacing: 2, sx: { mt: 2 }, children: [
2902
- /* @__PURE__ */ jsx(Grid8, { size: { xs: 12, md: 8 }, children: /* @__PURE__ */ jsx(Card, { sx: { height: "100%" }, children: /* @__PURE__ */ jsx(CardContent, { children: isTableInEditMode ? /* @__PURE__ */ jsx(
3302
+ /* @__PURE__ */ jsxs(Grid10, { container: true, spacing: 2, sx: { mt: 2 }, children: [
3303
+ /* @__PURE__ */ jsx(Grid10, { size: { xs: 12, md: 8 }, children: /* @__PURE__ */ jsx(Card, { sx: { height: "100%" }, children: /* @__PURE__ */ jsx(CardContent, { children: isTableInEditMode ? /* @__PURE__ */ jsx(
2903
3304
  AutoResizingTextarea_default,
2904
3305
  {
2905
3306
  isInEditMode: isTableInEditMode,
@@ -2908,7 +3309,7 @@ function TablePageLayout(props) {
2908
3309
  value: currentDescription
2909
3310
  }
2910
3311
  ) : /* @__PURE__ */ jsx(Typography, { sx: { whiteSpace: "pre-wrap" }, children: currentDescription }) }) }) }),
2911
- /* @__PURE__ */ jsxs(Grid8, { size: { xs: 12, md: 4 }, children: [
3312
+ /* @__PURE__ */ jsxs(Grid10, { size: { xs: 12, md: 4 }, children: [
2912
3313
  /* @__PURE__ */ jsx(DMHighlightsCard, { canEdit: isTableInEditMode, player: currentDungeonMaster, allTags }),
2913
3314
  /* @__PURE__ */ jsxs(Card, { sx: { height: "100%" }, children: [
2914
3315
  /* @__PURE__ */ jsx(CardHeader, { slotProps: { title: { variant: "h4" } }, title: "Players: " }),
@@ -2931,31 +3332,78 @@ function TablePageLayout(props) {
2931
3332
  }
2932
3333
  );
2933
3334
  }
2934
- var renderTags = function(tags, allTags) {
3335
+ var renderTags = function(tags, allTags, canEdit, eventTagId) {
2935
3336
  if (!tags || !allTags) {
2936
3337
  return /* @__PURE__ */ jsx(Fragment, {});
2937
3338
  }
2938
- return /* @__PURE__ */ jsx(Grid8, { container: true, spacing: 1, sx: { pb: 1.5 }, children: tags.map((tagId) => {
2939
- const tag = allTags.find((potentialTag) => tagId === potentialTag.id);
2940
- return tag ? generateTagsDisplay(tag) : /* @__PURE__ */ jsx(Fragment, {});
2941
- }) });
2942
- };
2943
- var renderEditableTags = function(selectedTags, allTags, onToggleTag) {
2944
- return /* @__PURE__ */ jsx(Grid8, { size: { xs: 12 }, sx: { pb: 1.5 }, children: /* @__PURE__ */ jsx(
2945
- TagEditor,
2946
- {
2947
- title: "Table Tags",
2948
- possibleTags: allTags.filter((tag) => {
2949
- var _a;
2950
- return (_a = tag.appliesTo) == null ? void 0 : _a.tables;
2951
- }),
2952
- selectedTags,
2953
- onToggleTag
2954
- }
2955
- ) });
3339
+ return /* @__PURE__ */ jsxs(Grid10, { container: true, spacing: 1, sx: { pb: 1.5 }, children: [
3340
+ renderTagsFromIds(tags, allTags, { showEventTag: true, eventTagId }),
3341
+ canEdit ? /* @__PURE__ */ jsx(
3342
+ Button,
3343
+ {
3344
+ variant: "text",
3345
+ className: "inline-block text-sm px-3 py-1font-outlined m-0.5 font-stretch-105% font-sans",
3346
+ sx: {
3347
+ color: "white",
3348
+ textShadow: "black 1.5px 1px 1.5px",
3349
+ "&:hover": {
3350
+ background: "#889"
3351
+ }
3352
+ },
3353
+ children: "Edit Tags..."
3354
+ }
3355
+ ) : ""
3356
+ ] });
2956
3357
  };
2957
3358
  var TablePageLayout_default = TablePageLayout;
3359
+ var ModalProvider = ({ children }) => {
3360
+ var _a;
3361
+ const [modalContent, setModalContent] = useState(null);
3362
+ const [displayModal, setDisplayModal] = useState(false);
3363
+ const [title, setTitle] = useState("");
3364
+ const [options, setOptions] = useState({});
3365
+ const showModal = (content, title2, opts) => {
3366
+ setModalContent(content);
3367
+ setTitle(title2);
3368
+ setOptions(opts != null ? opts : {});
3369
+ setDisplayModal(true);
3370
+ };
3371
+ const hideModal = () => {
3372
+ setDisplayModal(false);
3373
+ };
3374
+ return /* @__PURE__ */ jsxs(ModalContext.Provider, { value: { showModal, hideModal }, children: [
3375
+ children,
3376
+ /* @__PURE__ */ jsxs(Dialog3, { open: displayModal, onClose: hideModal, sx: { height: "85%" }, children: [
3377
+ /* @__PURE__ */ jsxs(Box, { children: [
3378
+ /* @__PURE__ */ jsx(DialogTitle3, { sx: { marginRight: "20px", minWidth: "400px" }, children: title }),
3379
+ /* @__PURE__ */ jsx(
3380
+ IconButton3,
3381
+ {
3382
+ "aria-label": "close",
3383
+ onClick: hideModal,
3384
+ sx: { position: "absolute", right: 8, top: 8 },
3385
+ children: /* @__PURE__ */ jsx(CloseIcon, {})
3386
+ }
3387
+ )
3388
+ ] }),
3389
+ /* @__PURE__ */ jsx(DialogContent3, { sx: { paddingTop: 0 }, children: modalContent }),
3390
+ (options.acceptText || options.onAccept) && /* @__PURE__ */ jsxs(DialogActions3, { children: [
3391
+ /* @__PURE__ */ jsx(Button8, { variant: "contained", onClick: () => {
3392
+ var _a2;
3393
+ hideModal();
3394
+ (_a2 = options.onAccept) == null ? void 0 : _a2.call(options);
3395
+ }, children: (_a = options.acceptText) != null ? _a : "OK" }),
3396
+ /* @__PURE__ */ jsx(Button8, { onClick: () => {
3397
+ var _a2;
3398
+ hideModal();
3399
+ (_a2 = options.onCancel) == null ? void 0 : _a2.call(options);
3400
+ }, children: "Cancel" })
3401
+ ] })
3402
+ ] })
3403
+ ] });
3404
+ };
3405
+ var ModalProvider_default = ModalProvider;
2958
3406
 
2959
- export { AutoResizingTextarea_default as AutoResizingTextarea, BaseSearchResultCard_default as BaseSearchResultCard, CANDIDATE_TIMEZONES, Chip, DMHighlightsCard, EventBanner, EventBannerEdit, EventBasicInfo, EventBasicInfoEdit, EventEditProvider, EventPageLayout, EventResultCard_default as EventResultCard, EventTablesCard_default as EventTablesCard, ExpiredTablesFilter_default as ExpiredTablesFilter, FiltersContainer_default as FiltersContainer, GameTableProvider, ModalContext, ModalProvider_default as ModalProvider, NextGameCountdown, NextGameLabel_default as NextGameLabel, PlayerDetailsCard_default as PlayerDetailsCard, PlayerDisplayCard_default as PlayerDisplayCard, PlayerHighlightsCard, PlayerPageLayout, PlayerPromptCard_default as PlayerPromptCard, PlayerResultCard_default as PlayerResultCard, PlayerTagsCard_default as PlayerTagsCard, PlayerTagsEdit_default as 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, TextSearchCard_default as TextSearchCard, TypeFilter_default as TypeFilter, generateTagsDisplay, renderTagsFromIds, useEventEdit, useGameTableContext, useModal };
3407
+ export { AutoResizingTextarea_default as AutoResizingTextarea, BaseSearchResultCard_default as BaseSearchResultCard, CANDIDATE_TIMEZONES, Chip, DMHighlightsCard, DistanceFilter_default as DistanceFilter, EditTableDetailsForm, EventBanner, EventBannerEdit, EventBasicInfo, EventBasicInfoEdit, EventEditProvider, EventPageLayout, EventResultCard_default as EventResultCard, EventTablesCard_default as EventTablesCard, ExpiredTablesFilter_default as ExpiredTablesFilter, FiltersContainer_default as FiltersContainer, GameTableProvider, ModalContext, ModalProvider_default as ModalProvider, NextGameCountdown, NextGameLabel_default as NextGameLabel, PlayerDetailsCard_default as PlayerDetailsCard, PlayerDisplayCard_default as PlayerDisplayCard, PlayerHighlightsCard, PlayerPageLayout, PlayerPromptCard_default as PlayerPromptCard, PlayerResultCard_default as PlayerResultCard, PlayerTagsCard_default as PlayerTagsCard, PlayerTagsEdit_default as 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, TagSelector, TagsFilter_default as TagsFilter, TextSearchCard_default as TextSearchCard, TypeFilter_default as TypeFilter, UserAgreementModal_default as UserAgreementModal, generateTagsDisplay, getRandomTagline, getRandomTitle, renderTagsFromIds, useEventEdit, useGameTableContext, useModal };
2960
3408
  //# sourceMappingURL=index.mjs.map
2961
3409
  //# sourceMappingURL=index.mjs.map