[skip ci] feat: prepare for public release
This commit is contained in:
@@ -100,3 +100,7 @@
|
||||
border-top: 1px solid var(--background-header-secondary);
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
.claimButton {
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import {observer} from 'mobx-react-lite';
|
||||
import type React from 'react';
|
||||
import * as ModalActionCreators from '~/actions/ModalActionCreators';
|
||||
import {modal} from '~/actions/ModalActionCreators';
|
||||
import {ClaimAccountModal} from '~/components/modals/ClaimAccountModal';
|
||||
import {openClaimAccountModal} from '~/components/modals/ClaimAccountModal';
|
||||
import {EmailChangeModal} from '~/components/modals/EmailChangeModal';
|
||||
import {PasswordChangeModal} from '~/components/modals/PasswordChangeModal';
|
||||
import {SettingsTabSection} from '~/components/modals/shared/SettingsTabLayout';
|
||||
@@ -94,7 +94,7 @@ export const AccountTabContent: React.FC<AccountTabProps> = observer(
|
||||
<Trans>No email address set</Trans>
|
||||
</div>
|
||||
</div>
|
||||
<Button small={true} onClick={() => ModalActionCreators.push(modal(() => <ClaimAccountModal />))}>
|
||||
<Button small={true} className={styles.claimButton} fitContent onClick={() => openClaimAccountModal()}>
|
||||
<Trans>Add Email</Trans>
|
||||
</Button>
|
||||
</div>
|
||||
@@ -134,7 +134,7 @@ export const AccountTabContent: React.FC<AccountTabProps> = observer(
|
||||
<Trans>No password set</Trans>
|
||||
</div>
|
||||
</div>
|
||||
<Button small={true} onClick={() => ModalActionCreators.push(modal(() => <ClaimAccountModal />))}>
|
||||
<Button small={true} className={styles.claimButton} fitContent onClick={() => openClaimAccountModal()}>
|
||||
<Trans>Set Password</Trans>
|
||||
</Button>
|
||||
</>
|
||||
|
||||
@@ -96,3 +96,7 @@
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.claimButton {
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import * as ModalActionCreators from '~/actions/ModalActionCreators';
|
||||
import {modal} from '~/actions/ModalActionCreators';
|
||||
import * as UserActionCreators from '~/actions/UserActionCreators';
|
||||
import {BackupCodesViewModal} from '~/components/modals/BackupCodesViewModal';
|
||||
import {ClaimAccountModal} from '~/components/modals/ClaimAccountModal';
|
||||
import {openClaimAccountModal} from '~/components/modals/ClaimAccountModal';
|
||||
import {ConfirmModal} from '~/components/modals/ConfirmModal';
|
||||
import {MfaTotpDisableModal} from '~/components/modals/MfaTotpDisableModal';
|
||||
import {MfaTotpEnableModal} from '~/components/modals/MfaTotpEnableModal';
|
||||
@@ -202,7 +202,7 @@ export const SecurityTabContent: React.FC<SecurityTabProps> = observer(
|
||||
<Trans>Claim your account to access security features like two-factor authentication and passkeys.</Trans>
|
||||
}
|
||||
>
|
||||
<Button onClick={() => ModalActionCreators.push(modal(() => <ClaimAccountModal />))}>
|
||||
<Button className={styles.claimButton} fitContent onClick={() => openClaimAccountModal()}>
|
||||
<Trans>Claim Account</Trans>
|
||||
</Button>
|
||||
</SettingsTabSection>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {Trans} from '@lingui/react/macro';
|
||||
import {Trans, useLingui} from '@lingui/react/macro';
|
||||
import {BookOpenIcon, WarningCircleIcon} from '@phosphor-icons/react';
|
||||
import {observer} from 'mobx-react-lite';
|
||||
import React from 'react';
|
||||
@@ -38,12 +38,16 @@ import styles from '~/components/modals/tabs/ApplicationsTab/ApplicationsTab.mod
|
||||
import ApplicationsTabStore from '~/components/modals/tabs/ApplicationsTab/ApplicationsTabStore';
|
||||
import {Button} from '~/components/uikit/Button/Button';
|
||||
import {Spinner} from '~/components/uikit/Spinner';
|
||||
import {Tooltip} from '~/components/uikit/Tooltip/Tooltip';
|
||||
import type {DeveloperApplication} from '~/records/DeveloperApplicationRecord';
|
||||
import UserStore from '~/stores/UserStore';
|
||||
|
||||
const ApplicationsTab: React.FC = observer(() => {
|
||||
const {t} = useLingui();
|
||||
const {checkUnsavedChanges} = useUnsavedChangesFlash('applications');
|
||||
const {setContentKey} = useSettingsContentKey();
|
||||
const store = ApplicationsTabStore;
|
||||
const isUnclaimed = !(UserStore.currentUser?.isClaimed() ?? false);
|
||||
|
||||
React.useLayoutEffect(() => {
|
||||
setContentKey(store.contentKey);
|
||||
@@ -138,9 +142,19 @@ const ApplicationsTab: React.FC = observer(() => {
|
||||
description={<Trans>Create and manage applications and bots for your account.</Trans>}
|
||||
>
|
||||
<div className={styles.buttonContainer}>
|
||||
<Button variant="primary" fitContainer={false} fitContent onClick={openCreateModal}>
|
||||
<Trans>Create Application</Trans>
|
||||
</Button>
|
||||
{isUnclaimed ? (
|
||||
<Tooltip text={t`Claim your account to create applications.`}>
|
||||
<div>
|
||||
<Button variant="primary" fitContainer={false} fitContent onClick={openCreateModal} disabled>
|
||||
<Trans>Create Application</Trans>
|
||||
</Button>
|
||||
</div>
|
||||
</Tooltip>
|
||||
) : (
|
||||
<Button variant="primary" fitContainer={false} fitContent onClick={openCreateModal}>
|
||||
<Trans>Create Application</Trans>
|
||||
</Button>
|
||||
)}
|
||||
<a className={styles.documentationLink} href="https://fluxer.dev" target="_blank" rel="noreferrer">
|
||||
<BookOpenIcon weight="fill" size={18} className={styles.documentationIcon} />
|
||||
<Trans>Read the Documentation (fluxer.dev)</Trans>
|
||||
|
||||
@@ -25,6 +25,7 @@ import {observer} from 'mobx-react-lite';
|
||||
import React from 'react';
|
||||
import * as BetaCodeActionCreators from '~/actions/BetaCodeActionCreators';
|
||||
import * as TextCopyActionCreators from '~/actions/TextCopyActionCreators';
|
||||
import {openClaimAccountModal} from '~/components/modals/ClaimAccountModal';
|
||||
import {
|
||||
SettingsTabContainer,
|
||||
SettingsTabContent,
|
||||
@@ -39,6 +40,7 @@ import {Tooltip} from '~/components/uikit/Tooltip/Tooltip';
|
||||
import type {BetaCodeRecord} from '~/records/BetaCodeRecord';
|
||||
import BetaCodeStore from '~/stores/BetaCodeStore';
|
||||
import MobileLayoutStore from '~/stores/MobileLayoutStore';
|
||||
import UserStore from '~/stores/UserStore';
|
||||
import * as DateUtils from '~/utils/DateUtils';
|
||||
import styles from './BetaCodesTab.module.css';
|
||||
|
||||
@@ -247,10 +249,12 @@ const BetaCodesTab: React.FC = observer(() => {
|
||||
const fetchStatus = BetaCodeStore.fetchStatus;
|
||||
const allowance = BetaCodeStore.allowance;
|
||||
const nextResetAt = BetaCodeStore.nextResetAt;
|
||||
const isClaimed = UserStore.currentUser?.isClaimed() ?? false;
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!isClaimed) return;
|
||||
BetaCodeActionCreators.fetch();
|
||||
}, []);
|
||||
}, [isClaimed]);
|
||||
|
||||
const sortedBetaCodes = React.useMemo(() => {
|
||||
return [...betaCodes].sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
|
||||
@@ -280,6 +284,27 @@ const BetaCodesTab: React.FC = observer(() => {
|
||||
return i18n._(msg`${allowance} codes remaining this week`);
|
||||
}, [allowance, nextResetAt, i18n]);
|
||||
|
||||
if (!isClaimed) {
|
||||
return (
|
||||
<SettingsTabContainer>
|
||||
<SettingsTabContent>
|
||||
<StatusSlate
|
||||
Icon={TicketIcon}
|
||||
title={<Trans>Claim your account</Trans>}
|
||||
description={<Trans>Claim your account to generate beta codes.</Trans>}
|
||||
actions={[
|
||||
{
|
||||
text: <Trans>Claim Account</Trans>,
|
||||
onClick: () => openClaimAccountModal({force: true}),
|
||||
variant: 'primary',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</SettingsTabContent>
|
||||
</SettingsTabContainer>
|
||||
);
|
||||
}
|
||||
|
||||
if (fetchStatus === 'pending' || fetchStatus === 'idle') {
|
||||
return (
|
||||
<div className={styles.spinnerContainer}>
|
||||
|
||||
@@ -24,7 +24,7 @@ import {useCallback, useState} from 'react';
|
||||
import * as ModalActionCreators from '~/actions/ModalActionCreators';
|
||||
import {testBulkDeleteAllMessages} from '~/actions/UserActionCreators';
|
||||
import {CaptchaModal} from '~/components/modals/CaptchaModal';
|
||||
import {ClaimAccountModal} from '~/components/modals/ClaimAccountModal';
|
||||
import {openClaimAccountModal} from '~/components/modals/ClaimAccountModal';
|
||||
import {KeyboardModeIntroModal} from '~/components/modals/KeyboardModeIntroModal';
|
||||
import {Button} from '~/components/uikit/Button/Button';
|
||||
import type {GatewaySocket} from '~/lib/GatewaySocket';
|
||||
@@ -67,7 +67,7 @@ export const ToolsTabContent: React.FC<ToolsTabContentProps> = observer(({socket
|
||||
}, []);
|
||||
|
||||
const handleOpenClaimAccountModal = useCallback(() => {
|
||||
ModalActionCreators.push(ModalActionCreators.modal(() => <ClaimAccountModal />));
|
||||
openClaimAccountModal({force: true});
|
||||
}, []);
|
||||
|
||||
if (shouldCrash) {
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
box-sizing: border-box;
|
||||
padding: 1rem;
|
||||
border-radius: 0.5rem;
|
||||
border: 1px solid var(--background-header-secondary);
|
||||
@@ -117,6 +118,8 @@
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
@@ -129,15 +132,39 @@
|
||||
}
|
||||
|
||||
.authSessionLocation {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-primary-muted);
|
||||
min-width: 0;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.locationText {
|
||||
flex: 0 1 auto;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.locationSeparator {
|
||||
background-color: var(--background-modifier-accent);
|
||||
width: 0.25rem;
|
||||
height: 0.25rem;
|
||||
border-radius: 9999px;
|
||||
display: inline-block;
|
||||
flex-shrink: 0;
|
||||
opacity: 0.8;
|
||||
margin: 0 0.15rem;
|
||||
}
|
||||
|
||||
.lastUsed {
|
||||
font-size: 0.75rem;
|
||||
flex-shrink: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.authSessionActions {
|
||||
@@ -228,17 +255,11 @@
|
||||
}
|
||||
|
||||
.devicesGrid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(1, minmax(0, 1fr));
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.devicesGrid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
.logoutSection {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -115,10 +115,10 @@ const AuthSession: React.FC<AuthSessionProps> = observer(
|
||||
</span>
|
||||
|
||||
<div className={styles.authSessionLocation}>
|
||||
{authSession.clientLocation}
|
||||
<span className={styles.locationText}>{authSession.clientLocation}</span>
|
||||
{!isCurrent && (
|
||||
<>
|
||||
<StatusDot />
|
||||
<span aria-hidden className={styles.locationSeparator} />
|
||||
<span className={styles.lastUsed}>
|
||||
{DateUtils.getShortRelativeDateString(authSession.approxLastUsedAt ?? new Date(0))}
|
||||
</span>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
import {Trans, useLingui} from '@lingui/react/macro';
|
||||
import {CaretDownIcon, CheckIcon, CopyIcon, GiftIcon, NetworkSlashIcon} from '@phosphor-icons/react';
|
||||
import {CaretDownIcon, CheckIcon, CopyIcon, GiftIcon, NetworkSlashIcon, WarningCircleIcon} from '@phosphor-icons/react';
|
||||
import {clsx} from 'clsx';
|
||||
import {observer} from 'mobx-react-lite';
|
||||
import React from 'react';
|
||||
@@ -31,6 +31,7 @@ import * as UserActionCreators from '~/actions/UserActionCreators';
|
||||
import {UserPremiumTypes} from '~/Constants';
|
||||
import {Form} from '~/components/form/Form';
|
||||
import {Input} from '~/components/form/Input';
|
||||
import {openClaimAccountModal} from '~/components/modals/ClaimAccountModal';
|
||||
import {StatusSlate} from '~/components/modals/shared/StatusSlate';
|
||||
import {Button} from '~/components/uikit/Button/Button';
|
||||
import {Spinner} from '~/components/uikit/Spinner';
|
||||
@@ -180,6 +181,7 @@ const GiftInventoryTab: React.FC = observer(() => {
|
||||
const [loading, setLoading] = React.useState(true);
|
||||
const [error, setError] = React.useState(false);
|
||||
const [expandedGiftId, setExpandedGiftId] = React.useState<string | null>(null);
|
||||
const isUnclaimed = !(UserStore.currentUser?.isClaimed() ?? false);
|
||||
|
||||
const giftCodeForm = useForm<GiftCodeFormInputs>({defaultValues: {code: ''}});
|
||||
|
||||
@@ -201,6 +203,10 @@ const GiftInventoryTab: React.FC = observer(() => {
|
||||
});
|
||||
|
||||
const fetchGifts = React.useCallback(async () => {
|
||||
if (isUnclaimed) {
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
setError(false);
|
||||
const userGifts = await GiftActionCreators.fetchUserGifts();
|
||||
@@ -211,7 +217,7 @@ const GiftInventoryTab: React.FC = observer(() => {
|
||||
setError(true);
|
||||
setLoading(false);
|
||||
}
|
||||
}, []);
|
||||
}, [isUnclaimed]);
|
||||
|
||||
React.useEffect(() => {
|
||||
fetchGifts();
|
||||
@@ -225,6 +231,23 @@ const GiftInventoryTab: React.FC = observer(() => {
|
||||
fetchGifts();
|
||||
};
|
||||
|
||||
if (isUnclaimed) {
|
||||
return (
|
||||
<StatusSlate
|
||||
Icon={WarningCircleIcon}
|
||||
title={<Trans>Claim your account</Trans>}
|
||||
description={<Trans>Claim your account to redeem or manage Plutonium gift codes.</Trans>}
|
||||
actions={[
|
||||
{
|
||||
text: <Trans>Claim Account</Trans>,
|
||||
onClick: () => openClaimAccountModal({force: true}),
|
||||
variant: 'primary',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user