Skip to content

Commit

Permalink
fix: change sign-in to post when user hasn't signed in in comment editor
Browse files Browse the repository at this point in the history
  • Loading branch information
devrsi0n committed May 1, 2023
1 parent e4a2770 commit c2992b0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function MainButton({
</AskNotificationPermissionPopover>
)
) : (
<SignInButton size="sm" />
<SignInButton size="sm">{buttonChildren}</SignInButton>
)}
</div>
);
Expand Down
22 changes: 13 additions & 9 deletions packages/ui/src/blocks/sign-in-button/sign-in-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useSignInWindow } from '../../hooks/use-sign-in-window';

export type SignInButtonProps = Pick<ButtonProps, 'variant' | 'size'> & {
inPageNav?: boolean;
children?: React.ReactNode;
};

const handleSessionAndSignIn = () => {
Expand All @@ -18,10 +19,21 @@ const handleSessionAndSignIn = () => {
export function SignInButton({
variant = 'solid',
inPageNav,
children,
...restProps
}: SignInButtonProps): JSX.Element {
const { loading: signInLoading } = useCurrentUser();
const handleSignIn = useSignInWindow();
const defaultChildren = (
<>
{signInLoading ? (
<IconLoader aria-label="Signing in" className="h-5 w-5 animate-spin" />
) : (
<IconLock size="14" />
)}
<span>Sign in</span>
</>
);
return (
<Button
color="primary"
Expand All @@ -31,15 +43,7 @@ export function SignInButton({
disabled={!!process.env.NEXT_PUBLIC_MAINTENANCE_MODE}
>
<span className="inline-flex flex-row items-center space-x-1">
{signInLoading ? (
<IconLoader
aria-label="Signing in"
className="h-5 w-5 animate-spin"
/>
) : (
<IconLock size="14" />
)}
<span>Sign in</span>
{children || defaultChildren}
</span>
</Button>
);
Expand Down

1 comment on commit c2992b0

@vercel
Copy link

@vercel vercel bot commented on c2992b0 May 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.