-
-
Notifications
You must be signed in to change notification settings - Fork 530
QF-2751: Show the settings/preferences icon on the surah header #2554
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
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a27a3b3
Refactor Navbar and ContextMenu to integrate SettingsButton and Setti…
yousefdergham 85bc62a
Update ContextMenu styles for improved layout and responsiveness
yousefdergham ea39a06
Add event logging and integration tests for SettingsButton functionality
yousefdergham 2f47d45
Update ContextMenu to clarify SettingsDrawer rendering
yousefdergham 462b51d
Refactor ContextMenu and SettingsButton for improved performance and …
yousefdergham d94765d
Fix logic in ContextMenu for mobile view handling and update Settings…
yousefdergham f943992
Update ContextMenu styles for improved responsiveness and layout adju…
yousefdergham c4fcb4b
Add SettingsDrawer to NavbarBody and remove from ContextMenu for impr…
yousefdergham 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
Some comments aren't visible on the classic Files Changed page.
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
4 changes: 4 additions & 0 deletions
4
src/components/QuranReader/ContextMenu/components/SettingsButton.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,4 @@ | ||
| .settingsButtonIcon { | ||
| color: var(--color-blue-buttons-and-icons); | ||
| fill: var(--color-blue-buttons-and-icons); | ||
| } |
44 changes: 44 additions & 0 deletions
44
src/components/QuranReader/ContextMenu/components/SettingsButton.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,44 @@ | ||
| import React from 'react'; | ||
|
|
||
| import useTranslation from 'next-translate/useTranslation'; | ||
| import { useDispatch } from 'react-redux'; | ||
|
|
||
| import styles from './SettingsButton.module.scss'; | ||
|
|
||
| import Button, { ButtonShape, ButtonVariant } from '@/dls/Button/Button'; | ||
| import IconSettings from '@/icons/settings.svg'; | ||
| import { setIsSettingsDrawerOpen } from '@/redux/slices/navbar'; | ||
| import { logEvent } from '@/utils/eventLogger'; | ||
|
|
||
| interface SettingsButtonProps { | ||
| className?: string; | ||
| ariaId?: string; | ||
| } | ||
|
|
||
| const SettingsButton: React.FC<SettingsButtonProps> = ({ | ||
| className, | ||
| ariaId = 'settings-button', | ||
| }) => { | ||
| const { t } = useTranslation('common'); | ||
| const dispatch = useDispatch(); | ||
| const openSettings = () => { | ||
| logEvent('drawer_settings_open'); | ||
| dispatch(setIsSettingsDrawerOpen(true)); | ||
| }; | ||
|
|
||
| return ( | ||
| <Button | ||
| className={className} | ||
| tooltip={t('settings.title')} | ||
| shape={ButtonShape.Circle} | ||
| variant={ButtonVariant.Ghost} | ||
| ariaLabel={t('aria.change-settings')} | ||
| id={ariaId} | ||
| onClick={openSettings} | ||
| > | ||
| <IconSettings className={styles.settingsButtonIcon} /> | ||
| </Button> | ||
| ); | ||
| }; | ||
|
|
||
| export default SettingsButton; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import { test, expect } from '@playwright/test'; | ||
|
|
||
| test('desktop: settings gear opens the settings drawer', async ({ page }) => { | ||
| await page.setViewportSize({ width: 1280, height: 900 }); | ||
| await page.goto('/1'); | ||
|
|
||
| const settingsButtons = page.locator('#settings-button'); | ||
| await expect(settingsButtons.last()).toBeVisible(); | ||
| await settingsButtons.last().click(); | ||
yousefdergham marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| await expect(page.locator('#settings-drawer-container')).toBeVisible(); | ||
| await expect(page.locator('#settings-drawer-body')).toBeVisible(); | ||
| }); | ||
|
|
||
| test('mobile: gear works before and after scroll (navbar hidden)', async ({ page }) => { | ||
| await page.setViewportSize({ width: 390, height: 844 }); | ||
| await page.goto('/1'); | ||
|
|
||
| const settingsButtons = page.locator('#settings-button'); | ||
| await expect(settingsButtons.first()).toBeVisible(); | ||
| await settingsButtons.first().click(); | ||
| await expect(page.locator('#settings-drawer-container')).toBeVisible(); | ||
| await expect(page.locator('#settings-drawer-body')).toBeVisible(); | ||
|
|
||
| await page | ||
| .locator('#settings-drawer-container') | ||
| .getByRole('button', { name: /close drawer/i }) | ||
| .first() | ||
| .click(); | ||
yousefdergham marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight)); | ||
|
|
||
| await expect(settingsButtons.last()).toBeVisible(); | ||
| await settingsButtons.last().click(); | ||
| await expect(page.locator('#settings-drawer-container')).toBeVisible(); | ||
| await expect(page.locator('#settings-drawer-body')).toBeVisible(); | ||
| }); | ||
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.