@articles-media/articles-dev-box 1.0.31 → 1.0.32

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 (51) hide show
  1. package/README.md +11 -3
  2. package/dist/Ad-BsG4C_lR.js +668 -0
  3. package/dist/Ad.js +2 -2
  4. package/dist/AdConfirmExitModal-heFPJNdX.js +55 -0
  5. package/dist/AdDetailsModal-D2-4lh9e.js +107 -0
  6. package/dist/ArticlesAd.js +15 -10
  7. package/dist/Button-DvEZjsVV.js +32 -0
  8. package/dist/CreditsModal.js +51 -35
  9. package/dist/DarkModeHandler.js +21 -13
  10. package/dist/FriendsList.js +49 -47
  11. package/dist/GameMenu-BD1HSDJ-.js +84 -0
  12. package/dist/GameMenu.js +2 -0
  13. package/dist/GameScoreboard-DVoXXDnM.js +174 -0
  14. package/dist/GameScoreboard.js +2 -2
  15. package/dist/GlobalBody.js +58 -23
  16. package/dist/GlobalHead.js +5 -5
  17. package/dist/Link-CguWJy6y.js +16 -0
  18. package/dist/ReturnToLauncherButton.js +26 -22
  19. package/dist/SessionButton.js +62 -38
  20. package/dist/SettingsModal-yU_TsVYh.js +430 -0
  21. package/dist/SettingsModal.js +2 -2
  22. package/dist/SignInButton.js +21 -17
  23. package/dist/SocketServerUrlHandler.js +14 -10
  24. package/dist/StatusModal-BXRbJQ10.js +84 -0
  25. package/dist/ToontownModeHandler.js +13 -10
  26. package/dist/ViewUserModal-Dgo1C4sR.js +1798 -0
  27. package/dist/ViewUserModal.js +2 -2
  28. package/dist/articles-dev-box.css +498 -2
  29. package/dist/classnames-No-mjhw1.js +66 -0
  30. package/dist/index.js +23 -22
  31. package/dist/numberWithCommas-B0B9bjWC.js +2198 -0
  32. package/dist/typicalZustandStoreExcludes.js +4 -3
  33. package/dist/typicalZustandStoreStateSlice.js +53 -49
  34. package/dist/useAuthSiteStatus-ZK1GbPBV.js +34 -0
  35. package/dist/useFullscreen.js +38 -18
  36. package/dist/useUserDetails.js +17 -16
  37. package/dist/useUserFriends.js +23 -21
  38. package/dist/useUserToken.js +12 -11
  39. package/package.json +2 -1
  40. package/dist/Ad-CFuDgQYL.js +0 -504
  41. package/dist/AdConfirmExitModal-skW9lp88.js +0 -55
  42. package/dist/AdDetailsModal-CdTR2Y9l.js +0 -107
  43. package/dist/Button-sSB4xpOw.js +0 -31
  44. package/dist/GameScoreboard-9GYlLx72.js +0 -165
  45. package/dist/Link-8nSDV4sI.js +0 -16
  46. package/dist/SettingsModal-CiLvMoLW.js +0 -303
  47. package/dist/StatusModal-PG3i9NKf.js +0 -75
  48. package/dist/ViewUserModal-C5gjfuJ5.js +0 -1549
  49. package/dist/classnames-DCsil9eG.js +0 -39
  50. package/dist/numberWithCommas-DSRplpBy.js +0 -1170
  51. package/dist/useAuthSiteStatus-Cj9IjMj7.js +0 -29
@@ -0,0 +1,1798 @@
1
+ import { n as __toESM, t as require_classnames } from "./classnames-No-mjhw1.js";
2
+ import { t as ArticlesButton } from "./Button-DvEZjsVV.js";
3
+ import { t as Link } from "./Link-CguWJy6y.js";
4
+ import { a as normalizeDates, i as format, n as ArticlesDate, o as toDate, r as minutesToMilliseconds, t as numberWithCommas } from "./numberWithCommas-B0B9bjWC.js";
5
+ import { useEffect, useMemo, useState } from "react";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import useSWR from "swr";
8
+ import Modal from "react-bootstrap/Modal";
9
+ import OverlayTrigger from "react-bootstrap/OverlayTrigger";
10
+ import Tooltip from "react-bootstrap/Tooltip";
11
+ import useSWRImmutable from "swr/immutable";
12
+ import { ProgressBar } from "react-bootstrap";
13
+ //#region node_modules/date-fns/compareAsc.js
14
+ /**
15
+ * @name compareAsc
16
+ * @category Common Helpers
17
+ * @summary Compare the two dates and return -1, 0 or 1.
18
+ *
19
+ * @description
20
+ * Compare the two dates and return 1 if the first date is after the second,
21
+ * -1 if the first date is before the second or 0 if dates are equal.
22
+ *
23
+ * @param dateLeft - The first date to compare
24
+ * @param dateRight - The second date to compare
25
+ *
26
+ * @returns The result of the comparison
27
+ *
28
+ * @example
29
+ * // Compare 11 February 1987 and 10 July 1989:
30
+ * const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))
31
+ * //=> -1
32
+ *
33
+ * @example
34
+ * // Sort the array of dates:
35
+ * const result = [
36
+ * new Date(1995, 6, 2),
37
+ * new Date(1987, 1, 11),
38
+ * new Date(1989, 6, 10)
39
+ * ].sort(compareAsc)
40
+ * //=> [
41
+ * // Wed Feb 11 1987 00:00:00,
42
+ * // Mon Jul 10 1989 00:00:00,
43
+ * // Sun Jul 02 1995 00:00:00
44
+ * // ]
45
+ */
46
+ function compareAsc(dateLeft, dateRight) {
47
+ const diff = +toDate(dateLeft) - +toDate(dateRight);
48
+ if (diff < 0) return -1;
49
+ else if (diff > 0) return 1;
50
+ return diff;
51
+ }
52
+ //#endregion
53
+ //#region node_modules/date-fns/differenceInCalendarMonths.js
54
+ /**
55
+ * The {@link differenceInCalendarMonths} function options.
56
+ */
57
+ /**
58
+ * @name differenceInCalendarMonths
59
+ * @category Month Helpers
60
+ * @summary Get the number of calendar months between the given dates.
61
+ *
62
+ * @description
63
+ * Get the number of calendar months between the given dates.
64
+ *
65
+ * @param laterDate - The later date
66
+ * @param earlierDate - The earlier date
67
+ * @param options - An object with options
68
+ *
69
+ * @returns The number of calendar months
70
+ *
71
+ * @example
72
+ * // How many calendar months are between 31 January 2014 and 1 September 2014?
73
+ * const result = differenceInCalendarMonths(
74
+ * new Date(2014, 8, 1),
75
+ * new Date(2014, 0, 31)
76
+ * )
77
+ * //=> 8
78
+ */
79
+ function differenceInCalendarMonths(laterDate, earlierDate, options) {
80
+ const [laterDate_, earlierDate_] = normalizeDates(options?.in, laterDate, earlierDate);
81
+ const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();
82
+ const monthsDiff = laterDate_.getMonth() - earlierDate_.getMonth();
83
+ return yearsDiff * 12 + monthsDiff;
84
+ }
85
+ //#endregion
86
+ //#region node_modules/date-fns/endOfDay.js
87
+ /**
88
+ * The {@link endOfDay} function options.
89
+ */
90
+ /**
91
+ * @name endOfDay
92
+ * @category Day Helpers
93
+ * @summary Return the end of a day for the given date.
94
+ *
95
+ * @description
96
+ * Return the end of a day for the given date.
97
+ * The result will be in the local timezone.
98
+ *
99
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
100
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
101
+ *
102
+ * @param date - The original date
103
+ * @param options - An object with options
104
+ *
105
+ * @returns The end of a day
106
+ *
107
+ * @example
108
+ * // The end of a day for 2 September 2014 11:55:00:
109
+ * const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))
110
+ * //=> Tue Sep 02 2014 23:59:59.999
111
+ */
112
+ function endOfDay(date, options) {
113
+ const _date = toDate(date, options?.in);
114
+ _date.setHours(23, 59, 59, 999);
115
+ return _date;
116
+ }
117
+ //#endregion
118
+ //#region node_modules/date-fns/endOfMonth.js
119
+ /**
120
+ * The {@link endOfMonth} function options.
121
+ */
122
+ /**
123
+ * @name endOfMonth
124
+ * @category Month Helpers
125
+ * @summary Return the end of a month for the given date.
126
+ *
127
+ * @description
128
+ * Return the end of a month for the given date.
129
+ * The result will be in the local timezone.
130
+ *
131
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
132
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
133
+ *
134
+ * @param date - The original date
135
+ * @param options - An object with options
136
+ *
137
+ * @returns The end of a month
138
+ *
139
+ * @example
140
+ * // The end of a month for 2 September 2014 11:55:00:
141
+ * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
142
+ * //=> Tue Sep 30 2014 23:59:59.999
143
+ */
144
+ function endOfMonth(date, options) {
145
+ const _date = toDate(date, options?.in);
146
+ const month = _date.getMonth();
147
+ _date.setFullYear(_date.getFullYear(), month + 1, 0);
148
+ _date.setHours(23, 59, 59, 999);
149
+ return _date;
150
+ }
151
+ //#endregion
152
+ //#region node_modules/date-fns/isLastDayOfMonth.js
153
+ /**
154
+ * @name isLastDayOfMonth
155
+ * @category Month Helpers
156
+ * @summary Is the given date the last day of a month?
157
+ *
158
+ * @description
159
+ * Is the given date the last day of a month?
160
+ *
161
+ * @param date - The date to check
162
+ * @param options - An object with options
163
+ *
164
+ * @returns The date is the last day of a month
165
+ *
166
+ * @example
167
+ * // Is 28 February 2014 the last day of a month?
168
+ * const result = isLastDayOfMonth(new Date(2014, 1, 28))
169
+ * //=> true
170
+ */
171
+ function isLastDayOfMonth(date, options) {
172
+ const _date = toDate(date, options?.in);
173
+ return +endOfDay(_date, options) === +endOfMonth(_date, options);
174
+ }
175
+ //#endregion
176
+ //#region node_modules/date-fns/differenceInMonths.js
177
+ /**
178
+ * The {@link differenceInMonths} function options.
179
+ */
180
+ /**
181
+ * @name differenceInMonths
182
+ * @category Month Helpers
183
+ * @summary Get the number of full months between the given dates.
184
+ *
185
+ * @param laterDate - The later date
186
+ * @param earlierDate - The earlier date
187
+ * @param options - An object with options
188
+ *
189
+ * @returns The number of full months
190
+ *
191
+ * @example
192
+ * // How many full months are between 31 January 2014 and 1 September 2014?
193
+ * const result = differenceInMonths(new Date(2014, 8, 1), new Date(2014, 0, 31))
194
+ * //=> 7
195
+ */
196
+ function differenceInMonths(laterDate, earlierDate, options) {
197
+ const [laterDate_, workingLaterDate, earlierDate_] = normalizeDates(options?.in, laterDate, laterDate, earlierDate);
198
+ const sign = compareAsc(workingLaterDate, earlierDate_);
199
+ const difference = Math.abs(differenceInCalendarMonths(workingLaterDate, earlierDate_));
200
+ if (difference < 1) return 0;
201
+ if (workingLaterDate.getMonth() === 1 && workingLaterDate.getDate() > 27) workingLaterDate.setDate(30);
202
+ workingLaterDate.setMonth(workingLaterDate.getMonth() - sign * difference);
203
+ let isLastMonthNotFull = compareAsc(workingLaterDate, earlierDate_) === -sign;
204
+ if (isLastDayOfMonth(laterDate_) && difference === 1 && compareAsc(laterDate_, earlierDate_) === 1) isLastMonthNotFull = false;
205
+ const result = sign * (difference - +isLastMonthNotFull);
206
+ return result === 0 ? 0 : result;
207
+ }
208
+ //#endregion
209
+ //#region src/components/UI/UserProfilePhoto.jsx
210
+ var import_classnames = /* @__PURE__ */ __toESM(require_classnames(), 1);
211
+ function UserProfilePhoto(props) {
212
+ const { profile_photo, width, alt, hideDefault, activityStatus, user_id } = props;
213
+ if (profile_photo?.key) return /* @__PURE__ */ jsxs("div", {
214
+ "data-using-react-profile-photo": "true",
215
+ className: `profile-photo-wrap ${!width ? "w-100 h-100" : ""}`,
216
+ style: { ...width && {
217
+ width,
218
+ height: width
219
+ } },
220
+ children: [/* @__PURE__ */ jsx(ActivityStatus, {
221
+ activityStatus,
222
+ user_id
223
+ }), /* @__PURE__ */ jsx("img", {
224
+ className: "w-100 h-100",
225
+ src: `${process.env.NEXT_PUBLIC_CDN}${profile_photo.key}`,
226
+ style: { objectFit: "contain" },
227
+ alt: alt || "Profile photo of a user"
228
+ })]
229
+ });
230
+ else return /* @__PURE__ */ jsxs("div", {
231
+ "data-using-react-profile-photo": "true",
232
+ className: (0, import_classnames.default)("profile-photo-wrap", {
233
+ "w-100 h-100": !width,
234
+ "d-none": hideDefault
235
+ }),
236
+ style: { ...width && {
237
+ width,
238
+ height: width
239
+ } },
240
+ children: [/* @__PURE__ */ jsx(ActivityStatus, {
241
+ activityStatus,
242
+ user_id
243
+ }), /* @__PURE__ */ jsx("img", {
244
+ className: "w-100 h-100",
245
+ src: `${process.env.NEXT_PUBLIC_CDN}profile_photos/starter/articles.jpg`,
246
+ style: { objectFit: "contain" },
247
+ alt: alt || "Profile photo of a user"
248
+ })]
249
+ });
250
+ }
251
+ function ActivityStatus({ activityStatus, user_id }) {
252
+ if (!activityStatus || !user_id) return;
253
+ return /* @__PURE__ */ jsx("div", {
254
+ "data-user_id": user_id,
255
+ className: (0, import_classnames.default)(`online-status`, {
256
+ "status-online": activityStatus?.status == "Online" || user_id == "630f0b337c52851e754b03f7",
257
+ "status-offline": activityStatus?.status == "Offline",
258
+ "status-away": activityStatus?.status == "Away",
259
+ "activity-active": false
260
+ })
261
+ });
262
+ }
263
+ //#endregion
264
+ //#region src/hooks/User/UserPublic/usePublicUserData.js
265
+ var fetcher$1 = (data) => {
266
+ const params = new URLSearchParams({ user_id: data.user_id }).toString();
267
+ return fetch(`${data.url}?${params}`).then((res) => res.json());
268
+ };
269
+ var options = {
270
+ dedupingInterval: 1e3 * 60 * 1,
271
+ focusThrottleInterval: 1e3 * 60 * 1
272
+ };
273
+ var usePublicUserData = (params) => {
274
+ const { data, error, isLoading, isValidating, mutate } = useSWRImmutable(params?.user_id ? {
275
+ url: process.env.NODE_ENV === "development" ? "http://localhost:3001/api/user-public/getUserDetails" : "https://articles.media/api/user-public/getUserDetails",
276
+ user_id: params.user_id
277
+ } : null, fetcher$1, options);
278
+ return {
279
+ data,
280
+ error,
281
+ isLoading,
282
+ isValidating,
283
+ mutate
284
+ };
285
+ };
286
+ //#endregion
287
+ //#region src/components/UI/IsDev.jsx
288
+ function IsDev({ className, noOutline, children, inline }) {
289
+ const userReduxState = false;
290
+ const [isMounted, setIsMounted] = useState();
291
+ useEffect(() => {
292
+ setIsMounted(true);
293
+ }, []);
294
+ if (children && userReduxState?.roles?.isDev && isMounted) return /* @__PURE__ */ jsx("div", {
295
+ className: `is-dev-content ${noOutline && "no-outline"} ${className} ${inline && "d-inline-block"}`,
296
+ children
297
+ });
298
+ }
299
+ //#endregion
300
+ //#region src/constants/routes.js
301
+ var routes = {
302
+ BASE: "https://articles.media",
303
+ SIGN_IN: "/login",
304
+ SIGN_UP: "/signup",
305
+ HOME: "/",
306
+ PROPOSALS: "/politics/proposals",
307
+ PROPOSALS_SUBMISSIONS_ALL: "/politics/proposals/submissions",
308
+ STORIES: "/news/stories",
309
+ ISSUES: "/news/issues",
310
+ MYTHS: "/news/myths"
311
+ };
312
+ //#endregion
313
+ //#region src/components/UI/ViewUserModal/Panels/ProposalsStance.jsx
314
+ function ProposalsStance({ activeLayoutProposalSentiments, populated_user, usersProposalSentiments, setShowFullStanceDetails, showFullStanceDetails, userData }) {
315
+ const userReduxState = null;
316
+ return /* @__PURE__ */ jsx("div", {
317
+ className: "row mx-0 mb-2",
318
+ children: [{
319
+ name: `${populated_user?.display_name || userData.display_name}`,
320
+ data: activeLayoutProposalSentiments || {}
321
+ }, {
322
+ name: "You",
323
+ data: usersProposalSentiments || {}
324
+ }].map((item) => {
325
+ if (item.name == "You" && !userReduxState?._id) return /* @__PURE__ */ jsx("div", {
326
+ className: "col-lg-6 px-1",
327
+ children: /* @__PURE__ */ jsxs("div", {
328
+ className: "card card-articles card-sm h-100",
329
+ children: [
330
+ /* @__PURE__ */ jsx("div", {
331
+ className: "card-header",
332
+ children: /* @__PURE__ */ jsx("b", { children: item.name })
333
+ }),
334
+ /* @__PURE__ */ jsx("div", {
335
+ className: "card-body p-2",
336
+ children: /* @__PURE__ */ jsx("small", { children: "Login or create an account to compare your political stance with this user!" })
337
+ }),
338
+ /* @__PURE__ */ jsxs("div", {
339
+ className: "card-footer",
340
+ children: [/* @__PURE__ */ jsx(Link, {
341
+ href: routes.SIGN_IN,
342
+ children: /* @__PURE__ */ jsx(ArticlesButton, {
343
+ small: true,
344
+ className: "",
345
+ children: "Sign In"
346
+ })
347
+ }), /* @__PURE__ */ jsx(Link, {
348
+ href: routes.SIGN_UP,
349
+ children: /* @__PURE__ */ jsx(ArticlesButton, {
350
+ small: true,
351
+ className: "",
352
+ children: "Sign Up"
353
+ })
354
+ })]
355
+ })
356
+ ]
357
+ })
358
+ }, item.name);
359
+ return /* @__PURE__ */ jsx("div", {
360
+ className: "col-lg-6 px-1",
361
+ children: /* @__PURE__ */ jsxs("div", {
362
+ className: "card card-articles card-sm",
363
+ children: [/* @__PURE__ */ jsx("div", {
364
+ className: "card-header",
365
+ onClick: () => {
366
+ console.log(item.data);
367
+ },
368
+ children: /* @__PURE__ */ jsx("b", { children: item.name })
369
+ }), /* @__PURE__ */ jsxs("div", {
370
+ className: "card-body py-2 px-2 small",
371
+ children: [
372
+ /* @__PURE__ */ jsxs("div", {
373
+ className: "",
374
+ children: [
375
+ /* @__PURE__ */ jsxs("div", {
376
+ className: "small",
377
+ children: [
378
+ "Fundamental: ",
379
+ item?.data?.fundamental?.filter((obj) => {
380
+ if (item.data?.user_sentiments?.find((sen) => sen.proposal_id == obj._id)) return obj;
381
+ else return null;
382
+ }).length,
383
+ "/",
384
+ item?.data?.fundamental?.length
385
+ ]
386
+ }),
387
+ /* @__PURE__ */ jsx(ProgressBar, {
388
+ striped: true,
389
+ variant: "dark",
390
+ className: "shadow-articles mb-2",
391
+ now: (item.data?.fundamental?.filter((obj) => {
392
+ if (item.data?.user_sentiments?.find((sen) => sen.proposal_id == obj._id)) return obj;
393
+ else return null;
394
+ }).length / item.data?.fundamental?.length * 100).toFixed(2),
395
+ label: `${(item.data?.fundamental?.filter((obj) => {
396
+ if (item.data?.user_sentiments?.find((sen) => sen.proposal_id == obj._id)) return obj;
397
+ else return null;
398
+ }).length / item.data?.fundamental?.length * 100).toFixed(2)}%`
399
+ }),
400
+ /* @__PURE__ */ jsxs(ProgressBar, {
401
+ className: "shadow-articles mb-2",
402
+ style: { height: "10px" },
403
+ children: [
404
+ /* @__PURE__ */ jsx(ProgressBar, {
405
+ striped: true,
406
+ variant: "danger",
407
+ now: (item.data?.user_sentiments?.filter((sen) => sen.sentiment_status == "Disagree" && sen.populated_proposal.fundamental)?.length / item.data?.fundamental?.length * 100).toFixed(2)
408
+ }),
409
+ /* @__PURE__ */ jsx(ProgressBar, {
410
+ striped: true,
411
+ variant: "warning",
412
+ now: (item.data?.user_sentiments?.filter((sen) => sen.sentiment_status == "Needs Work" && sen.populated_proposal.fundamental)?.length / item.data?.fundamental?.length * 100).toFixed(2)
413
+ }),
414
+ /* @__PURE__ */ jsx(ProgressBar, {
415
+ striped: true,
416
+ variant: "success",
417
+ now: (item.data?.user_sentiments?.filter((sen) => sen.sentiment_status == "Agree" && sen.populated_proposal.fundamental)?.length / item.data?.fundamental?.length * 100).toFixed(2)
418
+ })
419
+ ]
420
+ }),
421
+ /* @__PURE__ */ jsxs("div", {
422
+ className: "",
423
+ children: ["Disagree: ", item.data?.user_sentiments?.filter((sen) => {
424
+ let isFundamental = item.data?.fundamental.find((obj) => obj._id == sen.proposal_id);
425
+ return sen.sentiment_status == "Disagree" && isFundamental;
426
+ })?.length || 0]
427
+ }),
428
+ /* @__PURE__ */ jsxs("div", {
429
+ className: "",
430
+ children: ["Needs Work: ", item.data?.user_sentiments?.filter((sen) => {
431
+ let isFundamental = item.data?.fundamental.find((obj) => obj._id == sen.proposal_id);
432
+ return sen.sentiment_status == "Needs Work" && isFundamental;
433
+ })?.length || 0]
434
+ }),
435
+ /* @__PURE__ */ jsxs("div", {
436
+ className: "mb-2",
437
+ children: ["Agree: ", item.data?.user_sentiments?.filter((sen) => {
438
+ let isFundamental = item.data?.fundamental.find((obj) => obj._id == sen.proposal_id);
439
+ return sen.sentiment_status == "Agree" && isFundamental;
440
+ })?.length || 0]
441
+ })
442
+ ]
443
+ }),
444
+ !showFullStanceDetails && /* @__PURE__ */ jsx("span", {
445
+ onClick: () => setShowFullStanceDetails(true),
446
+ className: "badge bg-articles-secondary shadow-articles badge-hover",
447
+ children: "View More"
448
+ }),
449
+ showFullStanceDetails && /* @__PURE__ */ jsxs(Fragment, { children: [
450
+ /* @__PURE__ */ jsx("hr", {}),
451
+ /* @__PURE__ */ jsxs("div", {
452
+ className: "mb-2",
453
+ children: [
454
+ /* @__PURE__ */ jsxs("div", {
455
+ className: "small",
456
+ children: [
457
+ "All: ",
458
+ item.data?.user_sentiments?.length,
459
+ "/",
460
+ item.data?.total
461
+ ]
462
+ }),
463
+ /* @__PURE__ */ jsx(ProgressBar, {
464
+ striped: true,
465
+ animated: true,
466
+ variant: "dark",
467
+ className: "shadow-articles mb-1",
468
+ now: (item.data?.user_sentiments?.length / item.data?.total * 100).toFixed(2),
469
+ label: `${(item.data?.user_sentiments?.length / item.data?.total * 100).toFixed(2)}%`
470
+ }),
471
+ /* @__PURE__ */ jsxs(ProgressBar, {
472
+ className: "shadow-articles mb-2",
473
+ style: { height: "10px" },
474
+ children: [
475
+ /* @__PURE__ */ jsx(ProgressBar, {
476
+ striped: true,
477
+ animated: true,
478
+ variant: "danger",
479
+ now: (item.data?.user_sentiments?.filter((sen) => sen.sentiment_status == "Disagree")?.length / item.data?.total * 100).toFixed(2)
480
+ }),
481
+ /* @__PURE__ */ jsx(ProgressBar, {
482
+ striped: true,
483
+ animated: true,
484
+ variant: "warning",
485
+ now: (item.data?.user_sentiments?.filter((sen) => sen.sentiment_status == "Needs Work")?.length / item.data?.total * 100).toFixed(2)
486
+ }),
487
+ /* @__PURE__ */ jsx(ProgressBar, {
488
+ striped: true,
489
+ animated: true,
490
+ variant: "success",
491
+ now: (item.data?.user_sentiments?.filter((sen) => sen.sentiment_status == "Agree")?.length / item.data?.total * 100).toFixed(2)
492
+ })
493
+ ]
494
+ }),
495
+ /* @__PURE__ */ jsxs("div", {
496
+ className: "",
497
+ children: ["Disagree: ", item.data?.user_sentiments?.filter((sen) => {
498
+ return sen.sentiment_status == "Disagree";
499
+ })?.length || 0]
500
+ }),
501
+ /* @__PURE__ */ jsxs("div", {
502
+ className: "",
503
+ children: ["Needs Work: ", item.data?.user_sentiments?.filter((sen) => {
504
+ return sen.sentiment_status == "Needs Work";
505
+ })?.length || 0]
506
+ }),
507
+ /* @__PURE__ */ jsxs("div", {
508
+ className: "mb-2",
509
+ children: ["Agree: ", item.data?.user_sentiments?.filter((sen) => {
510
+ return sen.sentiment_status == "Agree";
511
+ })?.length || 0]
512
+ })
513
+ ]
514
+ }),
515
+ /* @__PURE__ */ jsx("hr", {}),
516
+ /* @__PURE__ */ jsx("p", {
517
+ className: "mb-0",
518
+ children: /* @__PURE__ */ jsxs("div", {
519
+ className: "row",
520
+ children: [
521
+ /* @__PURE__ */ jsx("div", {
522
+ className: "col-9",
523
+ children: "Comments"
524
+ }),
525
+ /* @__PURE__ */ jsx("div", {
526
+ className: "col-3",
527
+ children: /* @__PURE__ */ jsx("b", { children: item.data?.user_comments?.length || 0 })
528
+ }),
529
+ /* @__PURE__ */ jsx("div", {
530
+ className: "col-9",
531
+ children: "Submissions"
532
+ }),
533
+ /* @__PURE__ */ jsx("div", {
534
+ className: "col-3",
535
+ children: /* @__PURE__ */ jsx("b", { children: item.data?.user_submissions })
536
+ })
537
+ ]
538
+ })
539
+ })
540
+ ] })
541
+ ]
542
+ })]
543
+ })
544
+ }, item.name);
545
+ })
546
+ });
547
+ }
548
+ //#endregion
549
+ //#region src/components/UI/ViewUserModal/Panels/ProposalComments.jsx
550
+ function ProposalComments({ activeLayoutProposalSentiments }) {
551
+ return /* @__PURE__ */ jsx("div", { children: activeLayoutProposalSentiments.user_comments?.filter((obj) => !obj.parent_id).map((obj) => {
552
+ return /* @__PURE__ */ jsxs("div", {
553
+ className: "card card-articles card-sm border mb-2",
554
+ children: [
555
+ /* @__PURE__ */ jsxs("div", {
556
+ className: "card-header small",
557
+ children: ["Commented on ", /* @__PURE__ */ jsx("b", { children: obj.populated_proposal.title })]
558
+ }),
559
+ /* @__PURE__ */ jsx("div", {
560
+ className: "card-body small p-2",
561
+ children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
562
+ className: "small",
563
+ children: format(new Date(obj.date), "M/dd/yy")
564
+ }), /* @__PURE__ */ jsx("div", { children: obj.comment })] })
565
+ }),
566
+ /* @__PURE__ */ jsx("div", {
567
+ className: "card-footer",
568
+ children: /* @__PURE__ */ jsx(Link, {
569
+ prefetch: false,
570
+ href: `${routes.PROPOSALS}/${obj.populated_proposal.url}?interaction_id=${obj._id}`,
571
+ children: /* @__PURE__ */ jsx(ArticlesButton, {
572
+ small: true,
573
+ children: "View"
574
+ })
575
+ })
576
+ })
577
+ ]
578
+ }, obj._id);
579
+ }) });
580
+ }
581
+ //#endregion
582
+ //#region src/components/UI/ViewUserModal/Panels/ProposalSentiments.jsx
583
+ function ProposalSentiments({ activeLayoutProposalSentiments }) {
584
+ return /* @__PURE__ */ jsx("div", { children: activeLayoutProposalSentiments.user_sentiments?.map((obj) => {
585
+ return /* @__PURE__ */ jsxs("div", {
586
+ className: "card card-articles card-sm border mb-2",
587
+ children: [
588
+ /* @__PURE__ */ jsxs("div", {
589
+ className: "card-header small",
590
+ children: ["Gave their sentiment on ", /* @__PURE__ */ jsx("b", { children: obj.populated_proposal.title })]
591
+ }),
592
+ /* @__PURE__ */ jsxs("div", {
593
+ className: "card-body small p-2",
594
+ children: [/* @__PURE__ */ jsxs("div", {
595
+ className: "d-flex align-items-center border-bottom pb-1",
596
+ children: [
597
+ obj.sentiment_status == "Agree" && /* @__PURE__ */ jsx("div", {
598
+ className: "badge shadow-articles bg-success",
599
+ children: "Agree"
600
+ }),
601
+ obj.sentiment_status == "Needs Work" && /* @__PURE__ */ jsx("div", {
602
+ className: "badge shadow-articles bg-warning text-dark",
603
+ children: "Needs Work"
604
+ }),
605
+ obj.sentiment_status == "Disagree" && /* @__PURE__ */ jsx("div", {
606
+ className: "badge shadow-articles bg-danger",
607
+ children: "Disagree"
608
+ }),
609
+ /* @__PURE__ */ jsx("span", {
610
+ className: "small ms-2",
611
+ children: format(new Date(obj.date), "M/dd/yy")
612
+ })
613
+ ]
614
+ }), /* @__PURE__ */ jsx("div", {
615
+ className: "mt-1",
616
+ children: obj.comment
617
+ })]
618
+ }),
619
+ /* @__PURE__ */ jsx("div", {
620
+ className: "card-footer",
621
+ children: /* @__PURE__ */ jsx(Link, {
622
+ prefetch: false,
623
+ href: `https://articles.media/politics/proposals/${obj.populated_proposal.url}?interaction_id=${obj._id}`,
624
+ children: /* @__PURE__ */ jsx(ArticlesButton, {
625
+ small: true,
626
+ children: "View"
627
+ })
628
+ })
629
+ })
630
+ ]
631
+ }, obj._id);
632
+ }) });
633
+ }
634
+ //#endregion
635
+ //#region src/components/UI/ViewUserModal/Panels/ProposalSubmissions.jsx
636
+ function ProposalSubmissions({ activeLayoutProposalSentiments, userProposalsSubmitted }) {
637
+ const [viewAllProposalsSubmitted, setViewAllProposalsSubmitted] = useState(false);
638
+ return /* @__PURE__ */ jsxs("div", { children: [
639
+ /* @__PURE__ */ jsx("div", {
640
+ className: "mb-2",
641
+ children: userProposalsSubmitted?.slice(0, viewAllProposalsSubmitted ? 100 : 1).map((layout) => {
642
+ return /* @__PURE__ */ jsxs("div", {
643
+ className: "card card-articles card-sm shadow-articles",
644
+ children: [/* @__PURE__ */ jsx("div", {
645
+ className: "card-body p-2 lh-sm d-flex align-items-center",
646
+ children: /* @__PURE__ */ jsxs("div", {
647
+ className: "ms-2",
648
+ children: [/* @__PURE__ */ jsx("div", { children: layout.title }), /* @__PURE__ */ jsxs("div", {
649
+ className: "small",
650
+ children: [layout.type, layout.fundamental && " - Fundamental"]
651
+ })]
652
+ })
653
+ }), /* @__PURE__ */ jsx("div", {
654
+ className: "card-footer d-flex",
655
+ children: /* @__PURE__ */ jsx(Link, {
656
+ href: `${routes.PROPOSALS_SUBMISSIONS_ALL}/${layout._id}`,
657
+ className: "",
658
+ children: /* @__PURE__ */ jsx(ArticlesButton, {
659
+ small: true,
660
+ children: /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("i", { className: "fad fa-eye me-1" }), "View"] })
661
+ })
662
+ })
663
+ })]
664
+ }, layout._id);
665
+ })
666
+ }),
667
+ userProposalsSubmitted?.length > 1 && /* @__PURE__ */ jsx(ArticlesButton, {
668
+ onClick: () => setViewAllProposalsSubmitted(!viewAllProposalsSubmitted),
669
+ className: "w-100",
670
+ children: !viewAllProposalsSubmitted ? "View All" : "View Less"
671
+ }),
672
+ userProposalsSubmitted?.length == 0 && /* @__PURE__ */ jsx("span", {
673
+ className: "small",
674
+ children: "User has no proposal submissions"
675
+ })
676
+ ] });
677
+ }
678
+ //#endregion
679
+ //#region src/components/News/NewsPreviewImage.jsx
680
+ function NewsPreviewImage(props) {
681
+ const { featured_image, thumbnail_size } = props;
682
+ return /* @__PURE__ */ jsxs(Fragment, { children: [(featured_image?.image_type == "S3 File System" || featured_image?.thumbnails?.length > 0) && /* @__PURE__ */ jsx(Fragment, { children: featured_image?.thumbnails?.length > 0 ? /* @__PURE__ */ jsx(Fragment, { children: thumbnail_size && featured_image?.thumbnails?.find((thumb_obj) => thumb_obj.width == thumbnail_size) ? /* @__PURE__ */ jsx("img", {
683
+ style: {
684
+ width: "100%",
685
+ height: "100%",
686
+ objectFit: "cover"
687
+ },
688
+ src: process.env.NEXT_PUBLIC_CDN + featured_image?.thumbnails?.find((thumb_obj) => thumb_obj.width == thumbnail_size).key,
689
+ loading: "lazy",
690
+ alt: "",
691
+ className: "flex-shrink-0"
692
+ }) : /* @__PURE__ */ jsx("img", {
693
+ style: {
694
+ width: "100%",
695
+ height: "100%",
696
+ objectFit: "cover"
697
+ },
698
+ src: process.env.NEXT_PUBLIC_CDN + [...featured_image?.thumbnails].sort((a, b) => a.width - b.width)[0].key,
699
+ loading: "lazy",
700
+ alt: "",
701
+ className: "flex-shrink-0"
702
+ }) }) : /* @__PURE__ */ jsx("img", {
703
+ style: {
704
+ width: "100%",
705
+ height: "100%",
706
+ objectFit: "cover"
707
+ },
708
+ src: process.env.NEXT_PUBLIC_CDN + featured_image?.key,
709
+ loading: "lazy",
710
+ alt: "",
711
+ className: "flex-shrink-0"
712
+ }) }), featured_image?.location && !featured_image?.image_type && (featured_image?.thumbnails?.length || 0) < 1 && /* @__PURE__ */ jsx("img", {
713
+ style: {
714
+ objectFit: "cover",
715
+ width: "100%",
716
+ height: "100%"
717
+ },
718
+ src: `${process.env.NEXT_PUBLIC_CDN}${featured_image?.key}`,
719
+ alt: "",
720
+ loading: "lazy"
721
+ })] });
722
+ }
723
+ //#endregion
724
+ //#region src/util/renderNewsRoute.js
725
+ function renderNewsRoute(type) {
726
+ switch (type) {
727
+ case "story": return routes.STORIES;
728
+ case "issue": return routes.ISSUES;
729
+ case "myth": return routes.MYTHS;
730
+ default:
731
+ }
732
+ }
733
+ //#endregion
734
+ //#region src/components/UI/ViewUserModal/Panels/NewsComments.jsx
735
+ function NewsComments({ publicUserData }) {
736
+ return /* @__PURE__ */ jsx("div", { children: publicUserData?.populated_news_comments?.filter((obj) => !obj.parent_id).map((obj) => {
737
+ return /* @__PURE__ */ jsxs("div", {
738
+ className: "card card-articles card-sm border mb-2",
739
+ children: [
740
+ /* @__PURE__ */ jsxs("div", {
741
+ className: "card-header small",
742
+ children: ["Commented on ", /* @__PURE__ */ jsx("b", { children: obj.populated_news?.news_title })]
743
+ }),
744
+ /* @__PURE__ */ jsxs("div", {
745
+ className: "card-body small p-2 d-flex",
746
+ children: [/* @__PURE__ */ jsx("div", {
747
+ style: {
748
+ width: "100px",
749
+ height: "100px"
750
+ },
751
+ className: "me-2 flex-shrink-0",
752
+ children: /* @__PURE__ */ jsx(NewsPreviewImage, {
753
+ featured_image: obj?.populated_news?.featured_image,
754
+ thumbnail_size: 100
755
+ })
756
+ }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
757
+ className: "small",
758
+ children: format(new Date(obj.date), "M/dd/yy")
759
+ }), /* @__PURE__ */ jsx("div", { children: obj.comment })] })]
760
+ }),
761
+ /* @__PURE__ */ jsx("div", {
762
+ className: "card-footer",
763
+ children: /* @__PURE__ */ jsx(Link, {
764
+ prefetch: false,
765
+ href: `${renderNewsRoute(obj.populated_news?.news_type)}/${obj.populated_news?.url}?interaction_id=${obj._id}`,
766
+ children: /* @__PURE__ */ jsx(ArticlesButton, {
767
+ small: true,
768
+ children: "View"
769
+ })
770
+ })
771
+ })
772
+ ]
773
+ }, obj._id);
774
+ }) });
775
+ }
776
+ //#endregion
777
+ //#region src/components/UI/ViewUserModal/Panels/NewsSubmissions.jsx
778
+ function NewsSubmissions({ userNewsSubmitted }) {
779
+ const [viewAllNewsSubmitted, setViewAllNewsSubmitted] = useState(false);
780
+ return /* @__PURE__ */ jsxs("div", { children: [
781
+ /* @__PURE__ */ jsxs("div", {
782
+ className: "mb-1 d-flex justify-content-between align-items-center",
783
+ children: [/* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("i", { className: "fad fa-newspaper me-1" }), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", { children: "News Submissions: " }), /* @__PURE__ */ jsx("span", {
784
+ className: "badge bg-dark",
785
+ children: userNewsSubmitted?.length || 0
786
+ })] })] }), /* @__PURE__ */ jsxs("span", {
787
+ className: "badge bg-articles-secondary",
788
+ children: [/* @__PURE__ */ jsx("i", { className: "fad fa-info me-1" }), /* @__PURE__ */ jsx("span", { children: "Info" })]
789
+ })]
790
+ }),
791
+ /* @__PURE__ */ jsx("div", {
792
+ className: "mb-1",
793
+ children: userNewsSubmitted?.slice(0, viewAllNewsSubmitted ? 100 : 1).map((layout) => {
794
+ return /* @__PURE__ */ jsxs("div", {
795
+ className: "card card-articles shadow-articles",
796
+ children: [/* @__PURE__ */ jsxs("div", {
797
+ className: "card-body py-1 px-2 lh-sm d-flex align-items-center",
798
+ children: [/* @__PURE__ */ jsx("img", {
799
+ className: "",
800
+ src: layout?.featured_image?.location,
801
+ width: "40px",
802
+ height: "40px",
803
+ style: { objectFit: "cover" },
804
+ alt: ""
805
+ }), /* @__PURE__ */ jsx("div", {
806
+ className: "ms-2",
807
+ children: /* @__PURE__ */ jsx("div", { children: layout.news_title })
808
+ })]
809
+ }), /* @__PURE__ */ jsx("div", {
810
+ className: "card-footer d-flex p-1",
811
+ children: /* @__PURE__ */ jsx(Link, {
812
+ href: `${routes.HOME}/${layout.url}`,
813
+ children: /* @__PURE__ */ jsxs(ArticlesButton, {
814
+ small: true,
815
+ className: "",
816
+ children: [/* @__PURE__ */ jsx("i", { className: "fad fa-eye me-1" }), "View"]
817
+ })
818
+ })
819
+ })]
820
+ }, layout._id);
821
+ })
822
+ }),
823
+ userNewsSubmitted?.length > 1 ? /* @__PURE__ */ jsx(ArticlesButton, {
824
+ onClick: () => setViewAllNewsSubmitted(!viewAllNewsSubmitted),
825
+ small: true,
826
+ className: "",
827
+ children: !viewAllNewsSubmitted ? "View All" : "View Less"
828
+ }) : /* @__PURE__ */ jsx("span", {
829
+ className: "small",
830
+ children: "User has no news submissions"
831
+ })
832
+ ] });
833
+ }
834
+ //#endregion
835
+ //#region src/components/UI/ViewUserModal/Panels/Donations.jsx
836
+ function Donations({ activeLayoutProposalSentiments, userDonations, lifetimeContribution }) {
837
+ const [viewAllDonations, setViewAllDonations] = useState(false);
838
+ return /* @__PURE__ */ jsxs("div", {
839
+ className: "card card-articles ",
840
+ children: [
841
+ /* @__PURE__ */ jsxs("div", {
842
+ className: "card-header d-flex justify-content-between align-items-center p-1",
843
+ children: [/* @__PURE__ */ jsx("span", { children: "Donations: " }), /* @__PURE__ */ jsxs("span", {
844
+ className: "badge bg-dark",
845
+ children: [
846
+ userDonations.count,
847
+ " - ",
848
+ `$${numberWithCommas((lifetimeContribution / 100 || 0).toFixed(2))}`
849
+ ]
850
+ })]
851
+ }),
852
+ /* @__PURE__ */ jsxs("div", {
853
+ className: "card-body p-2",
854
+ children: [userDonations?.list?.length == 0 && /* @__PURE__ */ jsx("span", {
855
+ className: "small",
856
+ children: "User has no donations"
857
+ }), /* @__PURE__ */ jsx("div", {
858
+ className: "donations-wrap",
859
+ children: userDonations?.list?.slice(0, viewAllDonations ? 100 : 3).map((layout) => {
860
+ return /* @__PURE__ */ jsxs("div", {
861
+ className: "border",
862
+ children: [/* @__PURE__ */ jsxs("div", {
863
+ className: "card-body py-1 px-2 lh-sm d-flex align-items-center",
864
+ children: [/* @__PURE__ */ jsx("div", {
865
+ className: "small",
866
+ children: "Most Recent"
867
+ }), /* @__PURE__ */ jsxs("div", {
868
+ className: "ms-2 d-flex align-items-center",
869
+ children: [/* @__PURE__ */ jsx("div", {
870
+ className: "h4 mb-0 me-2",
871
+ children: `$${numberWithCommas((layout.amount / 100).toFixed(2))}`
872
+ }), /* @__PURE__ */ jsx("div", {
873
+ className: "small",
874
+ children: format(new Date(layout.date), "M/dd/yy")
875
+ })]
876
+ })]
877
+ }), /* @__PURE__ */ jsx("div", {
878
+ className: "card-footer d-flex p-1",
879
+ children: /* @__PURE__ */ jsx(Link, {
880
+ href: `${routes.HOME}/${layout.url}`,
881
+ children: /* @__PURE__ */ jsxs(ArticlesButton, {
882
+ className: "",
883
+ small: true,
884
+ children: [/* @__PURE__ */ jsx("i", { className: "fad fa-eye me-1" }), "View"]
885
+ })
886
+ })
887
+ })]
888
+ }, layout._id);
889
+ })
890
+ })]
891
+ }),
892
+ /* @__PURE__ */ jsx("div", {
893
+ className: "card-footer p-1 d-flex justify-content-center",
894
+ children: userDonations.count > 1 && /* @__PURE__ */ jsx(ArticlesButton, {
895
+ onClick: () => {
896
+ setViewAllDonations(!viewAllDonations);
897
+ },
898
+ className: "w-100",
899
+ children: !viewAllDonations ? "View All" : "View Less"
900
+ })
901
+ })
902
+ ]
903
+ });
904
+ }
905
+ //#endregion
906
+ //#region src/components/UI/ViewUserModal/Panels/Layouts.jsx
907
+ function Layouts({ userLayoutsData, handleClose }) {
908
+ const userReduxState = false;
909
+ return /* @__PURE__ */ jsx("div", { children: userLayoutsData?.map((layout) => {
910
+ return /* @__PURE__ */ jsxs("div", {
911
+ className: "card card-articles shadow-articles",
912
+ children: [/* @__PURE__ */ jsx("div", {
913
+ className: "card-body py-1 px-2 lh-sm d-flex align-items-center",
914
+ children: /* @__PURE__ */ jsxs("div", {
915
+ className: "ms-2",
916
+ children: [/* @__PURE__ */ jsx("div", { children: layout.name }), /* @__PURE__ */ jsx("div", {
917
+ className: "small",
918
+ children: "Last Viewed: Never"
919
+ })]
920
+ })
921
+ }), /* @__PURE__ */ jsxs("div", {
922
+ className: "card-footer d-flex p-1",
923
+ children: [userReduxState._id !== layout.user_id && /* @__PURE__ */ jsxs(ArticlesButton, {
924
+ className: "",
925
+ small: true,
926
+ children: [/* @__PURE__ */ jsx("i", { className: "fad fa-plus me-1" }), "Follow"]
927
+ }), /* @__PURE__ */ jsx(Link, {
928
+ href: `${routes.HOME}/${layout.url}`,
929
+ children: /* @__PURE__ */ jsxs(ArticlesButton, {
930
+ className: "",
931
+ small: true,
932
+ children: [/* @__PURE__ */ jsx("i", { className: "fad fa-eye me-1" }), "View"]
933
+ })
934
+ })]
935
+ })]
936
+ }, layout._id);
937
+ }) });
938
+ }
939
+ //#endregion
940
+ //#region src/components/UI/ViewUserModal/Panels/Verifications.jsx
941
+ function Verifications({ activeLayoutProposalSentiments, userData }) {
942
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("div", {
943
+ className: "",
944
+ children: userData?.verified?.verified_methods?.map((item, item_i) => {
945
+ if (Object.keys(item)?.length > 0) return /* @__PURE__ */ jsxs("div", {
946
+ className: "card card-articles card-sm object mb-2",
947
+ children: [/* @__PURE__ */ jsx("div", {
948
+ className: "card-header",
949
+ children: item?.method_name
950
+ }), /* @__PURE__ */ jsx("div", {
951
+ className: "card-body p-2",
952
+ children: /* @__PURE__ */ jsxs("div", {
953
+ className: "small",
954
+ children: [/* @__PURE__ */ jsxs("div", {
955
+ className: "d-flex align-items-center",
956
+ children: [/* @__PURE__ */ jsx("span", {
957
+ className: "me-2",
958
+ children: "Approved On: "
959
+ }), /* @__PURE__ */ jsx(ArticlesDate, { date: item.approved_date })]
960
+ }), /* @__PURE__ */ jsxs("div", {
961
+ className: "d-flex align-items-center",
962
+ children: [/* @__PURE__ */ jsx("span", {
963
+ className: "me-2",
964
+ children: "Approved By: "
965
+ }), /* @__PURE__ */ jsx(ViewUserModal, {
966
+ user_id: item.approved_by,
967
+ dangerousPopulate: true
968
+ })]
969
+ })]
970
+ })
971
+ })]
972
+ }, item_i);
973
+ else return /* @__PURE__ */ jsx("div", {
974
+ className: "single",
975
+ children: item
976
+ }, item_i);
977
+ })
978
+ }) });
979
+ }
980
+ //#endregion
981
+ //#region src/components/UI/ViewUserModal/Panels/Achievements.jsx
982
+ var achievements = [];
983
+ function Achievements({ activeLayoutProposalSentiments }) {
984
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("div", {
985
+ className: "achievements card card-articles",
986
+ children: /* @__PURE__ */ jsx("div", {
987
+ className: "card-body p-0",
988
+ children: achievements.map((achievement) => /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
989
+ className: "achievement w-100 d-flex align-items-center",
990
+ children: [
991
+ /* @__PURE__ */ jsx("div", {
992
+ className: "icon",
993
+ style: { width: "50px" },
994
+ children: /* @__PURE__ */ jsx("i", { className: `fad ${achievement.icon} fa-lg` })
995
+ }),
996
+ /* @__PURE__ */ jsxs("div", {
997
+ className: "details small me-auto",
998
+ children: [
999
+ /* @__PURE__ */ jsx("b", {
1000
+ className: "name",
1001
+ children: achievement.name
1002
+ }),
1003
+ /* @__PURE__ */ jsx("div", {
1004
+ className: "description mb-1",
1005
+ children: achievement.description
1006
+ }),
1007
+ /* @__PURE__ */ jsx("div", {
1008
+ className: "small",
1009
+ children: achievement.tags?.map((item) => /* @__PURE__ */ jsx("span", {
1010
+ className: "badge bg-dark border",
1011
+ children: item
1012
+ }, item))
1013
+ })
1014
+ ]
1015
+ }),
1016
+ /* @__PURE__ */ jsx("div", {
1017
+ className: "icon border-end-0 border-start border-dark",
1018
+ children: /* @__PURE__ */ jsx("div", {
1019
+ className: "text-center px-3",
1020
+ children: /* @__PURE__ */ jsx("i", { className: `fad fa-square fa-lg me-0` })
1021
+ })
1022
+ })
1023
+ ]
1024
+ }) }, achievement.name))
1025
+ })
1026
+ }) });
1027
+ }
1028
+ //#endregion
1029
+ //#region src/hooks/Politics/usePoliticalParties.js
1030
+ var fetcher = (url) => fetch(url).then((res) => res.json());
1031
+ var usePoliticalParties = (params) => {
1032
+ const { data, error, isLoading, mutate } = useSWR(process.env.NODE_ENV === "development" ? "http://localhost:3001/api/news/resources/political-parties" : "https://articles.media/api/news/resources/political-parties", fetcher, params?.preload ? {
1033
+ dedupingInterval: 1e3 * 60 * 10,
1034
+ focusThrottleInterval: minutesToMilliseconds(60),
1035
+ errorRetryInterval: 1e3 * 60 * 5,
1036
+ fallbackData: params?.preload
1037
+ } : {
1038
+ dedupingInterval: 1e3 * 60 * 10,
1039
+ focusThrottleInterval: minutesToMilliseconds(60),
1040
+ errorRetryInterval: 1e3 * 60 * 5
1041
+ });
1042
+ return {
1043
+ data,
1044
+ error,
1045
+ isLoading,
1046
+ mutate
1047
+ };
1048
+ };
1049
+ //#endregion
1050
+ //#region src/components/UI/ViewUserModal/ViewUserModal.jsx
1051
+ function ViewUserModal(props) {
1052
+ const { populated_user, hidePhoto, visibleItems, size, className, dangerousPopulate, user_id, buttonType, children, fakeMembership } = props;
1053
+ const [modalShow, setModalShow] = useState(false);
1054
+ const [userData, setUserData] = useState({});
1055
+ const [userLayoutsData, setUserLayoutsData] = useState([]);
1056
+ const [userDonations, setUserDonations] = useState([]);
1057
+ const [lifetimeContribution, setLifetimeContribution] = useState(null);
1058
+ const [userNewsSubmitted, setUserNewsSubmitted] = useState([]);
1059
+ const [userProposalsSubmitted, setUserProposalsSubmitted] = useState([]);
1060
+ const [viewAllProposalsSubmitted, setViewAllProposalsSubmitted] = useState(false);
1061
+ const userReduxState = false;
1062
+ const { data: politicalParties, isLoading: politicalPartiesIsLoading, mutate: politicalPartiesMutate } = usePoliticalParties();
1063
+ const [contentDisplayTab, setContentDisplayTab] = useState("Proposals Stance");
1064
+ const handleClose = () => {
1065
+ setModalShow(false);
1066
+ };
1067
+ useEffect(() => {
1068
+ if (populated_user) setUserData({ ...populated_user });
1069
+ }, []);
1070
+ const [showFullStanceDetails, setShowFullStanceDetails] = useState(false);
1071
+ const [activeLayoutProposalSentiments, setActiveLayoutProposalSentiments] = useState([]);
1072
+ const [usersProposalSentiments, setUsersProposalSentiments] = useState([]);
1073
+ const { data: publicUserData, isLoading: publicUserDataIsLoading, mutate: publicUserDataMutate } = usePublicUserData((user_id || populated_user?._id) && (modalShow || dangerousPopulate) ? { user_id: user_id || populated_user?._id } : null);
1074
+ const { data: personalUserData, isLoading: personalUserDataIsLoading, mutate: personalUserDataMutate } = usePublicUserData(userReduxState?._id && (modalShow || dangerousPopulate) ? { user_id: userReduxState?._id } : null);
1075
+ useEffect(() => {
1076
+ if (publicUserData) {
1077
+ console.log("publicUserData", publicUserData);
1078
+ setUserData(publicUserData);
1079
+ setUserLayoutsData(publicUserData?.populated_public_layouts);
1080
+ setUserDonations(publicUserData?.populated_public_donations);
1081
+ setLifetimeContribution(publicUserData?.populated_public_donations.total);
1082
+ setUserProposalsSubmitted(publicUserData?.populated_public_proposals);
1083
+ setActiveLayoutProposalSentiments(publicUserData?.populated_public_proposals_stance);
1084
+ setUserNewsSubmitted(publicUserData?.populated_public_news_submissions || []);
1085
+ }
1086
+ }, [publicUserData]);
1087
+ useEffect(() => {
1088
+ if (personalUserData) {
1089
+ console.log("personalUserData", personalUserData);
1090
+ setUsersProposalSentiments(personalUserData?.populated_public_proposals_stance);
1091
+ }
1092
+ }, [personalUserData]);
1093
+ let membershipSafeName = (populated_user || userData)?.articles_membership?.plan.replace(" ", "-").toLowerCase();
1094
+ let membershipFakeSafeName = fakeMembership?.replace(" ", "-").toLowerCase();
1095
+ const base = `https://articles.media/images/store/memberships/`;
1096
+ const UserBadge = () => {
1097
+ let hasMembership = (populated_user || userData)?.articles_membership?.status == "Active";
1098
+ return /* @__PURE__ */ jsxs("div", {
1099
+ style: size == "lg" ? { fontSize: "1.5rem" } : {},
1100
+ className: `view-user-modal-badge-wrap ${size == "lg" && "large"} ${className && className}`,
1101
+ children: [
1102
+ /* @__PURE__ */ jsxs("span", {
1103
+ onClick: () => {
1104
+ setModalShow(true);
1105
+ },
1106
+ className: "position-relative view-user-modal-badge d-flex justify-content-between align-items-center badge bg-articles badge-hover ",
1107
+ children: [
1108
+ (hasMembership || fakeMembership) && /* @__PURE__ */ jsx("i", {
1109
+ className: `fad membership-badge ${membershipFakeSafeName || membershipSafeName} fa-badge-check`,
1110
+ style: {
1111
+ position: "absolute",
1112
+ top: "-2px",
1113
+ left: "-2px",
1114
+ fontSize: "0.9rem",
1115
+ zIndex: 1
1116
+ }
1117
+ }),
1118
+ /* @__PURE__ */ jsxs("div", {
1119
+ className: `d-flex align-items-center ${hasMembership && ""}`,
1120
+ children: [!hidePhoto && /* @__PURE__ */ jsx("div", {
1121
+ className: size == "lg" ? "me-0" : "me-1",
1122
+ children: /* @__PURE__ */ jsx(UserProfilePhoto, {
1123
+ width: "15px",
1124
+ profile_photo: userData.profile_photo
1125
+ })
1126
+ }), userData.display_name || populated_user?.display_name]
1127
+ }),
1128
+ /* @__PURE__ */ jsx("i", { className: "fad fa-plus-square me-0 ms-2" })
1129
+ ]
1130
+ }),
1131
+ visibleItems?.includes("Not Verified") && populated_user?.verified?.status !== "Verified" && /* @__PURE__ */ jsx(OverlayTrigger, {
1132
+ placement: "bottom",
1133
+ overlay: /* @__PURE__ */ jsx(Tooltip, {
1134
+ style: { pointerEvents: "none" },
1135
+ id: "button-tooltip",
1136
+ children: /* @__PURE__ */ jsx("div", {
1137
+ className: "",
1138
+ children: "User is not verified"
1139
+ })
1140
+ }),
1141
+ children: /* @__PURE__ */ jsxs("span", {
1142
+ className: "verification-user-badge badge bg-danger d-flex align-items-center",
1143
+ children: [/* @__PURE__ */ jsx("i", {
1144
+ style: { paddingBottom: "2px" },
1145
+ className: "fas fa-robot me-1"
1146
+ }), /* @__PURE__ */ jsx("span", {
1147
+ className: "",
1148
+ children: "Unverified"
1149
+ })]
1150
+ })
1151
+ }),
1152
+ false,
1153
+ visibleItems?.includes("Verification Status") && /* @__PURE__ */ jsx(OverlayTrigger, {
1154
+ placement: "bottom",
1155
+ overlay: /* @__PURE__ */ jsx(Tooltip, {
1156
+ id: "button-tooltip",
1157
+ style: {
1158
+ pointerEvents: "none",
1159
+ transformX: "-20px"
1160
+ },
1161
+ children: populated_user?.verified?.status == "Verified" ? "Verified" : " Not Verified"
1162
+ }),
1163
+ children: populated_user?.verified?.status == "Verified" ? /* @__PURE__ */ jsx("span", {
1164
+ className: "verification-user-badge badge bg-success cursor-pointer",
1165
+ children: /* @__PURE__ */ jsx("i", { className: "fas fa-check me-0" })
1166
+ }) : /* @__PURE__ */ jsxs("span", {
1167
+ className: "verification-user-badge badge bg-danger cursor-pointer",
1168
+ children: [/* @__PURE__ */ jsx("i", { className: "fas fa-robot me-1" }), /* @__PURE__ */ jsx("span", { children: "?" })]
1169
+ })
1170
+ }),
1171
+ visibleItems?.includes("Political Party") && /* @__PURE__ */ jsx("div", {
1172
+ className: "d-flex",
1173
+ children: (populated_user || userData)?.political?.party_id && /* @__PURE__ */ jsx(OverlayTrigger, {
1174
+ placement: "bottom",
1175
+ overlay: /* @__PURE__ */ jsxs(Tooltip, {
1176
+ id: `tooltip-bottom`,
1177
+ style: { position: "fixed" },
1178
+ children: [/* @__PURE__ */ jsx("img", {
1179
+ width: "40px",
1180
+ height: "40px",
1181
+ style: {
1182
+ objectFit: "contain",
1183
+ padding: "0px",
1184
+ zIndex: "10",
1185
+ position: "relative"
1186
+ },
1187
+ loading: "lazy",
1188
+ src: `${process.env.NEXT_PUBLIC_CDN}` + politicalParties?.find((party) => party._id == (populated_user || userData)?.political?.party_id)?.logo,
1189
+ alt: ""
1190
+ }), /* @__PURE__ */ jsx("span", {
1191
+ className: "ms-2",
1192
+ children: politicalParties?.find((party) => party._id == (populated_user || userData)?.political?.party_id)?.name
1193
+ })]
1194
+ }),
1195
+ children: /* @__PURE__ */ jsx("div", {
1196
+ className: `badge bg-light text-capitalize ms-0 h-100 d-flex justify-content-center align-items-center`,
1197
+ style: {
1198
+ padding: "0 0.15rem",
1199
+ cursor: "pointer"
1200
+ },
1201
+ children: (populated_user || userData)?.political?.party_id && ((populated_user || userData)?.political?.party_id == "62a830440593acbd4061c48c" ? /* @__PURE__ */ jsx("i", { className: "fad fa-unlink unaffiliated-icon fa-lg me-0" }) : /* @__PURE__ */ jsx("img", {
1202
+ width: "15px",
1203
+ height: "15px",
1204
+ style: {
1205
+ objectFit: "contain",
1206
+ padding: "0px"
1207
+ },
1208
+ loading: "lazy",
1209
+ src: `${process.env.NEXT_PUBLIC_CDN}` + politicalParties?.find((party) => party._id == (populated_user || userData)?.political?.party_id)?.logo,
1210
+ alt: ""
1211
+ }))
1212
+ })
1213
+ })
1214
+ })
1215
+ ]
1216
+ });
1217
+ };
1218
+ function renderModalButton(buttonType) {
1219
+ switch (buttonType) {
1220
+ case "Link": return /* @__PURE__ */ jsx("span", {
1221
+ type: "button",
1222
+ className: props.className,
1223
+ onClick: () => {
1224
+ setModalShow(true);
1225
+ },
1226
+ children
1227
+ });
1228
+ default: return /* @__PURE__ */ jsx(UserBadge, {});
1229
+ }
1230
+ }
1231
+ const [adminMode, setAdminMode] = useState(false);
1232
+ const [adminUserData, setAdminUserData] = useState({});
1233
+ const [adminUserReports, setAdminUserReports] = useState({});
1234
+ useEffect(() => {
1235
+ if (adminMode && Object.keys(adminUserData).length == 0) console.log("adminUserData", personalUserData);
1236
+ }, [adminMode]);
1237
+ const [lightboxData, setLightboxData] = useState(null);
1238
+ function saveUser() {
1239
+ alert("TODO");
1240
+ }
1241
+ const userLayoutLink = useMemo(() => {
1242
+ return userLayoutsData?.filter((layout) => {
1243
+ return layout.user_layout;
1244
+ })?.[0]?.url;
1245
+ }, [userLayoutsData]);
1246
+ return /* @__PURE__ */ jsxs(Fragment, { children: [renderModalButton(buttonType), /* @__PURE__ */ jsxs(Modal, {
1247
+ show: modalShow,
1248
+ size: "lg",
1249
+ id: "view-users-modal",
1250
+ className: "view-users-modal articles-modal",
1251
+ scrollable: true,
1252
+ onHide: handleClose,
1253
+ children: [
1254
+ /* @__PURE__ */ jsx(Modal.Header, {
1255
+ closeButton: true,
1256
+ children: /* @__PURE__ */ jsx("div", {
1257
+ className: "w-100 d-flex justify-content-between align-items-center",
1258
+ children: /* @__PURE__ */ jsx("h3", {
1259
+ className: "mb-0",
1260
+ children: "User Info"
1261
+ })
1262
+ })
1263
+ }),
1264
+ /* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsxs("div", {
1265
+ className: "main-panel",
1266
+ children: [
1267
+ /* @__PURE__ */ jsxs("div", {
1268
+ className: "d-flex",
1269
+ children: [/* @__PURE__ */ jsxs("div", {
1270
+ className: "d-flex flex-column align-items-center",
1271
+ style: { width: "100px" },
1272
+ children: [
1273
+ /* @__PURE__ */ jsx("div", {
1274
+ type: "button",
1275
+ onClick: () => {
1276
+ setLightboxData(`${process.env.NEXT_PUBLIC_CDN}${userData?.profile_photo?.key}`);
1277
+ },
1278
+ children: /* @__PURE__ */ jsx(UserProfilePhoto, {
1279
+ width: "100px",
1280
+ profile_photo: userData?.profile_photo
1281
+ })
1282
+ }),
1283
+ /* @__PURE__ */ jsx(OverlayTrigger, {
1284
+ placement: "bottom",
1285
+ overlay: /* @__PURE__ */ jsx(Tooltip, {
1286
+ id: `tooltip-bottom`,
1287
+ children: "Joined Articles Media"
1288
+ }),
1289
+ children: /* @__PURE__ */ jsxs("div", {
1290
+ className: "badge bg-black border border-white shadow-sm rounded-0",
1291
+ children: ["Joined ", userData?.sign_up_date && format(new Date(userData?.sign_up_date), "M/dd/yy")]
1292
+ })
1293
+ }),
1294
+ userLayoutLink && /* @__PURE__ */ jsx(Link, {
1295
+ href: `https://articles.media/layouts/${userLayoutLink}`,
1296
+ className: "mt-2 w-100",
1297
+ children: /* @__PURE__ */ jsxs(ArticlesButton, {
1298
+ className: "w-100",
1299
+ style: {},
1300
+ children: [/* @__PURE__ */ jsx("i", { className: "fad fa-home" }), /* @__PURE__ */ jsx("span", { children: "Layout" })]
1301
+ })
1302
+ }),
1303
+ /* @__PURE__ */ jsx(IsDev, {
1304
+ className: "w-100",
1305
+ children: /* @__PURE__ */ jsx(Link, {
1306
+ href: {
1307
+ pathname: "https://articles.media/messages",
1308
+ query: { startMsg: userData?._id }
1309
+ },
1310
+ className: "mt-2 w-100",
1311
+ children: /* @__PURE__ */ jsxs(ArticlesButton, {
1312
+ className: "w-100",
1313
+ style: { fontSize: "0.88rem" },
1314
+ children: [/* @__PURE__ */ jsx("i", { className: "fad fa-envelope" }), /* @__PURE__ */ jsx("span", { children: "Message" })]
1315
+ })
1316
+ })
1317
+ }),
1318
+ adminMode && /* @__PURE__ */ jsxs("div", {
1319
+ className: "d-flex flex-column w-100 mt-2",
1320
+ style: { maxWidth: "100px" },
1321
+ children: [/* @__PURE__ */ jsx(ArticlesButton, {
1322
+ variant: "warning",
1323
+ small: true,
1324
+ className: "",
1325
+ children: /* @__PURE__ */ jsx(Textfit, {
1326
+ max: 14,
1327
+ mode: "single",
1328
+ children: "Remove Photo"
1329
+ })
1330
+ }), adminUserData?.user?.profile_photo?.banned_uploads ? /* @__PURE__ */ jsx(ArticlesButton, {
1331
+ variant: "warning",
1332
+ small: true,
1333
+ className: "",
1334
+ onClick: () => {
1335
+ toggleBanCustomPhotoUpload();
1336
+ },
1337
+ children: /* @__PURE__ */ jsx(Textfit, {
1338
+ max: 14,
1339
+ mode: "single",
1340
+ children: "Unban Uploads"
1341
+ })
1342
+ }) : /* @__PURE__ */ jsx(ArticlesButton, {
1343
+ variant: "danger",
1344
+ small: true,
1345
+ className: "",
1346
+ onClick: () => {
1347
+ toggleBanCustomPhotoUpload();
1348
+ },
1349
+ children: /* @__PURE__ */ jsx(Textfit, {
1350
+ max: 14,
1351
+ mode: "single",
1352
+ children: "Ban Uploads"
1353
+ })
1354
+ })]
1355
+ })
1356
+ ]
1357
+ }), /* @__PURE__ */ jsxs("div", {
1358
+ className: "mx-2",
1359
+ children: [
1360
+ /* @__PURE__ */ jsxs("div", {
1361
+ className: "d-flex align-items-center mb-1",
1362
+ children: [/* @__PURE__ */ jsx("h5", {
1363
+ className: "mb-0",
1364
+ children: populated_user?.display_name || userData.display_name
1365
+ }), /* @__PURE__ */ jsxs("span", {
1366
+ className: "ms-2",
1367
+ children: [" @", userData?.username]
1368
+ })]
1369
+ }),
1370
+ userData?.articles_membership?.status == "Active" && /* @__PURE__ */ jsx(OverlayTrigger, {
1371
+ placement: "bottom",
1372
+ overlay: /* @__PURE__ */ jsx(Tooltip, {
1373
+ id: `tooltip-bottom`,
1374
+ children: /* @__PURE__ */ jsxs("div", {
1375
+ className: "d-flex flex-column py-1",
1376
+ children: [/* @__PURE__ */ jsxs("div", {
1377
+ className: "position-relative",
1378
+ children: [
1379
+ userData?.articles_membership?.plan == "Supporter" && /* @__PURE__ */ jsx("img", {
1380
+ src: `${base}supporter.jpg`,
1381
+ width: 50,
1382
+ height: 50,
1383
+ alt: "Membership plan level"
1384
+ }),
1385
+ userData?.articles_membership?.plan == "Premium Supporter" && /* @__PURE__ */ jsx("img", {
1386
+ src: `${base}premiumSupporter.jpg`,
1387
+ width: 50,
1388
+ height: 50,
1389
+ alt: "Membership plan level"
1390
+ }),
1391
+ userData?.articles_membership?.plan == "Advocate" && /* @__PURE__ */ jsx("img", {
1392
+ src: `${base}advocate.jpg`,
1393
+ width: 50,
1394
+ height: 50,
1395
+ alt: "Membership plan level"
1396
+ }),
1397
+ /* @__PURE__ */ jsx("i", {
1398
+ className: `fad membership-badge ${membershipSafeName} fa-badge-check me-1`,
1399
+ style: {
1400
+ position: "absolute",
1401
+ top: "50%",
1402
+ left: "50%",
1403
+ transform: "translateX(-50%) translateY(-50%)",
1404
+ fontSize: "1.5rem"
1405
+ }
1406
+ })
1407
+ ]
1408
+ }), /* @__PURE__ */ jsxs("span", {
1409
+ className: "lh-sm",
1410
+ children: [/* @__PURE__ */ jsx("div", { children: userData?.articles_membership?.plan }), /* @__PURE__ */ jsxs("div", {
1411
+ className: "small",
1412
+ children: ["Since ", /* @__PURE__ */ jsx(ArticlesDate, {
1413
+ format: "MM/dd/yy",
1414
+ date: userData?.articles_membership?.membership_started
1415
+ })]
1416
+ })]
1417
+ })]
1418
+ })
1419
+ }),
1420
+ children: /* @__PURE__ */ jsxs("div", {
1421
+ className: `badge bg-articles border me-1 mb-1`,
1422
+ style: { cursor: "pointer" },
1423
+ children: [
1424
+ /* @__PURE__ */ jsx("i", {
1425
+ className: `fad membership-badge ${membershipSafeName} fa-badge-check me-1`,
1426
+ style: {}
1427
+ }),
1428
+ /* @__PURE__ */ jsx("span", { children: userData?.articles_membership?.plan }),
1429
+ /* @__PURE__ */ jsx("span", {
1430
+ className: "px-1",
1431
+ children: "|"
1432
+ }),
1433
+ /* @__PURE__ */ jsx("span", {
1434
+ className: "months fw-bold",
1435
+ children: differenceInMonths(/* @__PURE__ */ new Date(), new Date(userData?.articles_membership?.membership_started)) || 0
1436
+ })
1437
+ ]
1438
+ })
1439
+ }),
1440
+ userData?.address?.state && /* @__PURE__ */ jsx(OverlayTrigger, {
1441
+ placement: "bottom",
1442
+ overlay: userData.address?.state?.length == 2 ? /* @__PURE__ */ jsxs(Tooltip, {
1443
+ id: `tooltip-bottom`,
1444
+ children: ["From the state of ", convertRegion(userData.address?.state, "name") ? convertRegion(userData.address?.state, "name")[0] : ""]
1445
+ }) : /* @__PURE__ */ jsxs(Tooltip, {
1446
+ id: `tooltip-bottom`,
1447
+ children: ["From the state of ", userData.address?.state]
1448
+ }),
1449
+ children: /* @__PURE__ */ jsxs("div", {
1450
+ className: "badge bg-articles border me-1 mb-1",
1451
+ children: [/* @__PURE__ */ jsx("i", { className: "fad fa-map-pin me-1" }), userData.address?.state]
1452
+ })
1453
+ }),
1454
+ userData.verified?.status !== "Verified" && /* @__PURE__ */ jsx(OverlayTrigger, {
1455
+ placement: "bottom",
1456
+ overlay: /* @__PURE__ */ jsx(Tooltip, {
1457
+ id: `tooltip-bottom`,
1458
+ children: "User is not verified"
1459
+ }),
1460
+ children: /* @__PURE__ */ jsxs("div", {
1461
+ className: "badge bg-danger me-1 mb-1",
1462
+ children: [/* @__PURE__ */ jsx("i", { className: "fad fa-robot me-1" }), "Unverified"]
1463
+ })
1464
+ }),
1465
+ userData.verified?.status == "Verified" && /* @__PURE__ */ jsx(OverlayTrigger, {
1466
+ placement: "bottom",
1467
+ overlay: /* @__PURE__ */ jsxs(Tooltip, {
1468
+ id: `tooltip-bottom`,
1469
+ className: "",
1470
+ children: [
1471
+ /* @__PURE__ */ jsxs("div", { children: [
1472
+ "Verified by ",
1473
+ userData.verified?.verified_methods?.length,
1474
+ " method",
1475
+ userData.verified?.verified_methods?.length > 1 && "s"
1476
+ ] }),
1477
+ /* @__PURE__ */ jsx("hr", {}),
1478
+ /* @__PURE__ */ jsx("div", {
1479
+ className: "pb-2",
1480
+ children: userData.verified?.verified_methods?.map((item, item_i) => {
1481
+ if (Object.keys(item)?.length > 0) return /* @__PURE__ */ jsx("div", {
1482
+ className: "object",
1483
+ children: item?.method_name
1484
+ }, item_i);
1485
+ else return /* @__PURE__ */ jsx("div", {
1486
+ className: "single",
1487
+ children: item
1488
+ }, item_i);
1489
+ })
1490
+ })
1491
+ ]
1492
+ }),
1493
+ children: /* @__PURE__ */ jsxs("div", {
1494
+ className: "badge bg-articles border me-1 mb-1",
1495
+ children: [/* @__PURE__ */ jsx("i", { className: "fad fa-star me-1" }), userData.verified?.status]
1496
+ })
1497
+ }),
1498
+ userData.political?.party_id && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(OverlayTrigger, {
1499
+ placement: "bottom",
1500
+ overlay: /* @__PURE__ */ jsx(Tooltip, {
1501
+ id: `tooltip-bottom`,
1502
+ children: /* @__PURE__ */ jsx("div", { children: "Users political party" })
1503
+ }),
1504
+ children: /* @__PURE__ */ jsx(Link, {
1505
+ href: `https://articles.media/politics/parties/${(populated_user || userData)?.political?.party_id}`,
1506
+ children: /* @__PURE__ */ jsx("div", {
1507
+ className: "badge bg-articles border text-capitalize me-1",
1508
+ children: /* @__PURE__ */ jsxs("div", {
1509
+ className: "",
1510
+ children: [(populated_user || userData)?.political?.party_id == "62a830440593acbd4061c48c" ? /* @__PURE__ */ jsx("i", { className: "fad fa-unlink unaffiliated-icon fa-lg me-0" }) : /* @__PURE__ */ jsx("img", {
1511
+ width: "14px",
1512
+ height: "14px",
1513
+ style: {
1514
+ objectFit: "contain",
1515
+ padding: "0px"
1516
+ },
1517
+ loading: "lazy",
1518
+ src: `${process.env.NEXT_PUBLIC_CDN}` + politicalParties?.find((party) => party._id == userData?.political?.party_id)?.logo,
1519
+ alt: ""
1520
+ }), /* @__PURE__ */ jsx("span", {
1521
+ className: "ms-1",
1522
+ children: politicalParties?.find((obj) => obj._id == userData.political?.party_id)?.name
1523
+ })]
1524
+ })
1525
+ })
1526
+ })
1527
+ }) }),
1528
+ /* @__PURE__ */ jsx("hr", {}),
1529
+ /* @__PURE__ */ jsx("div", {
1530
+ className: "small",
1531
+ children: userData?._id == "5e90cc96579a17440c5d7d52" && /* @__PURE__ */ jsx("span", { children: "Founder of Articles Media, thank you for using the site, feel free to message me with any questions, concerns or anything else." })
1532
+ })
1533
+ ]
1534
+ })]
1535
+ }),
1536
+ /* @__PURE__ */ jsx("hr", {}),
1537
+ adminMode && /* @__PURE__ */ jsxs("div", { children: [
1538
+ /* @__PURE__ */ jsx("div", {
1539
+ className: "d-flex align-items-center justify-content-between",
1540
+ children: /* @__PURE__ */ jsx("div", {
1541
+ className: "small",
1542
+ children: "Admin Mode Toolbar"
1543
+ })
1544
+ }),
1545
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
1546
+ className: "d-flex mb-2",
1547
+ children: [
1548
+ /* @__PURE__ */ jsx(ArticlesButton, {
1549
+ small: true,
1550
+ variant: "warning",
1551
+ className: "",
1552
+ onClick: () => {
1553
+ loadAdminUserData();
1554
+ },
1555
+ children: /* @__PURE__ */ jsx("i", { className: "fad fa-redo me-0" })
1556
+ }),
1557
+ /* @__PURE__ */ jsx(ArticlesButton, {
1558
+ active: adminMode?.edit,
1559
+ small: true,
1560
+ className: "",
1561
+ onClick: () => {
1562
+ setAdminMode({
1563
+ ...adminMode,
1564
+ edit: !adminMode?.edit
1565
+ });
1566
+ },
1567
+ children: "Edit Mode"
1568
+ }),
1569
+ adminMode?.edit && /* @__PURE__ */ jsx(ArticlesButton, {
1570
+ small: true,
1571
+ variant: "success",
1572
+ className: "me-0",
1573
+ onClick: () => {
1574
+ saveUser();
1575
+ },
1576
+ children: /* @__PURE__ */ jsx("i", { className: "fad fa-save me-0" })
1577
+ })
1578
+ ]
1579
+ }), [
1580
+ "User Details",
1581
+ "Verification",
1582
+ "Moderation",
1583
+ "Bans",
1584
+ "Stripe",
1585
+ "Layouts",
1586
+ "Reset Password",
1587
+ "Sessions"
1588
+ ].map((tab) => /* @__PURE__ */ jsx(ArticlesButton, {
1589
+ active: tab == adminMode?.tab,
1590
+ small: true,
1591
+ onClick: () => {
1592
+ setAdminMode({
1593
+ ...adminMode,
1594
+ tab
1595
+ });
1596
+ },
1597
+ children: tab
1598
+ }, tab))] }),
1599
+ /* @__PURE__ */ jsx("hr", {})
1600
+ ] }),
1601
+ /* @__PURE__ */ jsxs("div", {
1602
+ className: "pe-3 pb-3",
1603
+ children: [
1604
+ /* @__PURE__ */ jsx("div", {
1605
+ className: "mb-2 me-2",
1606
+ children: [
1607
+ {
1608
+ name: "Proposals Stance",
1609
+ badge: /* @__PURE__ */ jsx("span", {
1610
+ className: "badge bg-black ms-1",
1611
+ children: /* @__PURE__ */ jsxs("div", {
1612
+ className: "small",
1613
+ children: [
1614
+ /* @__PURE__ */ jsx("span", { children: usersProposalSentiments?.fundamental?.filter((obj) => {
1615
+ if (usersProposalSentiments?.user_sentiments?.find((sen) => sen.proposal_id == obj._id)) return obj;
1616
+ else return null;
1617
+ }).length }),
1618
+ /* @__PURE__ */ jsx("span", {
1619
+ className: "px-1",
1620
+ children: "/"
1621
+ }),
1622
+ /* @__PURE__ */ jsx("span", { children: usersProposalSentiments?.fundamental?.length })
1623
+ ]
1624
+ })
1625
+ })
1626
+ },
1627
+ {
1628
+ name: "Proposal Sentiments",
1629
+ badge: /* @__PURE__ */ jsx("span", {
1630
+ className: "badge bg-black ms-1",
1631
+ children: userData?.populated_public_proposals_stance?.user_sentiments_count || 0
1632
+ })
1633
+ },
1634
+ {
1635
+ name: "Proposal Comments",
1636
+ badge: /* @__PURE__ */ jsx("span", {
1637
+ className: "badge bg-black ms-1",
1638
+ children: userData?.populated_public_proposals_stance?.user_comments_count || 0
1639
+ })
1640
+ },
1641
+ {
1642
+ name: "Proposal Submissions",
1643
+ badge: /* @__PURE__ */ jsx("span", {
1644
+ className: "badge bg-black ms-1",
1645
+ children: userProposalsSubmitted?.length || 0
1646
+ })
1647
+ },
1648
+ {
1649
+ name: "News Comments",
1650
+ badge: /* @__PURE__ */ jsx("span", {
1651
+ className: "badge bg-black ms-1",
1652
+ children: userData?.populated_news_comments_count || 0
1653
+ })
1654
+ },
1655
+ {
1656
+ name: "News Submissions",
1657
+ badge: /* @__PURE__ */ jsx("span", {
1658
+ className: "badge bg-black ms-1",
1659
+ children: userNewsSubmitted?.length || 0
1660
+ })
1661
+ },
1662
+ {
1663
+ name: "Verifications",
1664
+ badge: /* @__PURE__ */ jsx("span", {
1665
+ className: "badge bg-black ms-1",
1666
+ children: userData.verified?.verified_methods?.length || 0
1667
+ })
1668
+ },
1669
+ {
1670
+ name: "Layouts",
1671
+ badge: /* @__PURE__ */ jsx("span", {
1672
+ className: "badge bg-black ms-1",
1673
+ children: userLayoutsData?.length || 0
1674
+ })
1675
+ },
1676
+ {
1677
+ name: "Donations",
1678
+ badge: /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
1679
+ className: "badge bg-primary ms-1",
1680
+ children: publicUserData?.populated_public_donations?.count || 0
1681
+ }), /* @__PURE__ */ jsxs("span", {
1682
+ className: "badge bg-black",
1683
+ children: ["$", numberWithCommas((publicUserData?.populated_public_donations.total / 100).toFixed(2))]
1684
+ })] })
1685
+ },
1686
+ {
1687
+ name: "Orders",
1688
+ badge: /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
1689
+ className: "badge bg-primary ms-1",
1690
+ children: "0"
1691
+ }), /* @__PURE__ */ jsx("span", {
1692
+ className: "badge bg-black",
1693
+ children: "0"
1694
+ })] })
1695
+ },
1696
+ {
1697
+ name: "Achievements",
1698
+ dev: true,
1699
+ badge: /* @__PURE__ */ jsx("span", {
1700
+ className: "badge bg-black ms-1",
1701
+ children: "0"
1702
+ })
1703
+ }
1704
+ ].map((obj) => {
1705
+ obj.name, obj.name, obj.badge, obj.name;
1706
+ if (obj.dev) return /* @__PURE__ */ jsx(IsDev, {
1707
+ inline: true,
1708
+ children: /* @__PURE__ */ jsxs(ArticlesButton, {
1709
+ onClick: () => setContentDisplayTab(obj.name),
1710
+ active: obj.name == contentDisplayTab,
1711
+ small: true,
1712
+ children: [obj.name, obj.badge]
1713
+ }, obj.name)
1714
+ }, obj.name);
1715
+ else return /* @__PURE__ */ jsxs(ArticlesButton, {
1716
+ onClick: () => setContentDisplayTab(obj.name),
1717
+ active: obj.name == contentDisplayTab,
1718
+ small: true,
1719
+ children: [obj.name, obj.badge]
1720
+ }, obj.name);
1721
+ })
1722
+ }),
1723
+ contentDisplayTab == "Proposals Stance" && /* @__PURE__ */ jsx(ProposalsStance, {
1724
+ activeLayoutProposalSentiments,
1725
+ populated_user,
1726
+ usersProposalSentiments,
1727
+ setShowFullStanceDetails,
1728
+ showFullStanceDetails,
1729
+ userData
1730
+ }),
1731
+ contentDisplayTab == "Proposal Comments" && /* @__PURE__ */ jsx(ProposalComments, { activeLayoutProposalSentiments }),
1732
+ contentDisplayTab == "Proposal Sentiments" && /* @__PURE__ */ jsx(ProposalSentiments, { activeLayoutProposalSentiments }),
1733
+ contentDisplayTab == "Proposal Submissions" && /* @__PURE__ */ jsx(ProposalSubmissions, { userProposalsSubmitted: publicUserData?.populated_public_proposals }),
1734
+ contentDisplayTab == "News Comments" && /* @__PURE__ */ jsx(NewsComments, { publicUserData }),
1735
+ contentDisplayTab == "News Submissions" && /* @__PURE__ */ jsx(NewsSubmissions, {
1736
+ publicUserData,
1737
+ userNewsSubmitted: publicUserData?.populated_public_news_submissions
1738
+ }),
1739
+ contentDisplayTab == "Donations" && /* @__PURE__ */ jsx(Donations, {
1740
+ publicUserData,
1741
+ userDonations: publicUserData?.populated_public_donations,
1742
+ lifetimeContribution
1743
+ }),
1744
+ contentDisplayTab == "Layouts" && /* @__PURE__ */ jsx(Layouts, {
1745
+ publicUserData,
1746
+ userLayoutsData: publicUserData?.populated_public_layouts
1747
+ }),
1748
+ contentDisplayTab == "Verifications" && /* @__PURE__ */ jsx(Verifications, {
1749
+ publicUserData,
1750
+ userData
1751
+ }),
1752
+ contentDisplayTab == "Achievements" && /* @__PURE__ */ jsx(Achievements, { publicUserData })
1753
+ ]
1754
+ })
1755
+ ]
1756
+ }) }),
1757
+ /* @__PURE__ */ jsxs(Modal.Footer, {
1758
+ className: "justify-content-between",
1759
+ children: [userReduxState?._id == "5e90cc96579a17440c5d7d52" ? /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsxs(IsDev, {
1760
+ inline: true,
1761
+ className: "me-2",
1762
+ children: [/* @__PURE__ */ jsxs(ArticlesButton, {
1763
+ onClick: () => {
1764
+ if (adminMode) setAdminMode(false);
1765
+ else setAdminMode({ tab: "" });
1766
+ },
1767
+ small: true,
1768
+ active: adminMode,
1769
+ variant: "",
1770
+ className: "me-1",
1771
+ children: [/* @__PURE__ */ jsx("i", { className: "fad fa-pen" }), /* @__PURE__ */ jsx("span", { children: "Admin Mode" })]
1772
+ }), /* @__PURE__ */ jsx(ArticlesButton, {
1773
+ onClick: () => {
1774
+ publicUserDataMutate();
1775
+ personalUserDataMutate();
1776
+ },
1777
+ small: true,
1778
+ variant: "warning",
1779
+ className: "",
1780
+ children: /* @__PURE__ */ jsx("i", { className: "fad fa-redo me-0" })
1781
+ })]
1782
+ }), /* @__PURE__ */ jsx("span", {
1783
+ style: { fontSize: "0.8rem" },
1784
+ children: userData?._id
1785
+ })] }) : /* @__PURE__ */ jsx("span", {}), /* @__PURE__ */ jsx("div", {
1786
+ className: "justify-content-",
1787
+ children: /* @__PURE__ */ jsx(ArticlesButton, {
1788
+ variant: "articles",
1789
+ onClick: handleClose,
1790
+ children: "Close"
1791
+ })
1792
+ })]
1793
+ })
1794
+ ]
1795
+ })] });
1796
+ }
1797
+ //#endregion
1798
+ export { ViewUserModal as t };