@opexa/portal-components 0.0.410 → 0.0.411
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.
- package/dist/components/Quests/DailyCheckInQuest.d.ts +2 -0
- package/dist/components/Quests/DailyCheckInQuest.js +7 -3
- package/dist/components/Quests/Quests.client.d.ts +1 -0
- package/dist/components/Quests/Quests.client.js +2 -2
- package/dist/icons/MinusIcon.d.ts +2 -0
- package/dist/icons/MinusIcon.js +4 -0
- package/package.json +1 -1
|
@@ -8,6 +8,8 @@ export interface ClassNameEntries {
|
|
|
8
8
|
calendarDayText?: string;
|
|
9
9
|
checkInButton?: string;
|
|
10
10
|
}
|
|
11
|
+
export type UncompletedIconType = 'x' | 'minus';
|
|
11
12
|
export declare function DailyCheckInQuest(props: {
|
|
12
13
|
className?: string | ClassNameEntries;
|
|
14
|
+
uncompletedIcon?: UncompletedIconType;
|
|
13
15
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,6 +11,7 @@ import { useRemainingTime } from '../../client/hooks/useRemainingTime.js';
|
|
|
11
11
|
import { toaster } from '../../client/utils/toaster.js';
|
|
12
12
|
import { CheckIcon } from '../../icons/CheckIcon.js';
|
|
13
13
|
import { InfoCircleIcon } from '../../icons/InfoCircleIcon.js';
|
|
14
|
+
import { MinusIcon } from '../../icons/MinusIcon.js';
|
|
14
15
|
import { XIcon } from '../../icons/XIcon.js';
|
|
15
16
|
import { Button } from '../../ui/Button/index.js';
|
|
16
17
|
import { Dialog } from '../../ui/Dialog/index.js';
|
|
@@ -24,7 +25,7 @@ import { getAvailableQuestsQueryKey } from '../../utils/queryKeys.js';
|
|
|
24
25
|
import { useQuestContext } from './QuestsContext.js';
|
|
25
26
|
import { RemainingTime } from './RemainingTime.js';
|
|
26
27
|
export function DailyCheckInQuest(props) {
|
|
27
|
-
const { className } = props;
|
|
28
|
+
const { className, uncompletedIcon = 'x' } = props;
|
|
28
29
|
const classNames = isString(className) ? { root: className } : className;
|
|
29
30
|
const quest = useQuestContext();
|
|
30
31
|
const disclosure = useDisclosure();
|
|
@@ -50,7 +51,7 @@ export function DailyCheckInQuest(props) {
|
|
|
50
51
|
onSuccess() {
|
|
51
52
|
toaster.success({
|
|
52
53
|
title: 'Check-in successful 🎉',
|
|
53
|
-
description: '
|
|
54
|
+
description: "You've successfully checked in for today! Keep it up to maintain your streak!",
|
|
54
55
|
});
|
|
55
56
|
},
|
|
56
57
|
onError(e) {
|
|
@@ -61,13 +62,16 @@ export function DailyCheckInQuest(props) {
|
|
|
61
62
|
},
|
|
62
63
|
});
|
|
63
64
|
const remainingTime = useRemainingTime(endDateTime);
|
|
65
|
+
const renderUncompletedIcon = () => {
|
|
66
|
+
return uncompletedIcon === 'minus' ? (_jsx(MinusIcon, { className: "size-2" })) : (_jsx(XIcon, { className: "size-4" }));
|
|
67
|
+
};
|
|
64
68
|
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: twMerge('flex h-full w-full flex-col space-y-6 rounded-2xl border border-border-primary bg-bg-tertiary px-4 pt-5 pb-6', classNames?.root), children: [_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsxs("div", { className: "flex max-h-7.5 items-start justify-between", children: [_jsx(RemainingTime, {}), _jsx("button", { type: "button", className: "flex size-9 cursor-pointer items-center justify-center rounded-md border border-border-secondary bg-bg-primary", onClick: () => disclosure.setOpen(true), "aria-label": "View Rules", children: _jsx(InfoCircleIcon, { className: "size-5 text-text-disabled" }) })] }), _jsx("p", { className: "font-semibold text-xl", children: name }), _jsx(Prose, { className: "text-wrap font-normal text-sm text-text-secondary-700", dangerouslySetInnerHTML: { __html: description } })] }), _jsxs("div", { className: "flex w-full flex-col space-y-2", children: [_jsx("div", { className: "grid grid-cols-7", children: dailyCheckedInData.map((item) => {
|
|
65
69
|
const done = item.day <= (checkInStreak ?? 0);
|
|
66
70
|
const reward = item.reward ? (`+${formatNumber(item.reward, {
|
|
67
71
|
currency: localeInfo.currency.code,
|
|
68
72
|
minDecimalPlaces: 0,
|
|
69
73
|
maxDecimalPlaces: 0,
|
|
70
|
-
})}`) : done ? (_jsx(CheckIcon, { className: "size-4" })) : (
|
|
74
|
+
})}`) : done ? (_jsx(CheckIcon, { className: "size-4" })) : (renderUncompletedIcon());
|
|
71
75
|
return (_jsx("div", { className: twMerge('flex items-center justify-center', done ? 'text-brand-400' : 'text-text-secondary-700', classNames?.rewardContainer), children: _jsx("p", { children: reward }) }, item.day));
|
|
72
76
|
}) }), _jsx("div", { className: twMerge('h-2 w-full overflow-hidden rounded-full bg-bg-primary', classNames?.progressBarContainer), children: _jsx("div", { className: twMerge('h-full rounded-full bg-utility-brand-600 transition-all duration-300', classNames?.progressBar), style: { width: `${progressPercentage}%` } }) }), _jsx("div", { className: "grid grid-cols-7 place-items-center", children: dailyCheckedInData.map((item) => (_jsxs("div", { className: twMerge('group relative size-fit text-text-secondary-700 ui-active:text-brand-400', classNames?.calendarIconContainer), "data-active": dataAttr(item.day <= (checkInStreak ?? 0)), children: [_jsx(CalendarIcon, { className: twMerge('h-4.5 w-auto', classNames?.calendarIcon) }), _jsx("p", { className: twMerge('-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 text-2xs leading-none', classNames?.calendarDayText), children: item.day })] }, item.day))) })] }), _jsx(Button, { onClick: () => checkInDailyQuestMutation.mutate(id), className: twMerge('disabled:bg-bg-primary disabled:text-text-disabled', classNames?.checkInButton), disabled: status === 'COMPLETED' ||
|
|
73
77
|
status === 'FAILED' ||
|
|
@@ -11,5 +11,6 @@ export interface QuestsProps {
|
|
|
11
11
|
heading?: string | ReactNode;
|
|
12
12
|
className?: string | ClassNameEntries;
|
|
13
13
|
style?: CSSProperties;
|
|
14
|
+
uncompletedIcon?: 'x' | 'minus';
|
|
14
15
|
}
|
|
15
16
|
export declare function Quests__client(props: QuestsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { isString } from 'lodash-es';
|
|
4
4
|
import Image from 'next/image';
|
|
5
|
-
import { useState } from 'react';
|
|
5
|
+
import { useState, } from 'react';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import { useAvailableQuestsQuery } from '../../client/hooks/useAvailableQuestsQuery.js';
|
|
@@ -56,6 +56,6 @@ export function Quests__client(props) {
|
|
|
56
56
|
? classNames?.wageringQuest
|
|
57
57
|
: quest.type === 'DAILY_CHECKIN'
|
|
58
58
|
? classNames?.dailyCheckInQuest
|
|
59
|
-
: '' }) }, quest.id));
|
|
59
|
+
: '', uncompletedIcon: props.uncompletedIcon }) }, quest.id));
|
|
60
60
|
}) })] }));
|
|
61
61
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export function MinusIcon(props) {
|
|
3
|
+
return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "6", height: "2", fill: "none", viewBox: "0 0 6 2", ...props, children: _jsx("path", { fill: "#344054", d: "M5.224.347v1.471H.064V.347z" }) }));
|
|
4
|
+
}
|