-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #262 from scottbenton/fix/a11y-testing
feat(home page): addressed a11y violations on the home page
- Loading branch information
Showing
37 changed files
with
548 additions
and
73 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
2 changes: 1 addition & 1 deletion
2
src/api-calls/custom-move-oracle-settings/settings/listenToOracleSettings.ts
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { firestore } from "config/firebase.config"; | ||
import { | ||
CollectionReference, | ||
DocumentReference, | ||
collection, | ||
doc, | ||
} from "firebase/firestore"; | ||
import { IAccessibilitySettings } from "types/UserAccessibilitySettings.type"; | ||
|
||
export function constructUserSettingsCollectionPath(userId: string) { | ||
return `/users/${userId}/settings`; | ||
} | ||
|
||
export function constructUserAccessibilitySettingsDocPath(userId: string) { | ||
return `/users/${userId}/settings/accessibility`; | ||
} | ||
|
||
export function getUserSettingsCollectionRef(userId: string) { | ||
return collection( | ||
firestore, | ||
constructUserSettingsCollectionPath(userId) | ||
) as CollectionReference<any>; | ||
} | ||
|
||
export function getUserAccessibilitySettingsDoc(userId: string) { | ||
return doc( | ||
firestore, | ||
constructUserAccessibilitySettingsDocPath(userId) | ||
) as DocumentReference<IAccessibilitySettings>; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/api-calls/user/settings/listenToAccessibilitySettings.ts
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { onSnapshot } from "firebase/firestore"; | ||
import { IAccessibilitySettings } from "types/UserAccessibilitySettings.type"; | ||
import { getUserAccessibilitySettingsDoc } from "./_getRef"; | ||
|
||
export const listenToAccessibilitySettings = ( | ||
uid: string, | ||
onSettings: (settings: IAccessibilitySettings) => void | ||
) => { | ||
return onSnapshot(getUserAccessibilitySettingsDoc(uid), (snapshot) => { | ||
onSettings(snapshot.data() ?? {}); | ||
}); | ||
}; |
14 changes: 14 additions & 0 deletions
14
src/api-calls/user/settings/updateAccessibilitySettings.ts
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ApiFunction } from "api-calls/createApiFunction"; | ||
import { setDoc, updateDoc } from "firebase/firestore"; | ||
import { IAccessibilitySettings } from "types/UserAccessibilitySettings.type"; | ||
import { getUserAccessibilitySettingsDoc } from "./_getRef"; | ||
|
||
export const updateAccessibilitySettings: ApiFunction< | ||
{ uid: string; settings: Partial<IAccessibilitySettings> }, | ||
void | ||
> = (params) => { | ||
const { uid, settings } = params; | ||
return setDoc(getUserAccessibilitySettingsDoc(uid), settings, { | ||
merge: true, | ||
}); | ||
}; |
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
59 changes: 59 additions & 0 deletions
59
src/components/shared/AccessibilitySettingsDialog/AccessibilitySettingsDialog.tsx
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { | ||
Box, | ||
Button, | ||
Checkbox, | ||
Dialog, | ||
DialogActions, | ||
DialogContent, | ||
FormControlLabel, | ||
} from "@mui/material"; | ||
import { DialogTitleWithCloseButton } from "../DialogTitleWithCloseButton"; | ||
import { useStore } from "stores/store"; | ||
|
||
export interface AccessibilitySettingsDialogProps { | ||
open?: boolean; | ||
onClose: () => void; | ||
} | ||
|
||
export function AccessibilitySettingsDialog( | ||
props: AccessibilitySettingsDialogProps | ||
) { | ||
const { open, onClose } = props; | ||
|
||
const accessibilitySettings = useStore( | ||
(store) => store.accessibilitySettings.settings | ||
); | ||
|
||
const updateSettings = useStore( | ||
(store) => store.accessibilitySettings.updateSettings | ||
); | ||
|
||
return ( | ||
<Dialog open={open ?? false} onClose={onClose}> | ||
<DialogTitleWithCloseButton onClose={onClose}> | ||
Accessibility Settings | ||
</DialogTitleWithCloseButton> | ||
<DialogContent> | ||
<Box sx={{ pt: 1 }}> | ||
<FormControlLabel | ||
control={ | ||
<Checkbox | ||
checked={accessibilitySettings.verboseRollResults ?? false} | ||
onChange={(evt, value) => | ||
updateSettings({ verboseRollResults: value }).catch(() => {}) | ||
} | ||
/> | ||
} | ||
label={"Announce rolls and modifiers when rolling?"} | ||
sx={{ textTransform: "capitalize", marginRight: 3 }} | ||
/> | ||
</Box> | ||
</DialogContent> | ||
<DialogActions> | ||
<Button variant={"contained"} onClick={onClose}> | ||
Done | ||
</Button> | ||
</DialogActions> | ||
</Dialog> | ||
); | ||
} |
Oops, something went wrong.