Merge branch 'release/3.8.26' into main
This commit is contained in:
@@ -37,12 +37,22 @@ const PREFERENCES_MENU_ITEMS: PreferencesMenuItem[] = [
|
|||||||
{ id: 'help-feedback', label: 'Help & feedback', icon: 'help' },
|
{ id: 'help-feedback', label: 'Help & feedback', icon: 'help' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const READY_PREFERENCES_MENU_ITEMS: PreferencesMenuItem[] = [
|
||||||
|
{ id: 'general', label: 'General', icon: 'settings' },
|
||||||
|
{ id: 'account', label: 'Account', icon: 'user' },
|
||||||
|
{ id: 'security', label: 'Security', icon: 'security' },
|
||||||
|
{ id: 'listed', label: 'Listed', icon: 'listed' },
|
||||||
|
{ id: 'help-feedback', label: 'Help & feedback', icon: 'help' },
|
||||||
|
];
|
||||||
|
|
||||||
export class PreferencesMenu {
|
export class PreferencesMenu {
|
||||||
private _selectedPane: PreferenceId = 'general';
|
private _selectedPane: PreferenceId = 'general';
|
||||||
|
private _menu: PreferencesMenuItem[];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _menu: PreferencesMenuItem[] = PREFERENCES_MENU_ITEMS
|
private readonly _enableUnfinishedFeatures: boolean,
|
||||||
) {
|
) {
|
||||||
|
this._menu = this._enableUnfinishedFeatures ? PREFERENCES_MENU_ITEMS : READY_PREFERENCES_MENU_ITEMS;
|
||||||
makeAutoObservable<PreferencesMenu, '_selectedPane' | '_twoFactorAuth'>(
|
makeAutoObservable<PreferencesMenu, '_selectedPane' | '_twoFactorAuth'>(
|
||||||
this,
|
this,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -75,7 +75,9 @@ const PreferencesCanvas: FunctionComponent<
|
|||||||
|
|
||||||
export const PreferencesView: FunctionComponent<PreferencesProps> = observer(
|
export const PreferencesView: FunctionComponent<PreferencesProps> = observer(
|
||||||
(props) => {
|
(props) => {
|
||||||
const menu = useMemo(() => new PreferencesMenu(), []);
|
const menu = useMemo(() => new PreferencesMenu(props.appState.enableUnfinishedFeatures), [
|
||||||
|
props.appState.enableUnfinishedFeatures
|
||||||
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
menu.selectPane(props.appState.preferences.currentPane);
|
menu.selectPane(props.appState.preferences.currentPane);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export const AccountPreferences = observer(
|
|||||||
return (
|
return (
|
||||||
<PreferencesPane>
|
<PreferencesPane>
|
||||||
<Authentication application={application} appState={appState} />
|
<Authentication application={application} appState={appState} />
|
||||||
<SubscriptionWrapper application={application} />
|
{appState.enableUnfinishedFeatures && <SubscriptionWrapper application={application} />}
|
||||||
<SignOutWrapper application={application} appState={appState} />
|
<SignOutWrapper application={application} appState={appState} />
|
||||||
</PreferencesPane>
|
</PreferencesPane>
|
||||||
);
|
);
|
||||||
@@ -32,6 +32,7 @@ export const AccountPreferences = observer(
|
|||||||
<PreferencesPane>
|
<PreferencesPane>
|
||||||
<Credentials application={application} />
|
<Credentials application={application} />
|
||||||
<Sync application={application} />
|
<Sync application={application} />
|
||||||
|
{appState.enableUnfinishedFeatures && <SubscriptionWrapper application={application} />}
|
||||||
<SignOutWrapper application={application} appState={appState} />
|
<SignOutWrapper application={application} appState={appState} />
|
||||||
</PreferencesPane>
|
</PreferencesPane>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export const Subscription: FunctionComponent<Props> = observer(({
|
|||||||
application,
|
application,
|
||||||
subscriptionState,
|
subscriptionState,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(false);
|
||||||
const [error, setError] = useState(false);
|
const [error, setError] = useState(false);
|
||||||
|
|
||||||
const { userSubscription } = subscriptionState;
|
const { userSubscription } = subscriptionState;
|
||||||
@@ -59,8 +59,10 @@ export const Subscription: FunctionComponent<Props> = observer(({
|
|||||||
}, [getSubscription, getSubscriptions]);
|
}, [getSubscription, getSubscriptions]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getSubscriptionInfo();
|
if (application.hasAccount()) {
|
||||||
}, [getSubscriptionInfo]);
|
getSubscriptionInfo();
|
||||||
|
}
|
||||||
|
}, [application, getSubscriptionInfo]);
|
||||||
|
|
||||||
const now = new Date().getTime();
|
const now = new Date().getTime();
|
||||||
|
|
||||||
@@ -71,7 +73,7 @@ export const Subscription: FunctionComponent<Props> = observer(({
|
|||||||
<div className="flex-grow flex flex-col">
|
<div className="flex-grow flex flex-col">
|
||||||
<Title>Subscription</Title>
|
<Title>Subscription</Title>
|
||||||
{error ? (
|
{error ? (
|
||||||
<NoSubscription application={application} />
|
<Text>No subscription information available.</Text>
|
||||||
) : loading ? (
|
) : loading ? (
|
||||||
<Text>Loading subscription information...</Text>
|
<Text>Loading subscription information...</Text>
|
||||||
) : userSubscription && userSubscription.endsAt > now ? (
|
) : userSubscription && userSubscription.endsAt > now ? (
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
)
|
)
|
||||||
.sk-app-bar-item.ml-0-important(
|
.sk-app-bar-item.ml-0-important(
|
||||||
ng-click='ctrl.clickPreferences()'
|
ng-click='ctrl.clickPreferences()'
|
||||||
ng-if='ctrl.appState.enableUnfinishedFeatures'
|
|
||||||
)
|
)
|
||||||
.w-8.h-full.flex.items-center.justify-center.cursor-pointer
|
.w-8.h-full.flex.items-center.justify-center.cursor-pointer
|
||||||
.h-5
|
.h-5
|
||||||
|
|||||||
Reference in New Issue
Block a user