@mbpockets/shared-ui 0.1.19 → 0.1.21

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 (141) hide show
  1. package/dist/EventPage/index.cjs +209 -121
  2. package/dist/EventPage/index.cjs.map +1 -1
  3. package/dist/EventPage/index.mjs +201 -119
  4. package/dist/EventPage/index.mjs.map +1 -1
  5. package/dist/EventPage.cjs +209 -121
  6. package/dist/EventPage.cjs.map +1 -1
  7. package/dist/EventPage.mjs +201 -119
  8. package/dist/EventPage.mjs.map +1 -1
  9. package/dist/PlayerPage/index.cjs +289 -92
  10. package/dist/PlayerPage/index.cjs.map +1 -1
  11. package/dist/PlayerPage/index.d.cts +1 -1
  12. package/dist/PlayerPage/index.d.ts +1 -1
  13. package/dist/PlayerPage/index.mjs +287 -90
  14. package/dist/PlayerPage/index.mjs.map +1 -1
  15. package/dist/PlayerPage.cjs +289 -92
  16. package/dist/PlayerPage.cjs.map +1 -1
  17. package/dist/PlayerPage.d.cts +24 -6
  18. package/dist/PlayerPage.d.ts +24 -6
  19. package/dist/PlayerPage.mjs +287 -90
  20. package/dist/PlayerPage.mjs.map +1 -1
  21. package/dist/ProfilePage/index.cjs +474 -44
  22. package/dist/ProfilePage/index.cjs.map +1 -1
  23. package/dist/ProfilePage/index.d.cts +2 -1
  24. package/dist/ProfilePage/index.d.ts +2 -1
  25. package/dist/ProfilePage/index.mjs +469 -39
  26. package/dist/ProfilePage/index.mjs.map +1 -1
  27. package/dist/ProfilePage.cjs +474 -44
  28. package/dist/ProfilePage.cjs.map +1 -1
  29. package/dist/ProfilePage.d.cts +4 -10
  30. package/dist/ProfilePage.d.ts +4 -10
  31. package/dist/ProfilePage.mjs +469 -39
  32. package/dist/ProfilePage.mjs.map +1 -1
  33. package/dist/SearchPage/Filters/index.cjs +149 -43
  34. package/dist/SearchPage/Filters/index.cjs.map +1 -1
  35. package/dist/SearchPage/Filters/index.d.cts +1 -2
  36. package/dist/SearchPage/Filters/index.d.ts +1 -2
  37. package/dist/SearchPage/Filters/index.mjs +146 -42
  38. package/dist/SearchPage/Filters/index.mjs.map +1 -1
  39. package/dist/SearchPage/Filters.cjs +149 -43
  40. package/dist/SearchPage/Filters.cjs.map +1 -1
  41. package/dist/SearchPage/Filters.d.cts +38 -3
  42. package/dist/SearchPage/Filters.d.ts +38 -3
  43. package/dist/SearchPage/Filters.mjs +146 -42
  44. package/dist/SearchPage/Filters.mjs.map +1 -1
  45. package/dist/SearchPage/Results/index.cjs +139 -67
  46. package/dist/SearchPage/Results/index.cjs.map +1 -1
  47. package/dist/SearchPage/Results/index.mjs +127 -63
  48. package/dist/SearchPage/Results/index.mjs.map +1 -1
  49. package/dist/SearchPage/Results.cjs +139 -67
  50. package/dist/SearchPage/Results.cjs.map +1 -1
  51. package/dist/SearchPage/Results.d.cts +21 -12
  52. package/dist/SearchPage/Results.d.ts +21 -12
  53. package/dist/SearchPage/Results.mjs +127 -63
  54. package/dist/SearchPage/Results.mjs.map +1 -1
  55. package/dist/SearchPage/index.cjs +496 -221
  56. package/dist/SearchPage/index.cjs.map +1 -1
  57. package/dist/SearchPage/index.d.cts +1 -1
  58. package/dist/SearchPage/index.d.ts +1 -1
  59. package/dist/SearchPage/index.mjs +483 -216
  60. package/dist/SearchPage/index.mjs.map +1 -1
  61. package/dist/SearchPage.cjs +496 -221
  62. package/dist/SearchPage.cjs.map +1 -1
  63. package/dist/SearchPage.d.cts +78 -7
  64. package/dist/SearchPage.d.ts +78 -7
  65. package/dist/SearchPage.mjs +483 -216
  66. package/dist/SearchPage.mjs.map +1 -1
  67. package/dist/TablePage/index.cjs +10 -1
  68. package/dist/TablePage/index.cjs.map +1 -1
  69. package/dist/TablePage/index.d.cts +2 -2
  70. package/dist/TablePage/index.d.ts +2 -2
  71. package/dist/TablePage/index.mjs +10 -2
  72. package/dist/TablePage/index.mjs.map +1 -1
  73. package/dist/TablePage.cjs +10 -1
  74. package/dist/TablePage.cjs.map +1 -1
  75. package/dist/TablePage.d.cts +7 -2
  76. package/dist/TablePage.d.ts +7 -2
  77. package/dist/TablePage.mjs +10 -2
  78. package/dist/TablePage.mjs.map +1 -1
  79. package/dist/index.cjs +789 -331
  80. package/dist/index.cjs.map +1 -1
  81. package/dist/index.d.cts +4 -5
  82. package/dist/index.d.ts +4 -5
  83. package/dist/index.mjs +772 -324
  84. package/dist/index.mjs.map +1 -1
  85. package/dist/mocks/SearchResults.cjs +22 -15
  86. package/dist/mocks/SearchResults.cjs.map +1 -1
  87. package/dist/mocks/SearchResults.d.cts +3 -15
  88. package/dist/mocks/SearchResults.d.ts +3 -15
  89. package/dist/mocks/SearchResults.mjs +22 -15
  90. package/dist/mocks/SearchResults.mjs.map +1 -1
  91. package/dist/mocks/index.cjs +22 -15
  92. package/dist/mocks/index.cjs.map +1 -1
  93. package/dist/mocks/index.d.cts +2 -1
  94. package/dist/mocks/index.d.ts +2 -1
  95. package/dist/mocks/index.mjs +22 -15
  96. package/dist/mocks/index.mjs.map +1 -1
  97. package/dist/mocks.cjs +22 -15
  98. package/dist/mocks.cjs.map +1 -1
  99. package/dist/mocks.d.cts +2 -1
  100. package/dist/mocks.d.ts +2 -1
  101. package/dist/mocks.mjs +22 -15
  102. package/dist/mocks.mjs.map +1 -1
  103. package/dist/{common → shared}/index.cjs.map +1 -1
  104. package/dist/{common → shared}/index.d.cts +1 -1
  105. package/dist/{common → shared}/index.d.ts +1 -1
  106. package/dist/{common → shared}/index.mjs.map +1 -1
  107. package/dist/{common.cjs → shared.cjs} +2 -2
  108. package/dist/{common.cjs.map → shared.cjs.map} +1 -1
  109. package/dist/{common.css → shared.css} +1 -1
  110. package/dist/{common.mjs → shared.mjs} +2 -2
  111. package/dist/{common.mjs.map → shared.mjs.map} +1 -1
  112. package/dist/types/index.d.cts +1 -1
  113. package/dist/types/index.d.ts +1 -1
  114. package/dist/types/search.d.cts +23 -1
  115. package/dist/types/search.d.ts +23 -1
  116. package/dist/types.d.cts +1 -1
  117. package/dist/types.d.ts +1 -1
  118. package/package.json +1 -1
  119. /package/dist/{common → shared}/Modal/index.cjs +0 -0
  120. /package/dist/{common → shared}/Modal/index.cjs.map +0 -0
  121. /package/dist/{common → shared}/Modal/index.css +0 -0
  122. /package/dist/{common → shared}/Modal/index.css.map +0 -0
  123. /package/dist/{common → shared}/Modal/index.d.cts +0 -0
  124. /package/dist/{common → shared}/Modal/index.d.ts +0 -0
  125. /package/dist/{common → shared}/Modal/index.mjs +0 -0
  126. /package/dist/{common → shared}/Modal/index.mjs.map +0 -0
  127. /package/dist/{common → shared}/Modal.cjs +0 -0
  128. /package/dist/{common → shared}/Modal.cjs.map +0 -0
  129. /package/dist/{common → shared}/Modal.css +0 -0
  130. /package/dist/{common → shared}/Modal.css.map +0 -0
  131. /package/dist/{common → shared}/Modal.d.cts +0 -0
  132. /package/dist/{common → shared}/Modal.d.ts +0 -0
  133. /package/dist/{common → shared}/Modal.mjs +0 -0
  134. /package/dist/{common → shared}/Modal.mjs.map +0 -0
  135. /package/dist/{common → shared}/index.cjs +0 -0
  136. /package/dist/{common → shared}/index.css +0 -0
  137. /package/dist/{common → shared}/index.css.map +0 -0
  138. /package/dist/{common → shared}/index.mjs +0 -0
  139. /package/dist/{common.css.map → shared.css.map} +0 -0
  140. /package/dist/{common.d.cts → shared.d.cts} +0 -0
  141. /package/dist/{common.d.ts → shared.d.ts} +0 -0
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { createContext, useState, useEffect, useContext } from 'react';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
- import { Box, Grid, TextField, Tooltip, IconButton, Button, CircularProgress, Dialog, DialogTitle, DialogContent, DialogActions, Card, CardContent, Typography, FormControl, InputLabel, Select, MenuItem, Chip as Chip$1, LinearProgress } from '@mui/material';
4
+ import { Box, Grid, TextField, Tooltip, IconButton, Button, CircularProgress, Dialog, DialogTitle, DialogContent, DialogActions, Card, CardContent, Typography, FormControl, InputLabel, Select, MenuItem } from '@mui/material';
5
5
  import DeleteIcon from '@mui/icons-material/Delete';
6
6
  import EditIcon from '@mui/icons-material/Edit';
7
7
  import AddIcon from '@mui/icons-material/Add';
@@ -10,12 +10,18 @@ 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
12
  import Grid5 from '@mui/material/Grid';
13
- import Card4 from '@mui/material/Card';
14
- import CardContent4 from '@mui/material/CardContent';
13
+ import Card3 from '@mui/material/Card';
14
+ import CardContent3 from '@mui/material/CardContent';
15
15
  import CardHeader from '@mui/material/CardHeader';
16
16
  import Divider from '@mui/material/Divider';
17
+ import Typography4 from '@mui/material/Typography';
18
+ import Pagination from '@mui/material/Pagination';
17
19
  import Avatar from '@mui/material/Avatar';
18
- import CasinoIcon from '@mui/icons-material/Casino';
20
+ import Chip2 from '@mui/material/Chip';
21
+ import LinearProgress from '@mui/material/LinearProgress';
22
+ import PersonIcon from '@mui/icons-material/Person';
23
+ import SupervisorAccountIcon from '@mui/icons-material/SupervisorAccount';
24
+ import TableRestaurantIcon from '@mui/icons-material/TableRestaurant';
19
25
  import CalendarTodayIcon from '@mui/icons-material/CalendarToday';
20
26
  import LocationOnIcon from '@mui/icons-material/LocationOn';
21
27
  import EventIcon from '@mui/icons-material/Event';
@@ -107,6 +113,13 @@ function Chip({ tag, removeCallback }) {
107
113
  function generateTagsDisplay(tag) {
108
114
  return /* @__PURE__ */ jsx(Chip, { tag }, tag.id);
109
115
  }
116
+ function renderTagsFromIds(ids, legalTags) {
117
+ if (!ids || !legalTags || legalTags.length === 0) {
118
+ return /* @__PURE__ */ jsx(Fragment, {});
119
+ }
120
+ const validTags = ids.map((id) => legalTags.find((tag) => tag.id === id)).filter((tag) => Boolean(tag));
121
+ return validTags.map((tag) => generateTagsDisplay(tag));
122
+ }
110
123
  function EventBannerEdit({
111
124
  initialValue,
112
125
  onCancel,
@@ -915,6 +928,14 @@ var generateLink = function(link) {
915
928
  link.text
916
929
  );
917
930
  };
931
+ var NextGameLabel = ({ nextGameTime }) => {
932
+ const date = typeof nextGameTime === "string" ? new Date(nextGameTime) : nextGameTime;
933
+ return /* @__PURE__ */ jsxs(Typography, { variant: "caption", sx: { display: "block", mb: 1, color: "primary.main", fontWeight: "bold" }, children: [
934
+ "Next Game: ",
935
+ date.toLocaleString()
936
+ ] });
937
+ };
938
+ var NextGameLabel_default = NextGameLabel;
918
939
  var BaseSearchResultCard = ({
919
940
  result,
920
941
  onClick,
@@ -922,13 +943,19 @@ var BaseSearchResultCard = ({
922
943
  icon,
923
944
  tags
924
945
  }) => {
925
- const handleClick = () => {
946
+ const handleClick = (e) => {
926
947
  if (onClick) {
927
- onClick(result.id);
948
+ if (e.ctrlKey || e.metaKey || e.shiftKey) {
949
+ e.stopPropagation();
950
+ const url = `/${result.type}/${result.id}`;
951
+ window.open(url, "_blank");
952
+ } else {
953
+ onClick(result.id);
954
+ }
928
955
  }
929
956
  };
930
957
  return /* @__PURE__ */ jsx(
931
- Card,
958
+ Card3,
932
959
  {
933
960
  elevation: 6,
934
961
  sx: {
@@ -941,48 +968,22 @@ var BaseSearchResultCard = ({
941
968
  },
942
969
  marginBottom: 2
943
970
  },
944
- onClick: handleClick,
945
- children: /* @__PURE__ */ jsxs(CardContent, { sx: { display: "flex", alignItems: "flex-start" }, children: [
946
- icon && /* @__PURE__ */ jsx(Box, { sx: { mr: 2, display: "flex", alignItems: "center", pt: 0.5 }, children: icon }),
947
- /* @__PURE__ */ jsxs(Box, { sx: { flex: 1 }, children: [
948
- /* @__PURE__ */ jsx(Typography, { variant: "h6", sx: { mb: 1 }, children: result.title }),
971
+ onClick: (e) => handleClick(e),
972
+ children: /* @__PURE__ */ jsxs(CardContent3, { sx: { display: "flex", alignItems: "flex-start" }, children: [
973
+ icon && /* @__PURE__ */ jsx(Box2, { sx: { mr: 2, display: "flex", alignItems: "center", pt: 0.5 }, children: icon }),
974
+ /* @__PURE__ */ jsxs(Box2, { sx: { flex: 1 }, children: [
975
+ /* @__PURE__ */ jsx(Typography4, { variant: "h6", sx: { mb: 1 }, children: result.title }),
976
+ result.nextGameTime && /* @__PURE__ */ jsx(NextGameLabel_default, { nextGameTime: result.nextGameTime }),
977
+ result.type === "table" && result.shortDescription ? /* @__PURE__ */ jsx(Typography4, { variant: "body2", sx: { mb: 1 }, children: result.shortDescription }) : null,
949
978
  children,
950
- /* @__PURE__ */ jsx(Typography, { variant: "body1", children: result.description }),
951
- result.tags && result.tags.length > 0 && /* @__PURE__ */ jsx(Box, { sx: { mt: 1 }, children: /* @__PURE__ */ jsx(Box, { sx: {
952
- display: "block",
953
- whiteSpace: "nowrap",
954
- overflow: "hidden",
955
- textOverflow: "clip",
956
- pl: 0.5
957
- // Add some padding to prevent clipping of the leftmost tag
958
- }, children: (() => {
959
- const MAX_VISIBLE = 5;
960
- const tagObjs = result.tags.map((tagId) => tags.find((t) => t.id === tagId)).filter((t) => Boolean(t));
961
- const visible = tagObjs.slice(0, MAX_VISIBLE);
962
- const hiddenCount = Math.max(tagObjs.length - visible.length, 0);
963
- return /* @__PURE__ */ jsxs(Fragment, { children: [
964
- visible.map((tag) => generateTagsDisplay(tag)),
965
- hiddenCount > 0 && /* @__PURE__ */ jsxs(
966
- "span",
967
- {
968
- className: "inline-block text-sm px-3 py-1 rounded-full outline-black outline-2 font-outlined",
969
- style: {
970
- marginTop: "6px",
971
- marginRight: "6px",
972
- marginBottom: "6px",
973
- background: "#9e9e9e",
974
- color: "white",
975
- textShadow: "black 0.2em 0.2em 0.4em"
976
- },
977
- children: [
978
- "+",
979
- hiddenCount,
980
- " more"
981
- ]
982
- }
983
- )
984
- ] });
985
- })() }) })
979
+ result.type === "table" ? /* @__PURE__ */ jsx(Typography4, { variant: "body1", children: (() => {
980
+ var _a, _b;
981
+ const full = (_b = (_a = result.fullDescription) != null ? _a : result.description) != null ? _b : "";
982
+ if (typeof full !== "string") return "";
983
+ const text = full || "";
984
+ return text.length > 200 ? `${text.slice(0, 200).trimEnd()}...` : text;
985
+ })() }) : /* @__PURE__ */ jsx(Typography4, { variant: "body1", children: result.description }),
986
+ result.tags && result.tags.length > 0 && /* @__PURE__ */ jsx(Box2, { sx: { mt: 1, display: "flex", flexWrap: "wrap", gap: 1 }, children: renderTagsFromIds(result.tags, tags) })
986
987
  ] })
987
988
  ] })
988
989
  }
@@ -1037,21 +1038,60 @@ var PlayerResultCard = ({
1037
1038
  return /* @__PURE__ */ jsx(BaseSearchResultCard_default, { result, onClick, icon: playerIcon, tags });
1038
1039
  };
1039
1040
  var PlayerResultCard_default = PlayerResultCard;
1040
- var TableResultCard = ({ result, tags, onClick }) => {
1041
- const capacity = result.capacity || 1;
1042
- const numPlayers = result.numPlayers || 0;
1043
- const occupancy = numPlayers / capacity * 100;
1044
- return /* @__PURE__ */ jsx(BaseSearchResultCard, { result, tags, onClick, icon: /* @__PURE__ */ jsx(CasinoIcon, { color: "primary" }), children: /* @__PURE__ */ jsxs(Box, { sx: { mb: 1 }, children: [
1045
- /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 0.5 }, children: [
1046
- /* @__PURE__ */ jsxs(Typography, { variant: "body2", color: "text.secondary", children: [
1047
- "Players: ",
1048
- numPlayers,
1049
- " / ",
1050
- capacity
1041
+ var TableResultCard = ({
1042
+ result,
1043
+ onClick,
1044
+ tags
1045
+ }) => {
1046
+ const rawCapacity = result.capacity;
1047
+ const hasDefinedCapacity = typeof rawCapacity === "number" && Number.isFinite(rawCapacity) && rawCapacity > 0;
1048
+ const capacity = hasDefinedCapacity ? rawCapacity : 0;
1049
+ const activePlayers = typeof result.numPlayers === "number" ? result.numPlayers : 0;
1050
+ const availableSlots = Math.max(capacity - activePlayers, 0);
1051
+ const hasDM = typeof result.hasDM === "boolean" ? result.hasDM : Boolean(result.dungeonMaster);
1052
+ const occupancyPercentage = hasDefinedCapacity ? activePlayers / capacity * 100 : 100;
1053
+ const tableIcon = /* @__PURE__ */ jsx(
1054
+ TableRestaurantIcon,
1055
+ {
1056
+ sx: {
1057
+ fontSize: 40,
1058
+ color: "primary.main"
1059
+ }
1060
+ }
1061
+ );
1062
+ return /* @__PURE__ */ jsx(BaseSearchResultCard_default, { result, onClick, icon: tableIcon, tags, children: /* @__PURE__ */ jsxs(Box2, { sx: { mb: 2 }, children: [
1063
+ /* @__PURE__ */ jsxs(Box2, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 1 }, children: [
1064
+ /* @__PURE__ */ jsxs(Typography4, { variant: "body2", children: [
1065
+ /* @__PURE__ */ jsx("strong", { children: "Players:" }),
1066
+ " ",
1067
+ hasDefinedCapacity ? `${activePlayers}/${capacity}` : activePlayers
1051
1068
  ] }),
1052
- result.dungeonMaster ? /* @__PURE__ */ jsx(Chip$1, { label: "DM Present", size: "small", color: "success", variant: "outlined" }) : /* @__PURE__ */ jsx(Chip$1, { label: "No DM", size: "small", color: "warning", variant: "outlined" })
1069
+ typeof hasDM === "boolean" && /* @__PURE__ */ jsx(
1070
+ Chip2,
1071
+ {
1072
+ icon: hasDM ? /* @__PURE__ */ jsx(SupervisorAccountIcon, {}) : /* @__PURE__ */ jsx(PersonIcon, {}),
1073
+ label: hasDM ? "DM Present" : "No DM",
1074
+ color: hasDM ? "success" : "warning",
1075
+ size: "small"
1076
+ }
1077
+ )
1053
1078
  ] }),
1054
- /* @__PURE__ */ jsx(LinearProgress, { variant: "determinate", value: occupancy, sx: { height: 8, borderRadius: 4 } })
1079
+ /* @__PURE__ */ jsx(
1080
+ LinearProgress,
1081
+ {
1082
+ variant: "determinate",
1083
+ value: occupancyPercentage,
1084
+ sx: {
1085
+ height: 10,
1086
+ borderRadius: 5,
1087
+ backgroundColor: "#e0e0e0",
1088
+ "& .MuiLinearProgress-bar": {
1089
+ backgroundColor: hasDefinedCapacity ? availableSlots > 0 ? "#4caf50" : "#f44336" : "#2196f3"
1090
+ }
1091
+ }
1092
+ }
1093
+ ),
1094
+ hasDefinedCapacity && /* @__PURE__ */ jsx(Typography4, { variant: "body2", sx: { mt: 0.5, textAlign: "right" }, children: availableSlots > 0 ? `${availableSlots} slot${availableSlots !== 1 ? "s" : ""} available` : "Table full" })
1055
1095
  ] }) });
1056
1096
  };
1057
1097
  var TableResultCard_default = TableResultCard;
@@ -1070,20 +1110,42 @@ var EventResultCard = ({
1070
1110
  try {
1071
1111
  const date = new Date(dateString);
1072
1112
  return date.toLocaleDateString("en-US", options);
1073
- } catch {
1113
+ } catch (error) {
1074
1114
  return dateString;
1075
1115
  }
1076
1116
  };
1077
1117
  const formattedDate = result.date ? formatDate(result.date) : "Date TBD";
1078
1118
  const location = result.location || "Location TBD";
1079
- return /* @__PURE__ */ jsx(BaseSearchResultCard_default, { result, onClick, icon: /* @__PURE__ */ jsx(EventIcon, { color: "primary" }), tags, children: /* @__PURE__ */ jsxs(Box, { sx: { mb: 1 }, children: [
1080
- /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", mb: 0.5 }, children: [
1081
- /* @__PURE__ */ jsx(CalendarTodayIcon, { sx: { mr: 1, fontSize: "small", color: "text.secondary" } }),
1082
- /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", children: formattedDate })
1119
+ const eventIcon = /* @__PURE__ */ jsx(
1120
+ EventIcon,
1121
+ {
1122
+ sx: {
1123
+ fontSize: 40,
1124
+ color: "primary.main"
1125
+ }
1126
+ }
1127
+ );
1128
+ return /* @__PURE__ */ jsx(BaseSearchResultCard_default, { result, onClick, icon: eventIcon, tags, children: /* @__PURE__ */ jsxs(Box2, { sx: { mb: 2 }, children: [
1129
+ /* @__PURE__ */ jsxs(Box2, { sx: { display: "flex", alignItems: "center", mb: 1 }, children: [
1130
+ /* @__PURE__ */ jsx(CalendarTodayIcon, { sx: { mr: 1, color: "primary.main" } }),
1131
+ /* @__PURE__ */ jsxs(Typography4, { variant: "body2", children: [
1132
+ /* @__PURE__ */ jsx("strong", { children: "Date:" }),
1133
+ " ",
1134
+ formattedDate
1135
+ ] })
1083
1136
  ] }),
1084
- /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", mb: 1 }, children: [
1085
- /* @__PURE__ */ jsx(LocationOnIcon, { sx: { mr: 1, fontSize: "small", color: "text.secondary" } }),
1086
- /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", children: location })
1137
+ /* @__PURE__ */ jsxs(Box2, { sx: { display: "flex", alignItems: "center" }, children: [
1138
+ /* @__PURE__ */ jsx(LocationOnIcon, { sx: { mr: 1, color: "primary.main" } }),
1139
+ /* @__PURE__ */ jsxs(Typography4, { variant: "body2", children: [
1140
+ /* @__PURE__ */ jsx("strong", { children: "Location:" }),
1141
+ " ",
1142
+ location
1143
+ ] })
1144
+ ] }),
1145
+ result.organizer && /* @__PURE__ */ jsxs(Typography4, { variant: "body2", sx: { mt: 1 }, children: [
1146
+ /* @__PURE__ */ jsx("strong", { children: "Organizer:" }),
1147
+ " ",
1148
+ result.organizer
1087
1149
  ] })
1088
1150
  ] }) });
1089
1151
  };
@@ -1091,9 +1153,11 @@ var EventResultCard_default = EventResultCard;
1091
1153
  var ResultsContainer = ({
1092
1154
  results,
1093
1155
  onResultClick,
1094
- tags
1156
+ tags,
1157
+ pagination,
1158
+ onPacketChange
1095
1159
  }) => {
1096
- if (results.length === 0 || !results.map) {
1160
+ if (!results || results.length === 0 || !results.map) {
1097
1161
  return /* @__PURE__ */ jsx(Box2, { sx: { textAlign: "center", py: 4 }, children: "No results found. Try adjusting your filters." });
1098
1162
  }
1099
1163
  const onPlayerClick = (id) => {
@@ -1105,43 +1169,68 @@ var ResultsContainer = ({
1105
1169
  const onEventClick = (id) => {
1106
1170
  onResultClick == null ? void 0 : onResultClick(id, "event");
1107
1171
  };
1108
- return /* @__PURE__ */ jsx(Box2, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: results.map((result) => {
1109
- switch (result.type) {
1110
- case "player":
1111
- return /* @__PURE__ */ jsx(
1112
- PlayerResultCard_default,
1113
- {
1114
- result,
1115
- onClick: onPlayerClick,
1116
- tags
1117
- },
1118
- result.id
1119
- );
1120
- case "table":
1121
- return /* @__PURE__ */ jsx(
1122
- TableResultCard_default,
1123
- {
1124
- result,
1125
- onClick: onTableClick,
1126
- tags
1127
- },
1128
- result.id
1129
- );
1130
- case "event":
1131
- return /* @__PURE__ */ jsx(
1132
- EventResultCard_default,
1133
- {
1134
- result,
1135
- onClick: onEventClick,
1136
- tags
1137
- },
1138
- result.id
1139
- );
1140
- default:
1141
- console.error(`Unknown result type: ${result.type}`);
1142
- return null;
1143
- }
1144
- }) });
1172
+ const handlePacketChange = (_event, packet) => {
1173
+ onPacketChange == null ? void 0 : onPacketChange(packet);
1174
+ };
1175
+ const startResult = pagination ? (pagination.currentPacket - 1) * pagination.packetSize + 1 : 1;
1176
+ const endResult = pagination ? Math.min(pagination.currentPacket * pagination.packetSize, pagination.totalResults) : results.length;
1177
+ return /* @__PURE__ */ jsxs(Box2, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: [
1178
+ pagination && /* @__PURE__ */ jsx(Box2, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 1 }, children: /* @__PURE__ */ jsxs(Typography4, { variant: "body2", color: "text.secondary", children: [
1179
+ "Showing ",
1180
+ startResult,
1181
+ "-",
1182
+ endResult,
1183
+ " of ",
1184
+ pagination.totalResults,
1185
+ " results"
1186
+ ] }) }),
1187
+ results.map((result, index) => {
1188
+ switch (result.type) {
1189
+ case "player":
1190
+ return /* @__PURE__ */ jsx(
1191
+ PlayerResultCard_default,
1192
+ {
1193
+ result,
1194
+ onClick: onPlayerClick,
1195
+ tags
1196
+ },
1197
+ result.id
1198
+ );
1199
+ case "table":
1200
+ return /* @__PURE__ */ jsx(
1201
+ TableResultCard_default,
1202
+ {
1203
+ result,
1204
+ onClick: onTableClick,
1205
+ tags
1206
+ },
1207
+ result.id
1208
+ );
1209
+ case "event":
1210
+ return /* @__PURE__ */ jsx(
1211
+ EventResultCard_default,
1212
+ {
1213
+ result,
1214
+ onClick: onEventClick,
1215
+ tags
1216
+ },
1217
+ result.id
1218
+ );
1219
+ default:
1220
+ console.error(`Unknown result type: ${result.type}`);
1221
+ return null;
1222
+ }
1223
+ }),
1224
+ pagination && pagination.totalPackets > 1 && /* @__PURE__ */ jsx(Box2, { sx: { display: "flex", justifyContent: "center", mt: 4 }, children: /* @__PURE__ */ jsx(
1225
+ Pagination,
1226
+ {
1227
+ count: pagination.totalPackets,
1228
+ page: pagination.currentPacket,
1229
+ onChange: handlePacketChange,
1230
+ color: "primary"
1231
+ }
1232
+ ) })
1233
+ ] });
1145
1234
  };
1146
1235
  var ResultsContainer_default = ResultsContainer;
1147
1236
  var ScrollableResultsList = ({
@@ -1159,21 +1248,14 @@ var TablesScrollableList = ({
1159
1248
  results,
1160
1249
  tags,
1161
1250
  maxHeight,
1162
- onResultClick,
1163
- sortBy = "availability"
1251
+ onResultClick
1164
1252
  }) => {
1165
1253
  const tables = (results || []).filter((r) => (r == null ? void 0 : r.type) === "table");
1166
- const getAvailableSlots = (r) => {
1167
- const capacity = typeof r.capacity === "number" ? r.capacity : 0;
1168
- const playersCount = typeof r.numPlayers === "number" ? r.numPlayers : 0;
1169
- return Math.max(capacity - playersCount, 0);
1170
- };
1171
- const sortedTables = sortBy === "availability" ? [...tables].sort((a, b) => getAvailableSlots(b) - getAvailableSlots(a)) : tables;
1172
1254
  const handleClick = (id) => onResultClick == null ? void 0 : onResultClick(id);
1173
1255
  return /* @__PURE__ */ jsx(
1174
1256
  ScrollableResultsList_default,
1175
1257
  {
1176
- results: sortedTables,
1258
+ results: tables,
1177
1259
  tags,
1178
1260
  maxHeight,
1179
1261
  onResultClick: (id, type) => {
@@ -1189,10 +1271,10 @@ var EventTablesCard = ({
1189
1271
  maxHeight = 450,
1190
1272
  onTableClick
1191
1273
  }) => {
1192
- return /* @__PURE__ */ jsxs(Card4, { elevation: 6, sx: { width: "100%", boxShadow: "0px 8px 24px rgba(0, 0, 0, 0.15)" }, children: [
1274
+ return /* @__PURE__ */ jsxs(Card3, { elevation: 6, sx: { width: "100%", boxShadow: "0px 8px 24px rgba(0, 0, 0, 0.15)" }, children: [
1193
1275
  /* @__PURE__ */ jsx(CardHeader, { title: "Tables" }),
1194
1276
  /* @__PURE__ */ jsx(Divider, {}),
1195
- /* @__PURE__ */ jsx(CardContent4, { children: /* @__PURE__ */ jsx(TablesScrollableList_default, { results: tables, tags, maxHeight, onResultClick: onTableClick, sortBy: "availability" }) })
1277
+ /* @__PURE__ */ jsx(CardContent3, { children: /* @__PURE__ */ jsx(TablesScrollableList_default, { results: tables, tags, maxHeight, onResultClick: onTableClick }) })
1196
1278
  ] });
1197
1279
  };
1198
1280
  var EventTablesCard_default = EventTablesCard;