@mbpockets/shared-ui 0.1.20 → 0.2.0

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 (125) hide show
  1. package/dist/EventPage/index.cjs +208 -121
  2. package/dist/EventPage/index.cjs.map +1 -1
  3. package/dist/EventPage/index.mjs +200 -119
  4. package/dist/EventPage/index.mjs.map +1 -1
  5. package/dist/EventPage.cjs +208 -121
  6. package/dist/EventPage.cjs.map +1 -1
  7. package/dist/EventPage.mjs +200 -119
  8. package/dist/EventPage.mjs.map +1 -1
  9. package/dist/PlayerPage/index.cjs.map +1 -1
  10. package/dist/PlayerPage/index.mjs.map +1 -1
  11. package/dist/PlayerPage.cjs.map +1 -1
  12. package/dist/PlayerPage.mjs.map +1 -1
  13. package/dist/ProfilePage/index.cjs.map +1 -1
  14. package/dist/ProfilePage/index.mjs.map +1 -1
  15. package/dist/ProfilePage.cjs.map +1 -1
  16. package/dist/ProfilePage.mjs.map +1 -1
  17. package/dist/SearchPage/Filters/index.cjs +149 -43
  18. package/dist/SearchPage/Filters/index.cjs.map +1 -1
  19. package/dist/SearchPage/Filters/index.d.cts +1 -2
  20. package/dist/SearchPage/Filters/index.d.ts +1 -2
  21. package/dist/SearchPage/Filters/index.mjs +146 -42
  22. package/dist/SearchPage/Filters/index.mjs.map +1 -1
  23. package/dist/SearchPage/Filters.cjs +149 -43
  24. package/dist/SearchPage/Filters.cjs.map +1 -1
  25. package/dist/SearchPage/Filters.d.cts +38 -3
  26. package/dist/SearchPage/Filters.d.ts +38 -3
  27. package/dist/SearchPage/Filters.mjs +146 -42
  28. package/dist/SearchPage/Filters.mjs.map +1 -1
  29. package/dist/SearchPage/Results/index.cjs +138 -67
  30. package/dist/SearchPage/Results/index.cjs.map +1 -1
  31. package/dist/SearchPage/Results/index.mjs +126 -63
  32. package/dist/SearchPage/Results/index.mjs.map +1 -1
  33. package/dist/SearchPage/Results.cjs +138 -67
  34. package/dist/SearchPage/Results.cjs.map +1 -1
  35. package/dist/SearchPage/Results.d.cts +21 -12
  36. package/dist/SearchPage/Results.d.ts +21 -12
  37. package/dist/SearchPage/Results.mjs +126 -63
  38. package/dist/SearchPage/Results.mjs.map +1 -1
  39. package/dist/SearchPage/index.cjs +495 -221
  40. package/dist/SearchPage/index.cjs.map +1 -1
  41. package/dist/SearchPage/index.d.cts +1 -1
  42. package/dist/SearchPage/index.d.ts +1 -1
  43. package/dist/SearchPage/index.mjs +482 -216
  44. package/dist/SearchPage/index.mjs.map +1 -1
  45. package/dist/SearchPage.cjs +495 -221
  46. package/dist/SearchPage.cjs.map +1 -1
  47. package/dist/SearchPage.d.cts +78 -7
  48. package/dist/SearchPage.d.ts +78 -7
  49. package/dist/SearchPage.mjs +482 -216
  50. package/dist/SearchPage.mjs.map +1 -1
  51. package/dist/TablePage/index.cjs +10 -1
  52. package/dist/TablePage/index.cjs.map +1 -1
  53. package/dist/TablePage/index.d.cts +2 -2
  54. package/dist/TablePage/index.d.ts +2 -2
  55. package/dist/TablePage/index.mjs +10 -2
  56. package/dist/TablePage/index.mjs.map +1 -1
  57. package/dist/TablePage.cjs +10 -1
  58. package/dist/TablePage.cjs.map +1 -1
  59. package/dist/TablePage.d.cts +7 -2
  60. package/dist/TablePage.d.ts +7 -2
  61. package/dist/TablePage.mjs +10 -2
  62. package/dist/TablePage.mjs.map +1 -1
  63. package/dist/index.cjs +446 -178
  64. package/dist/index.cjs.map +1 -1
  65. package/dist/index.d.cts +3 -3
  66. package/dist/index.d.ts +3 -3
  67. package/dist/index.mjs +434 -175
  68. package/dist/index.mjs.map +1 -1
  69. package/dist/mocks/SearchResults.cjs +22 -15
  70. package/dist/mocks/SearchResults.cjs.map +1 -1
  71. package/dist/mocks/SearchResults.d.cts +3 -15
  72. package/dist/mocks/SearchResults.d.ts +3 -15
  73. package/dist/mocks/SearchResults.mjs +22 -15
  74. package/dist/mocks/SearchResults.mjs.map +1 -1
  75. package/dist/mocks/index.cjs +22 -15
  76. package/dist/mocks/index.cjs.map +1 -1
  77. package/dist/mocks/index.d.cts +2 -1
  78. package/dist/mocks/index.d.ts +2 -1
  79. package/dist/mocks/index.mjs +22 -15
  80. package/dist/mocks/index.mjs.map +1 -1
  81. package/dist/mocks.cjs +22 -15
  82. package/dist/mocks.cjs.map +1 -1
  83. package/dist/mocks.d.cts +2 -1
  84. package/dist/mocks.d.ts +2 -1
  85. package/dist/mocks.mjs +22 -15
  86. package/dist/mocks.mjs.map +1 -1
  87. package/dist/{common → shared}/index.cjs.map +1 -1
  88. package/dist/{common → shared}/index.d.cts +1 -1
  89. package/dist/{common → shared}/index.d.ts +1 -1
  90. package/dist/{common → shared}/index.mjs.map +1 -1
  91. package/dist/{common.cjs → shared.cjs} +2 -2
  92. package/dist/{common.cjs.map → shared.cjs.map} +1 -1
  93. package/dist/{common.css → shared.css} +1 -1
  94. package/dist/{common.mjs → shared.mjs} +2 -2
  95. package/dist/{common.mjs.map → shared.mjs.map} +1 -1
  96. package/dist/types/index.d.cts +1 -1
  97. package/dist/types/index.d.ts +1 -1
  98. package/dist/types/search.d.cts +23 -1
  99. package/dist/types/search.d.ts +23 -1
  100. package/dist/types.d.cts +1 -1
  101. package/dist/types.d.ts +1 -1
  102. package/package.json +1 -1
  103. /package/dist/{common → shared}/Modal/index.cjs +0 -0
  104. /package/dist/{common → shared}/Modal/index.cjs.map +0 -0
  105. /package/dist/{common → shared}/Modal/index.css +0 -0
  106. /package/dist/{common → shared}/Modal/index.css.map +0 -0
  107. /package/dist/{common → shared}/Modal/index.d.cts +0 -0
  108. /package/dist/{common → shared}/Modal/index.d.ts +0 -0
  109. /package/dist/{common → shared}/Modal/index.mjs +0 -0
  110. /package/dist/{common → shared}/Modal/index.mjs.map +0 -0
  111. /package/dist/{common → shared}/Modal.cjs +0 -0
  112. /package/dist/{common → shared}/Modal.cjs.map +0 -0
  113. /package/dist/{common → shared}/Modal.css +0 -0
  114. /package/dist/{common → shared}/Modal.css.map +0 -0
  115. /package/dist/{common → shared}/Modal.d.cts +0 -0
  116. /package/dist/{common → shared}/Modal.d.ts +0 -0
  117. /package/dist/{common → shared}/Modal.mjs +0 -0
  118. /package/dist/{common → shared}/Modal.mjs.map +0 -0
  119. /package/dist/{common → shared}/index.cjs +0 -0
  120. /package/dist/{common → shared}/index.css +0 -0
  121. /package/dist/{common → shared}/index.css.map +0 -0
  122. /package/dist/{common → shared}/index.mjs +0 -0
  123. /package/dist/{common.css.map → shared.css.map} +0 -0
  124. /package/dist/{common.d.cts → shared.d.cts} +0 -0
  125. /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,21 @@ 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
+ const text = full || "";
983
+ return text.length > 200 ? `${text.slice(0, 200).trimEnd()}...` : text;
984
+ })() }) : /* @__PURE__ */ jsx(Typography4, { variant: "body1", children: result.description }),
985
+ result.tags && result.tags.length > 0 && /* @__PURE__ */ jsx(Box2, { sx: { mt: 1, display: "flex", flexWrap: "wrap", gap: 1 }, children: renderTagsFromIds(result.tags, tags) })
986
986
  ] })
987
987
  ] })
988
988
  }
@@ -1037,21 +1037,60 @@ var PlayerResultCard = ({
1037
1037
  return /* @__PURE__ */ jsx(BaseSearchResultCard_default, { result, onClick, icon: playerIcon, tags });
1038
1038
  };
1039
1039
  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
1040
+ var TableResultCard = ({
1041
+ result,
1042
+ onClick,
1043
+ tags
1044
+ }) => {
1045
+ const rawCapacity = result.capacity;
1046
+ const hasDefinedCapacity = typeof rawCapacity === "number" && Number.isFinite(rawCapacity) && rawCapacity > 0;
1047
+ const capacity = hasDefinedCapacity ? rawCapacity : 0;
1048
+ const activePlayers = typeof result.numPlayers === "number" ? result.numPlayers : 0;
1049
+ const availableSlots = Math.max(capacity - activePlayers, 0);
1050
+ const hasDM = typeof result.hasDM === "boolean" ? result.hasDM : Boolean(result.dungeonMaster);
1051
+ const occupancyPercentage = hasDefinedCapacity ? activePlayers / capacity * 100 : 100;
1052
+ const tableIcon = /* @__PURE__ */ jsx(
1053
+ TableRestaurantIcon,
1054
+ {
1055
+ sx: {
1056
+ fontSize: 40,
1057
+ color: "primary.main"
1058
+ }
1059
+ }
1060
+ );
1061
+ return /* @__PURE__ */ jsx(BaseSearchResultCard_default, { result, onClick, icon: tableIcon, tags, children: /* @__PURE__ */ jsxs(Box2, { sx: { mb: 2 }, children: [
1062
+ /* @__PURE__ */ jsxs(Box2, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 1 }, children: [
1063
+ /* @__PURE__ */ jsxs(Typography4, { variant: "body2", children: [
1064
+ /* @__PURE__ */ jsx("strong", { children: "Players:" }),
1065
+ " ",
1066
+ hasDefinedCapacity ? `${activePlayers}/${capacity}` : activePlayers
1051
1067
  ] }),
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" })
1068
+ typeof hasDM === "boolean" && /* @__PURE__ */ jsx(
1069
+ Chip2,
1070
+ {
1071
+ icon: hasDM ? /* @__PURE__ */ jsx(SupervisorAccountIcon, {}) : /* @__PURE__ */ jsx(PersonIcon, {}),
1072
+ label: hasDM ? "DM Present" : "No DM",
1073
+ color: hasDM ? "success" : "warning",
1074
+ size: "small"
1075
+ }
1076
+ )
1053
1077
  ] }),
1054
- /* @__PURE__ */ jsx(LinearProgress, { variant: "determinate", value: occupancy, sx: { height: 8, borderRadius: 4 } })
1078
+ /* @__PURE__ */ jsx(
1079
+ LinearProgress,
1080
+ {
1081
+ variant: "determinate",
1082
+ value: occupancyPercentage,
1083
+ sx: {
1084
+ height: 10,
1085
+ borderRadius: 5,
1086
+ backgroundColor: "#e0e0e0",
1087
+ "& .MuiLinearProgress-bar": {
1088
+ backgroundColor: hasDefinedCapacity ? availableSlots > 0 ? "#4caf50" : "#f44336" : "#2196f3"
1089
+ }
1090
+ }
1091
+ }
1092
+ ),
1093
+ hasDefinedCapacity && /* @__PURE__ */ jsx(Typography4, { variant: "body2", sx: { mt: 0.5, textAlign: "right" }, children: availableSlots > 0 ? `${availableSlots} slot${availableSlots !== 1 ? "s" : ""} available` : "Table full" })
1055
1094
  ] }) });
1056
1095
  };
1057
1096
  var TableResultCard_default = TableResultCard;
@@ -1070,20 +1109,42 @@ var EventResultCard = ({
1070
1109
  try {
1071
1110
  const date = new Date(dateString);
1072
1111
  return date.toLocaleDateString("en-US", options);
1073
- } catch {
1112
+ } catch (error) {
1074
1113
  return dateString;
1075
1114
  }
1076
1115
  };
1077
1116
  const formattedDate = result.date ? formatDate(result.date) : "Date TBD";
1078
1117
  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 })
1118
+ const eventIcon = /* @__PURE__ */ jsx(
1119
+ EventIcon,
1120
+ {
1121
+ sx: {
1122
+ fontSize: 40,
1123
+ color: "primary.main"
1124
+ }
1125
+ }
1126
+ );
1127
+ return /* @__PURE__ */ jsx(BaseSearchResultCard_default, { result, onClick, icon: eventIcon, tags, children: /* @__PURE__ */ jsxs(Box2, { sx: { mb: 2 }, children: [
1128
+ /* @__PURE__ */ jsxs(Box2, { sx: { display: "flex", alignItems: "center", mb: 1 }, children: [
1129
+ /* @__PURE__ */ jsx(CalendarTodayIcon, { sx: { mr: 1, color: "primary.main" } }),
1130
+ /* @__PURE__ */ jsxs(Typography4, { variant: "body2", children: [
1131
+ /* @__PURE__ */ jsx("strong", { children: "Date:" }),
1132
+ " ",
1133
+ formattedDate
1134
+ ] })
1083
1135
  ] }),
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 })
1136
+ /* @__PURE__ */ jsxs(Box2, { sx: { display: "flex", alignItems: "center" }, children: [
1137
+ /* @__PURE__ */ jsx(LocationOnIcon, { sx: { mr: 1, color: "primary.main" } }),
1138
+ /* @__PURE__ */ jsxs(Typography4, { variant: "body2", children: [
1139
+ /* @__PURE__ */ jsx("strong", { children: "Location:" }),
1140
+ " ",
1141
+ location
1142
+ ] })
1143
+ ] }),
1144
+ result.organizer && /* @__PURE__ */ jsxs(Typography4, { variant: "body2", sx: { mt: 1 }, children: [
1145
+ /* @__PURE__ */ jsx("strong", { children: "Organizer:" }),
1146
+ " ",
1147
+ result.organizer
1087
1148
  ] })
1088
1149
  ] }) });
1089
1150
  };
@@ -1091,9 +1152,11 @@ var EventResultCard_default = EventResultCard;
1091
1152
  var ResultsContainer = ({
1092
1153
  results,
1093
1154
  onResultClick,
1094
- tags
1155
+ tags,
1156
+ pagination,
1157
+ onPacketChange
1095
1158
  }) => {
1096
- if (results.length === 0 || !results.map) {
1159
+ if (!results || results.length === 0 || !results.map) {
1097
1160
  return /* @__PURE__ */ jsx(Box2, { sx: { textAlign: "center", py: 4 }, children: "No results found. Try adjusting your filters." });
1098
1161
  }
1099
1162
  const onPlayerClick = (id) => {
@@ -1105,43 +1168,68 @@ var ResultsContainer = ({
1105
1168
  const onEventClick = (id) => {
1106
1169
  onResultClick == null ? void 0 : onResultClick(id, "event");
1107
1170
  };
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
- }) });
1171
+ const handlePacketChange = (_event, packet) => {
1172
+ onPacketChange == null ? void 0 : onPacketChange(packet);
1173
+ };
1174
+ const startResult = pagination ? (pagination.currentPacket - 1) * pagination.packetSize + 1 : 1;
1175
+ const endResult = pagination ? Math.min(pagination.currentPacket * pagination.packetSize, pagination.totalResults) : results.length;
1176
+ return /* @__PURE__ */ jsxs(Box2, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: [
1177
+ pagination && /* @__PURE__ */ jsx(Box2, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 1 }, children: /* @__PURE__ */ jsxs(Typography4, { variant: "body2", color: "text.secondary", children: [
1178
+ "Showing ",
1179
+ startResult,
1180
+ "-",
1181
+ endResult,
1182
+ " of ",
1183
+ pagination.totalResults,
1184
+ " results"
1185
+ ] }) }),
1186
+ results.map((result) => {
1187
+ switch (result.type) {
1188
+ case "player":
1189
+ return /* @__PURE__ */ jsx(
1190
+ PlayerResultCard_default,
1191
+ {
1192
+ result,
1193
+ onClick: onPlayerClick,
1194
+ tags
1195
+ },
1196
+ result.id
1197
+ );
1198
+ case "table":
1199
+ return /* @__PURE__ */ jsx(
1200
+ TableResultCard_default,
1201
+ {
1202
+ result,
1203
+ onClick: onTableClick,
1204
+ tags
1205
+ },
1206
+ result.id
1207
+ );
1208
+ case "event":
1209
+ return /* @__PURE__ */ jsx(
1210
+ EventResultCard_default,
1211
+ {
1212
+ result,
1213
+ onClick: onEventClick,
1214
+ tags
1215
+ },
1216
+ result.id
1217
+ );
1218
+ default:
1219
+ console.error(`Unknown result type: ${result.type}`);
1220
+ return null;
1221
+ }
1222
+ }),
1223
+ pagination && pagination.totalPackets > 1 && /* @__PURE__ */ jsx(Box2, { sx: { display: "flex", justifyContent: "center", mt: 4 }, children: /* @__PURE__ */ jsx(
1224
+ Pagination,
1225
+ {
1226
+ count: pagination.totalPackets,
1227
+ page: pagination.currentPacket,
1228
+ onChange: handlePacketChange,
1229
+ color: "primary"
1230
+ }
1231
+ ) })
1232
+ ] });
1145
1233
  };
1146
1234
  var ResultsContainer_default = ResultsContainer;
1147
1235
  var ScrollableResultsList = ({
@@ -1159,21 +1247,14 @@ var TablesScrollableList = ({
1159
1247
  results,
1160
1248
  tags,
1161
1249
  maxHeight,
1162
- onResultClick,
1163
- sortBy = "availability"
1250
+ onResultClick
1164
1251
  }) => {
1165
1252
  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
1253
  const handleClick = (id) => onResultClick == null ? void 0 : onResultClick(id);
1173
1254
  return /* @__PURE__ */ jsx(
1174
1255
  ScrollableResultsList_default,
1175
1256
  {
1176
- results: sortedTables,
1257
+ results: tables,
1177
1258
  tags,
1178
1259
  maxHeight,
1179
1260
  onResultClick: (id, type) => {
@@ -1189,10 +1270,10 @@ var EventTablesCard = ({
1189
1270
  maxHeight = 450,
1190
1271
  onTableClick
1191
1272
  }) => {
1192
- return /* @__PURE__ */ jsxs(Card4, { elevation: 6, sx: { width: "100%", boxShadow: "0px 8px 24px rgba(0, 0, 0, 0.15)" }, children: [
1273
+ return /* @__PURE__ */ jsxs(Card3, { elevation: 6, sx: { width: "100%", boxShadow: "0px 8px 24px rgba(0, 0, 0, 0.15)" }, children: [
1193
1274
  /* @__PURE__ */ jsx(CardHeader, { title: "Tables" }),
1194
1275
  /* @__PURE__ */ jsx(Divider, {}),
1195
- /* @__PURE__ */ jsx(CardContent4, { children: /* @__PURE__ */ jsx(TablesScrollableList_default, { results: tables, tags, maxHeight, onResultClick: onTableClick, sortBy: "availability" }) })
1276
+ /* @__PURE__ */ jsx(CardContent3, { children: /* @__PURE__ */ jsx(TablesScrollableList_default, { results: tables, tags, maxHeight, onResultClick: onTableClick }) })
1196
1277
  ] });
1197
1278
  };
1198
1279
  var EventTablesCard_default = EventTablesCard;