generated from idea2app/Next-Bootstrap-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix] some Compatibility bugs of Next.js SSR
- Loading branch information
Showing
7 changed files
with
72 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
import { Role } from '@ideamall/data-model'; | ||
import { observer } from 'mobx-react'; | ||
import dynamic from 'next/dynamic'; | ||
import { FC } from 'react'; | ||
import { Button, Dropdown, DropdownButton } from 'react-bootstrap'; | ||
|
||
import { i18n } from '../models/Translation'; | ||
import userStore from '../models/User'; | ||
import { SessionBox } from './SessionBox'; | ||
|
||
const { t } = i18n; | ||
const SessionBox = dynamic(() => import('./SessionBox'), { ssr: false }), | ||
{ t } = i18n; | ||
|
||
export const UserMenu: FC = observer(() => { | ||
const UserMenu: FC = observer(() => { | ||
const { session } = userStore; | ||
|
||
return ( | ||
<SessionBox> | ||
{session ? ( | ||
<DropdownButton title={session.nickName || session.mobilePhone}> | ||
{!session.roles?.includes(Role.Client) && ( | ||
<Dropdown.Item href="/admin">{t('dashboard')}</Dropdown.Item> | ||
)} | ||
<Dropdown.Item onClick={() => userStore.signOut()}> | ||
{t('sign_out')} | ||
</Dropdown.Item> | ||
</DropdownButton> | ||
) : ( | ||
<Button>{t('sign_in')}</Button> | ||
return session ? ( | ||
<DropdownButton title={session.nickName || session.mobilePhone}> | ||
{!session.roles?.includes(Role.Client) && ( | ||
<Dropdown.Item href="/admin">{t('dashboard')}</Dropdown.Item> | ||
)} | ||
<Dropdown.Item onClick={() => userStore.signOut()}> | ||
{t('sign_out')} | ||
</Dropdown.Item> | ||
</DropdownButton> | ||
) : ( | ||
<SessionBox> | ||
<Button>{t('sign_in')}</Button> | ||
</SessionBox> | ||
); | ||
}); | ||
|
||
export default UserMenu; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
9e150f1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploy preview for idea-mall ready!
✅ Preview
https://idea-mall-9vwa72ae7-techquery.vercel.app
Built with commit 9e150f1.
This pull request is being automatically deployed with vercel-action