Hide disabled features (#2473)

* Hide/show on notify and fediverse feature disable/enable

* Update browser tests to enable features for testing

* Hide/show features in mobile action menu

* Do not show fediauth option if fediverse features are not enabled.

* Force showing tabs when in Storybook
This commit is contained in:
Gabe Kangas
2022-12-29 16:26:04 -08:00
committed by GitHub
parent 0eba1685b3
commit 533d33847c
8 changed files with 110 additions and 70 deletions

View File

@@ -21,7 +21,7 @@ const Example = () => {
return (
<div>
<AuthModal />
<AuthModal forceTabs />
</div>
);
};

View File

@@ -12,18 +12,26 @@ import {
currentUserAtom,
chatAuthenticatedAtom,
accessTokenAtom,
clientConfigStateAtom,
} from '../../stores/ClientConfigStore';
import { ClientConfig } from '../../../interfaces/client-config.model';
export const AuthModal: FC = () => {
export type AuthModalProps = {
forceTabs?: boolean;
};
export const AuthModal: FC<AuthModalProps> = ({ forceTabs }) => {
const authenticated = useRecoilValue<boolean>(chatAuthenticatedAtom);
const accessToken = useRecoilValue<string>(accessTokenAtom);
const currentUser = useRecoilValue(currentUserAtom);
const clientConfig = useRecoilValue<ClientConfig>(clientConfigStateAtom);
if (!currentUser) {
return null;
}
const { displayName } = currentUser;
const federationEnabled = true;
const { federation } = clientConfig;
const { enabled: fediverseEnabled } = federation;
const indieAuthTabTitle = (
<span className={styles.tabContent}>
@@ -67,7 +75,7 @@ export const AuthModal: FC = () => {
items={items}
type="card"
size="small"
renderTabBar={federationEnabled ? null : () => null}
renderTabBar={fediverseEnabled || forceTabs ? null : () => null}
/>
</div>
);