-
Notifications
You must be signed in to change notification settings - Fork 235
imprv: New help button #10553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
imprv: New help button #10553
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
bd81186
Create HelpDropdown
satof3 fabb2a9
Add shortcut menu
satof3 63df54c
Merge branch 'dev/7.4.x' into imprv/173835-new-help-button
satof3 a1a4f3a
Apply jotai
satof3 5717647
Delete SystemVersion layout
satof3 0da23a5
Adjust style
satof3 55bc9e6
Remove growi.org link
satof3 07d739e
Translation
satof3 d4a3583
Apply FB
satof3 f537346
Merge branch 'dev/7.4.x' into imprv/173835-new-help-button
satof3 6eeb472
Merge branch 'dev/7.4.x' into imprv/173835-new-help-button
satof3 74b7126
Merge branch 'dev/7.4.x' into imprv/173835-new-help-button
satof3 96d0d9b
Merge branch 'dev/7.4.x' into imprv/173835-new-help-button
satof3 b132f7c
Merge branch 'master' into imprv/173835-new-help-button
yuki-takei bbaf273
refactor: use userAgent for OS detection in ShortcutsModal and HelpDr…
yuki-takei a7e4e27
format with biome
yuki-takei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
14 changes: 14 additions & 0 deletions
14
apps/app/src/client/components/Sidebar/SidebarNav/HelpDropdown.module.scss
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| @use '@growi/core-styles/scss/helpers/modifier-keys'; | ||
|
|
||
| .help-dropdown :global { | ||
| @include modifier-keys.modifier-key; | ||
| } | ||
|
|
||
| .help-dropdown-menu :global { | ||
| @include modifier-keys.modifier-key; | ||
| } | ||
|
|
||
| .help-dropdown-menu :global { | ||
| --bs-dropdown-font-size: 14px; | ||
| min-width: 240px; | ||
| } | ||
97 changes: 97 additions & 0 deletions
97
apps/app/src/client/components/Sidebar/SidebarNav/HelpDropdown.tsx
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| import type { FC } from 'react'; | ||
| import { memo } from 'react'; | ||
| import { useTranslation } from 'next-i18next'; | ||
| import { | ||
| DropdownItem, | ||
| DropdownMenu, | ||
| DropdownToggle, | ||
| UncontrolledDropdown, | ||
| } from 'reactstrap'; | ||
|
|
||
| import { useGrowiCloudUri, useGrowiVersion } from '~/states/global'; | ||
| import { useShortcutsModalActions } from '~/states/ui/modal/shortcuts'; | ||
|
|
||
| import { SkeletonItem } from './SkeletonItem'; | ||
|
|
||
| import styles from './HelpDropdown.module.scss'; | ||
|
|
||
| export const HelpDropdown: FC = memo(() => { | ||
| const { t } = useTranslation(); | ||
| const growiVersion = useGrowiVersion(); | ||
| const { open: openShortcutsModal } = useShortcutsModalActions(); | ||
| const growiCloudUri = useGrowiCloudUri(); | ||
|
|
||
| if (growiVersion == null) { | ||
| return <SkeletonItem />; | ||
| } | ||
|
|
||
| // add classes to cmd-key by OS | ||
| const userAgent = window.navigator.userAgent.toLowerCase(); | ||
| const isMac = userAgent.indexOf('mac') > -1; | ||
| const os = isMac ? 'mac' : 'win'; | ||
|
|
||
| // Cloud users see Help, others see Docs | ||
| const isCloudUser = growiCloudUri != null; | ||
| const helpUrl = isCloudUser | ||
| ? 'https://growi.cloud/help/' | ||
| : 'https://docs.growi.org'; | ||
| const helpLabel = isCloudUser ? t('Help') : 'GROWI Docs'; | ||
|
|
||
| return ( | ||
| <UncontrolledDropdown direction="end" className={styles['help-dropdown']}> | ||
| <DropdownToggle | ||
| className="btn btn-primary d-flex align-items-center justify-content-center" | ||
| data-testid="help-dropdown-button" | ||
| > | ||
| <span className="material-symbols-outlined">help</span> | ||
| </DropdownToggle> | ||
yuki-takei marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| <DropdownMenu | ||
| container="body" | ||
| data-testid="help-dropdown-menu" | ||
| className={styles['help-dropdown-menu']} | ||
| > | ||
| <DropdownItem header className="text-secondary py-1"> | ||
| {t('Help')} | ||
| </DropdownItem> | ||
| <DropdownItem | ||
| tag="a" | ||
| href={helpUrl} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| className="my-1" | ||
| data-testid="help-link" | ||
| > | ||
| <span className="d-flex align-items-center"> | ||
| {helpLabel} | ||
| <span className="growi-custom-icons ms-1 small">external_link</span> | ||
| </span> | ||
| </DropdownItem> | ||
|
|
||
| <DropdownItem className="my-1" onClick={() => openShortcutsModal()}> | ||
| <span className="d-flex align-items-center"> | ||
| <span className="flex-grow-1"> | ||
| {t('help_dropdown.show_shortcuts')} | ||
| </span> | ||
| <span className="text-secondary"> | ||
| <span className={`cmd-key ${os}`} /> | ||
| + / | ||
| </span> | ||
| </span> | ||
| </DropdownItem> | ||
|
|
||
| <DropdownItem divider className="my-2" /> | ||
|
|
||
| <DropdownItem header className="py-1"> | ||
| <span className="d-flex text-secondary"> | ||
| <span className="flex-grow-1"> | ||
| {' '} | ||
| {t('help_dropdown.growi_version')} | ||
| </span> | ||
| {growiVersion} | ||
| </span> | ||
| </DropdownItem> | ||
| </DropdownMenu> | ||
| </UncontrolledDropdown> | ||
| ); | ||
| }); | ||
This file contains hidden or 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.