0

Fix auth modal story not rendering. Closes #2254

This commit is contained in:
Gabe Kangas 2022-10-28 22:18:51 -07:00
parent dbab4739f2
commit e0b7ae5b3a
No known key found for this signature in database
GPG Key ID: 9A56337728BC81EA
2 changed files with 31 additions and 13 deletions

View File

@ -1,13 +1,30 @@
import React from 'react';
import React, { useEffect } from 'react';
import { ComponentStory, ComponentMeta } from '@storybook/react';
import { RecoilRoot } from 'recoil';
import { RecoilRoot, useSetRecoilState } from 'recoil';
import { AuthModal } from './AuthModal';
import { currentUserAtom } from '../../stores/ClientConfigStore';
import { CurrentUser } from '../../../interfaces/current-user';
const Example = () => (
const Example = () => {
const setCurrentUser = useSetRecoilState<CurrentUser>(currentUserAtom);
useEffect(
() =>
setCurrentUser({
id: '1',
displayName: 'Test User',
displayColor: 3,
isModerator: false,
}),
[],
);
return (
<div>
<AuthModal />
</div>
);
};
export default {
title: 'owncast/Modals/Auth',
@ -15,8 +32,7 @@ export default {
parameters: {},
} as ComponentMeta<typeof AuthModal>;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const Template: ComponentStory<typeof AuthModal> = args => (
const Template: ComponentStory<typeof AuthModal> = () => (
<RecoilRoot>
<Example />
</RecoilRoot>

View File

@ -15,22 +15,23 @@ import {
} from '../../stores/ClientConfigStore';
export const AuthModal: FC = () => {
const authenticated = useRecoilValue<boolean>(chatAuthenticatedAtom);
const accessToken = useRecoilValue<string>(accessTokenAtom);
const currentUser = useRecoilValue(currentUserAtom);
if (!currentUser) {
return null;
}
const authenticated = useRecoilValue<boolean>(chatAuthenticatedAtom);
const accessToken = useRecoilValue<string>(accessTokenAtom);
const federationEnabled = true;
const { displayName } = currentUser;
const federationEnabled = true;
const indieAuthTabTitle = (
<span className={styles.tabContent}>
<img className={styles.icon} src={IndieAuthIcon.src} alt="IndieAuth" />
IndieAuth
</span>
);
const indieAuthTab = (
<IndieAuthModal
authenticated={authenticated}
@ -45,6 +46,7 @@ export const AuthModal: FC = () => {
FediAuth
</span>
);
const fediAuthTab = (
<FediAuthModal
authenticated={authenticated}