Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Fix auth modal story not rendering. Closes #2254

Gabe Kangas2136921201f7
diff --git a/web/components/modals/AuthModal/AuthModal.stories.tsx b/web/components/modals/AuthModal/AuthModal.stories.tsx
index a922525b9b..83616f75bf 100644
--- a/web/components/modals/AuthModal/AuthModal.stories.tsx
+++ b/web/components/modals/AuthModal/AuthModal.stories.tsx
@@ -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 = () => (
- <div>
- <AuthModal />
- </div>
-);
+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>
diff --git a/web/components/modals/AuthModal/AuthModal.tsx b/web/components/modals/AuthModal/AuthModal.tsx
index 87fe8e16f7..bdb0a34122 100644
--- a/web/components/modals/AuthModal/AuthModal.tsx
+++ b/web/components/modals/AuthModal/AuthModal.tsx
@@ -15,15 +15,15 @@ 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 { displayName } = currentUser;
- const authenticated = useRecoilValue<boolean>(chatAuthenticatedAtom);
- const accessToken = useRecoilValue<string>(accessTokenAtom);
const federationEnabled = true;
- const { displayName } = currentUser;
const indieAuthTabTitle = (
<span className={styles.tabContent}>
@@ -31,6 +31,7 @@ export const AuthModal: FC = () => {
IndieAuth
</span>
);
+
const indieAuthTab = (
<IndieAuthModal
authenticated={authenticated}
@@ -45,6 +46,7 @@ export const AuthModal: FC = () => {
FediAuth
</span>
);
+
const fediAuthTab = (
<FediAuthModal
authenticated={authenticated}