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.
[optimize] upgrade to MobX 6, React 18 & Next.js 13 (#18)
- Loading branch information
Showing
18 changed files
with
1,273 additions
and
1,257 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
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
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
Oops, something went wrong.
f4cfcd5
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-cgohi0ev2-techquery.vercel.app
Built with commit f4cfcd5.
This pull request is being automatically deployed with vercel-action