@mbpockets/shared-ui 0.1.19 → 0.1.20

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.
@@ -1,15 +1,281 @@
1
1
  "use client";
2
- import { useState, useMemo } from 'react';
2
+ import { Card, CardContent, Typography, CardMedia, CardHeader, TextField, useTheme, useMediaQuery, NoSsr, Box, Grid } from '@mui/material';
3
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
+ import { useState, useEffect, useMemo } from 'react';
3
5
  import Autocomplete from '@mui/material/Autocomplete';
4
- import Card from '@mui/material/Card';
5
- import CardContent from '@mui/material/CardContent';
6
- import CardHeader from '@mui/material/CardHeader';
7
- import Grid from '@mui/material/Grid';
8
6
  import Popper from '@mui/material/Popper';
9
- import TextField from '@mui/material/TextField';
10
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
11
7
 
12
- // src/components/shared/TagEditor.tsx
8
+ // src/components/PlayerPage/PlayerDetailsCard.tsx
9
+ var PlayerDetailsCard = ({
10
+ preferredPronouns,
11
+ age,
12
+ yearsPlaying,
13
+ discordUsername,
14
+ preferredGames
15
+ }) => {
16
+ return /* @__PURE__ */ jsxs(
17
+ Card,
18
+ {
19
+ sx: {
20
+ margin: "1rem",
21
+ background: "linear-gradient(135deg, rgba(25, 118, 210, 0.8), rgba(25, 118, 210, 1))",
22
+ // Primary Blue Gradient
23
+ boxShadow: "0px 8px 15px rgba(25, 118, 210, 0.3)",
24
+ // Deep shadow based on the color
25
+ borderRadius: "12px",
26
+ // Rounded corners
27
+ color: "#FFFFFF",
28
+ // White as the base text color for contrast
29
+ position: "relative",
30
+ overflow: "hidden"
31
+ // Ensures clean edges
32
+ },
33
+ className: "transition duration-300 transform hover:scale-105 hover:shadow-2xl",
34
+ children: [
35
+ /* @__PURE__ */ jsx(
36
+ "div",
37
+ {
38
+ className: "absolute inset-0 bg-gradient-to-t from-white/10 to-transparent opacity-60",
39
+ "aria-hidden": "true"
40
+ }
41
+ ),
42
+ /* @__PURE__ */ jsxs(CardContent, { className: "relative p-6", children: [
43
+ /* @__PURE__ */ jsx(
44
+ Typography,
45
+ {
46
+ variant: "h5",
47
+ className: "font-bold uppercase text-center tracking-wide mb-4",
48
+ sx: {
49
+ color: "#FFFFFF",
50
+ // Bright white for high contrast
51
+ textShadow: "0px 4px 8px rgba(0, 0, 0, 0.5)",
52
+ // Stronger shadow for bold presence
53
+ fontSize: "1.5rem"
54
+ // Slightly larger title size
55
+ },
56
+ children: "Player Details"
57
+ }
58
+ ),
59
+ /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
60
+ preferredPronouns && /* @__PURE__ */ jsxs(
61
+ Typography,
62
+ {
63
+ variant: "body2",
64
+ className: "text-sm font-medium",
65
+ sx: {
66
+ color: "#FFFFFF",
67
+ textShadow: "0px 2px 6px rgba(0, 0, 0, 0.5)",
68
+ fontWeight: "bold"
69
+ },
70
+ children: [
71
+ /* @__PURE__ */ jsx("span", { className: "font-extrabold text-cyan-300", children: "Preferred Pronouns:" }),
72
+ " ",
73
+ preferredPronouns
74
+ ]
75
+ }
76
+ ),
77
+ age !== null && /* @__PURE__ */ jsxs(
78
+ Typography,
79
+ {
80
+ variant: "body2",
81
+ className: "text-sm font-medium",
82
+ sx: {
83
+ color: "#FFFFFF",
84
+ textShadow: "0px 2px 6px rgba(0, 0, 0, 0.5)",
85
+ fontWeight: "bold"
86
+ },
87
+ children: [
88
+ /* @__PURE__ */ jsx("span", { className: "font-extrabold text-cyan-300", children: "Age:" }),
89
+ " ",
90
+ age
91
+ ]
92
+ }
93
+ ),
94
+ yearsPlaying !== null && /* @__PURE__ */ jsxs(
95
+ Typography,
96
+ {
97
+ variant: "body2",
98
+ className: "text-sm font-medium",
99
+ sx: {
100
+ color: "#FFFFFF",
101
+ textShadow: "0px 2px 6px rgba(0, 0, 0, 0.5)",
102
+ fontWeight: "bold"
103
+ },
104
+ children: [
105
+ /* @__PURE__ */ jsx("span", { className: "font-extrabold text-cyan-300", children: "Years Playing:" }),
106
+ " ",
107
+ yearsPlaying
108
+ ]
109
+ }
110
+ ),
111
+ discordUsername && /* @__PURE__ */ jsxs(
112
+ Typography,
113
+ {
114
+ variant: "body2",
115
+ className: "text-sm font-medium",
116
+ sx: {
117
+ color: "#FFFFFF",
118
+ textShadow: "0px 2px 6px rgba(0, 0, 0, 0.5)",
119
+ fontWeight: "bold"
120
+ },
121
+ children: [
122
+ /* @__PURE__ */ jsx("span", { className: "font-extrabold text-cyan-300", children: "Discord Username:" }),
123
+ " ",
124
+ discordUsername
125
+ ]
126
+ }
127
+ ),
128
+ preferredGames && /* @__PURE__ */ jsxs(
129
+ Typography,
130
+ {
131
+ variant: "body2",
132
+ className: "text-sm font-medium",
133
+ sx: {
134
+ color: "#FFFFFF",
135
+ textShadow: "0px 2px 6px rgba(0, 0, 0, 0.5)",
136
+ fontWeight: "bold"
137
+ },
138
+ children: [
139
+ /* @__PURE__ */ jsx("span", { className: "font-extrabold text-cyan-300", children: "Preferred Games:" }),
140
+ " ",
141
+ Array.isArray(preferredGames) ? preferredGames.join(", ") : preferredGames
142
+ ]
143
+ }
144
+ )
145
+ ] }),
146
+ /* @__PURE__ */ jsx("div", { className: "mt-6 text-center", children: /* @__PURE__ */ jsx(
147
+ Typography,
148
+ {
149
+ variant: "caption",
150
+ className: "text-xs italic",
151
+ sx: {
152
+ color: "#BBDEFB",
153
+ // Subtle light blue for footer text
154
+ textShadow: "0px 1px 3px rgba(0, 0, 0, 0.2)"
155
+ },
156
+ children: "All information is player-submitted."
157
+ }
158
+ ) })
159
+ ] })
160
+ ]
161
+ }
162
+ );
163
+ };
164
+ var PlayerDetailsCard_default = PlayerDetailsCard;
165
+
166
+ // src/data/values.tsx
167
+ var ProfilePictureSettings = {
168
+ aspectRatio: 4 / 5};
169
+ var PlayerDisplayCard = ({ profilePicture, username, bio, preferredPronouns }) => {
170
+ const defaultImg = "/man-walking-silhouette-clipart.jpg";
171
+ const [imageSrc, setImageSrc] = useState(defaultImg);
172
+ const { aspectRatio } = ProfilePictureSettings;
173
+ useEffect(() => {
174
+ async function validateImage() {
175
+ const newImage = profilePicture || defaultImg;
176
+ if (!profilePicture) {
177
+ setImageSrc(defaultImg);
178
+ return;
179
+ }
180
+ const img = new Image();
181
+ img.src = newImage;
182
+ img.onload = () => {
183
+ setImageSrc(newImage);
184
+ };
185
+ img.onerror = () => {
186
+ setImageSrc(defaultImg);
187
+ };
188
+ }
189
+ validateImage();
190
+ }, [profilePicture]);
191
+ return /* @__PURE__ */ jsxs(
192
+ Card,
193
+ {
194
+ sx: {
195
+ margin: "1rem",
196
+ background: "linear-gradient(135deg, rgba(25, 118, 210, 0.8), rgba(25, 118, 210, 1))",
197
+ // Vibrant blue gradient
198
+ boxShadow: "0px 8px 15px rgba(25, 118, 210, 0.3)",
199
+ // Blue shadow to add depth
200
+ borderRadius: "12px",
201
+ // Smooth rounded corners
202
+ color: "#FFFFFF",
203
+ // White text for high contrast
204
+ overflow: "hidden"
205
+ // Clean edges
206
+ },
207
+ className: "transition duration-300 transform hover:scale-105 hover:shadow-2xl",
208
+ children: [
209
+ /* @__PURE__ */ jsx(
210
+ CardMedia,
211
+ {
212
+ component: "img",
213
+ image: imageSrc,
214
+ alt: `${username}'s Profile Picture`,
215
+ sx: {
216
+ aspectRatio,
217
+ height: "auto",
218
+ // Updates to maintain aspect ratio and fill space nicely
219
+ width: "100%",
220
+ objectFit: "cover"
221
+ }
222
+ }
223
+ ),
224
+ /* @__PURE__ */ jsxs(CardContent, { className: "relative p-6", children: [
225
+ /* @__PURE__ */ jsx(
226
+ Typography,
227
+ {
228
+ variant: "h5",
229
+ component: "div",
230
+ className: "font-bold text-lg uppercase text-center tracking-wide mb-2",
231
+ sx: {
232
+ color: "#FFFFFF",
233
+ // Pure white for username
234
+ fontSize: "1.5rem",
235
+ textShadow: "0px 3px 6px rgba(0, 0, 0, 0.5)"
236
+ // Strong shadow for visibility
237
+ },
238
+ children: username
239
+ }
240
+ ),
241
+ preferredPronouns && /* @__PURE__ */ jsx(
242
+ Typography,
243
+ {
244
+ variant: "body2",
245
+ className: "text-sm font-medium",
246
+ sx: {
247
+ color: "#E3F2FD",
248
+ textShadow: "0px 2px 4px rgba(0, 0, 0, 0.3)",
249
+ // Subtle shadow for readability
250
+ fontWeight: "bold",
251
+ // Emphasize key details
252
+ marginBottom: "1rem"
253
+ },
254
+ children: preferredPronouns
255
+ }
256
+ ),
257
+ bio && /* @__PURE__ */ jsx(
258
+ Typography,
259
+ {
260
+ variant: "body2",
261
+ className: "text-sm font-light",
262
+ sx: {
263
+ color: "#E3F2FD",
264
+ // Softer muted tone for secondary text
265
+ textShadow: "0px 2px 4px rgba(0, 0, 0, 0.3)",
266
+ // Subtle shadow for readability
267
+ fontStyle: "italic"
268
+ // Distinguish bio visually
269
+ },
270
+ children: bio
271
+ }
272
+ )
273
+ ] })
274
+ ]
275
+ }
276
+ );
277
+ };
278
+ var PlayerDisplayCard_default = PlayerDisplayCard;
13
279
  function Chip({ tag, removeCallback }) {
14
280
  var _a;
15
281
  const color = (_a = tag.color) != null ? _a : "#bfbcbb";
@@ -42,33 +308,127 @@ function Chip({ tag, removeCallback }) {
42
308
  tag.id
43
309
  ) });
44
310
  }
45
- function TagEditor({
46
- title = "Tags",
47
- selectedTags,
48
- possibleTags,
311
+ var PlayerTagsCard = ({ tags = [] }) => {
312
+ return /* @__PURE__ */ jsxs(Card, { sx: {
313
+ margin: "1rem",
314
+ borderRadius: "12px",
315
+ boxShadow: "0px 8px 15px rgba(25, 118, 210, 0.3)",
316
+ overflow: "hidden"
317
+ }, className: "transition duration-300 transform hover:scale-105 hover:shadow-2xl", children: [
318
+ /* @__PURE__ */ jsx(
319
+ CardHeader,
320
+ {
321
+ title: "Player Tags",
322
+ sx: {
323
+ background: "linear-gradient(135deg, rgba(25, 118, 210, 0.8), rgba(25, 118, 210, 1))",
324
+ color: "#FFFFFF",
325
+ fontSize: "1.5rem",
326
+ textShadow: "0px 3px 6px rgba(0, 0, 0, 0.5)",
327
+ "& .MuiCardHeader-title": {
328
+ fontWeight: "bold",
329
+ fontSize: "1.5rem",
330
+ textAlign: "center",
331
+ textTransform: "uppercase",
332
+ letterSpacing: "0.05em"
333
+ }
334
+ }
335
+ }
336
+ ),
337
+ /* @__PURE__ */ jsx(CardContent, { className: "p-6", children: /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: tags.map((tag) => /* @__PURE__ */ jsx(Chip, { tag }, tag.id)) }) })
338
+ ] });
339
+ };
340
+ var PlayerTagsCard_default = PlayerTagsCard;
341
+ var PlayerPromptCard = ({ title, description }) => /* @__PURE__ */ jsx(
342
+ Card,
343
+ {
344
+ sx: {
345
+ margin: "1rem",
346
+ background: "linear-gradient(135deg, rgba(25, 118, 210, 0.8), rgba(25, 118, 210, 1))",
347
+ // Gradient color scheme
348
+ boxShadow: "0px 8px 15px rgba(25, 118, 210, 0.3)",
349
+ // Card shadow
350
+ borderRadius: "12px",
351
+ // Rounded corners
352
+ color: "#FFFFFF",
353
+ // Text contrast with the background
354
+ overflow: "hidden"
355
+ // Keeps consistent and clean card shape
356
+ },
357
+ className: "transition duration-300 transform hover:scale-105 hover:shadow-2xl",
358
+ children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
359
+ title && /* @__PURE__ */ jsx(
360
+ Typography,
361
+ {
362
+ variant: "h5",
363
+ className: "font-bold text-lg uppercase text-center tracking-wide mb-4",
364
+ sx: {
365
+ color: "#FFFFFF",
366
+ // Bright white for high visibility
367
+ textShadow: "0px 3px 6px rgba(0, 0, 0, 0.5)",
368
+ // Strong text shadow for contrast
369
+ fontSize: "1.5rem"
370
+ },
371
+ children: title
372
+ }
373
+ ),
374
+ description && /* @__PURE__ */ jsx(
375
+ Typography,
376
+ {
377
+ variant: "body2",
378
+ className: "text-sm font-medium text-center",
379
+ sx: {
380
+ color: "#E3F2FD",
381
+ // Softer light blue for description
382
+ textShadow: "0px 2px 4px rgba(0, 0, 0, 0.3)",
383
+ // Subtle shadow
384
+ lineHeight: 1.6,
385
+ marginTop: "1rem"
386
+ },
387
+ children: description
388
+ }
389
+ )
390
+ ] })
391
+ }
392
+ );
393
+ var PlayerPromptCard_default = PlayerPromptCard;
394
+ var PlayerTagsEdit = ({
395
+ selectedTags = [],
396
+ possibleTags = [],
49
397
  onToggleTag
50
- }) {
398
+ }) => {
51
399
  const [inputValue, setInputValue] = useState("");
52
400
  const selectedIds = useMemo(() => selectedTags.map((tag) => tag.id), [selectedTags]);
53
401
  const options = useMemo(
54
- () => possibleTags.map((tag) => ({ value: tag.id, label: tag.label })),
402
+ () => possibleTags.map((tag) => ({ value: tag.id, label: tag.label, alternate_title: tag.alternate_title })),
55
403
  [possibleTags]
56
404
  );
57
- return /* @__PURE__ */ jsx(Grid, { container: true, children: /* @__PURE__ */ jsx(Grid, { size: { xs: 12 }, children: /* @__PURE__ */ jsxs(Card, { children: [
405
+ return /* @__PURE__ */ jsxs(Card, { sx: {
406
+ margin: "1rem",
407
+ borderRadius: "12px",
408
+ boxShadow: "0px 8px 15px rgba(25, 118, 210, 0.3)",
409
+ overflow: "hidden"
410
+ }, children: [
58
411
  /* @__PURE__ */ jsx(
59
412
  CardHeader,
60
413
  {
61
- title,
62
- style: {
414
+ title: "Player Tags",
415
+ sx: {
63
416
  background: "linear-gradient(135deg, rgba(25, 118, 210, 0.8), rgba(25, 118, 210, 1))",
64
417
  color: "#FFFFFF",
65
418
  fontSize: "1.5rem",
66
- textShadow: "0px 3px 6px rgba(0, 0, 0, 0.5)"
419
+ textShadow: "0px 3px 6px rgba(0, 0, 0, 0.5)",
420
+ "& .MuiCardHeader-title": {
421
+ fontWeight: "bold",
422
+ fontSize: "1.5rem",
423
+ textAlign: "center",
424
+ textTransform: "uppercase",
425
+ letterSpacing: "0.05em"
426
+ }
67
427
  }
68
428
  }
69
429
  ),
70
- /* @__PURE__ */ jsxs(CardContent, { children: [
71
- /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: selectedTags.map((tag) => /* @__PURE__ */ jsx(
430
+ /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
431
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2 mb-4", children: selectedTags.map((tag) => /* @__PURE__ */ jsx(
72
432
  Chip,
73
433
  {
74
434
  tag,
@@ -76,13 +436,19 @@ function TagEditor({
76
436
  },
77
437
  tag.id
78
438
  )) }),
79
- /* @__PURE__ */ jsx(Grid, { container: true, spacing: 3, children: /* @__PURE__ */ jsx(Grid, { sx: { marginTop: 3, width: "100%" }, children: /* @__PURE__ */ jsx(
439
+ /* @__PURE__ */ jsx(
80
440
  Autocomplete,
81
441
  {
82
442
  options,
83
- filterOptions: (availableOptions, state) => availableOptions.filter(
84
- (option) => !selectedIds.includes(option.value) && option.label.toLowerCase().includes(state.inputValue.toLowerCase())
85
- ).slice(0, 3),
443
+ filterOptions: (availableOptions, state) => {
444
+ const query = state.inputValue.toLowerCase();
445
+ return availableOptions.filter(
446
+ (option) => {
447
+ var _a;
448
+ return !selectedIds.includes(option.value) && (option.label.toLowerCase().includes(query) || ((_a = option.alternate_title) == null ? void 0 : _a.some((title) => title.toLowerCase().includes(query))));
449
+ }
450
+ ).slice(0, 5);
451
+ },
86
452
  value: null,
87
453
  inputValue,
88
454
  onInputChange: (event, newInputValue) => {
@@ -97,13 +463,20 @@ function TagEditor({
97
463
  setInputValue("");
98
464
  },
99
465
  slots: { popper: CustomPopper },
100
- renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, label: "Select Tags" })
466
+ renderInput: (params) => /* @__PURE__ */ jsx(
467
+ TextField,
468
+ {
469
+ ...params,
470
+ label: "Select Tags",
471
+ variant: "outlined"
472
+ }
473
+ )
101
474
  },
102
475
  selectedIds.join("-")
103
- ) }) })
476
+ )
104
477
  ] })
105
- ] }) }) });
106
- }
478
+ ] });
479
+ };
107
480
  var CustomPopper = (props) => {
108
481
  return /* @__PURE__ */ jsx(
109
482
  Popper,
@@ -112,29 +485,86 @@ var CustomPopper = (props) => {
112
485
  modifiers: [
113
486
  {
114
487
  name: "preventOverflow",
115
- options: { boundary: "viewport" }
488
+ options: {
489
+ boundary: "viewport"
490
+ }
116
491
  },
117
492
  {
118
493
  name: "offset",
119
- options: { offset: [0, -10] }
494
+ options: {
495
+ offset: [0, -10]
496
+ }
120
497
  }
121
498
  ],
122
499
  placement: "top-start"
123
500
  }
124
501
  );
125
502
  };
126
- function PlayerTagsEdit(props) {
127
- return /* @__PURE__ */ jsx(
128
- TagEditor,
503
+ var PlayerTagsEdit_default = PlayerTagsEdit;
504
+ function PlayerPageLayout({
505
+ playerData,
506
+ tags = [],
507
+ blurbs = [],
508
+ isOwner = false,
509
+ possibleTags = [],
510
+ onToggleTag = () => {
511
+ }
512
+ }) {
513
+ const theme = useTheme();
514
+ const isSmallScreen = useMediaQuery(theme.breakpoints.down("lg"));
515
+ const tagsElement = isOwner ? /* @__PURE__ */ jsx(
516
+ PlayerTagsEdit_default,
129
517
  {
130
- title: "Player Tags",
131
- selectedTags: props.PlayerTags,
132
- possibleTags: props.possibleTags,
133
- onToggleTag: props.updatePlayerTags
518
+ selectedTags: tags,
519
+ possibleTags,
520
+ onToggleTag
134
521
  }
135
- );
522
+ ) : /* @__PURE__ */ jsx(PlayerTagsCard_default, { tags });
523
+ return /* @__PURE__ */ jsx(NoSsr, { children: /* @__PURE__ */ jsx(Box, { sx: { padding: "2rem", marginRight: "auto", marginLeft: "auto" }, justifyContent: "center", children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 3, justifyContent: "center", sx: { marginRight: "auto", marginLeft: "auto" }, children: [
524
+ !isSmallScreen && /* @__PURE__ */ jsxs(Grid, { size: { xs: 12, lg: 3 }, children: [
525
+ /* @__PURE__ */ jsx(
526
+ PlayerDetailsCard_default,
527
+ {
528
+ preferredPronouns: playerData.preferredPronouns,
529
+ age: playerData.age,
530
+ yearsPlaying: playerData.yearsPlaying,
531
+ discordUsername: playerData.discordUsername,
532
+ preferredGames: playerData.preferredGames
533
+ }
534
+ ),
535
+ tagsElement
536
+ ] }),
537
+ /* @__PURE__ */ jsx(Grid, { size: { xs: 12, lg: 6 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 3, children: [
538
+ /* @__PURE__ */ jsx(Grid, { size: { xs: 12, lg: 8 }, children: /* @__PURE__ */ jsx(
539
+ PlayerDisplayCard_default,
540
+ {
541
+ profilePicture: playerData.profilePicture,
542
+ username: playerData.username,
543
+ bio: playerData.bio,
544
+ preferredPronouns: playerData.preferredPronouns
545
+ }
546
+ ) }),
547
+ isSmallScreen && /* @__PURE__ */ jsx(Grid, { size: { xs: 12, lg: 3 }, children: /* @__PURE__ */ jsx(
548
+ PlayerDetailsCard_default,
549
+ {
550
+ preferredPronouns: playerData.preferredPronouns,
551
+ age: playerData.age,
552
+ yearsPlaying: playerData.yearsPlaying,
553
+ discordUsername: playerData.discordUsername,
554
+ preferredGames: playerData.preferredGames
555
+ }
556
+ ) }),
557
+ blurbs.map((blurb, index) => /* @__PURE__ */ jsx(Grid, { size: { xs: 12, lg: 8 }, children: /* @__PURE__ */ jsx(
558
+ PlayerPromptCard_default,
559
+ {
560
+ title: blurb.title,
561
+ description: blurb.description
562
+ }
563
+ ) }, index))
564
+ ] }) })
565
+ ] }) }) });
136
566
  }
137
567
 
138
- export { PlayerTagsEdit };
568
+ export { PlayerDetailsCard_default as PlayerDetailsCard, PlayerDisplayCard_default as PlayerDisplayCard, PlayerPageLayout, PlayerPromptCard_default as PlayerPromptCard, PlayerTagsCard_default as PlayerTagsCard, PlayerTagsEdit_default as PlayerTagsEdit };
139
569
  //# sourceMappingURL=ProfilePage.mjs.map
140
570
  //# sourceMappingURL=ProfilePage.mjs.map