Skip to content

Commit

Permalink
Consolidate toast container (#2283)
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec authored Jun 16, 2023
1 parent a85b6be commit 7f8b3b0
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 19 deletions.
2 changes: 2 additions & 0 deletions src/components/App/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import PasswordRequest from "components/PasswordReset/Request";
import PasswordReset from "components/PasswordReset/ResetPage";
import ProjectInvite from "components/ProjectInvite/ProjectInvite";
import RequireAuth from "components/RequireAuth";
import UpperRightToastContainer from "components/Toast/UpperRightToastContainer";

const AppWithBar = loadable(() => import("components/App/AppLoggedIn"));

Expand All @@ -23,6 +24,7 @@ export default function App(): ReactElement {
<div className="App">
<Suspense fallback={<div />}>
<AnnouncementBanner />
<UpperRightToastContainer />
<Switch>
<Route exact path={Path.Root}>
<LandingPage />
Expand Down
2 changes: 0 additions & 2 deletions src/components/ProjectSettings/ProjectLanguages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { WritingSystem } from "api/models";
import { getFrontierWords } from "backend";
import { IconButtonWithTooltip } from "components/Buttons";
import { ProjectSettingPropsWithUpdate } from "components/ProjectSettings/ProjectSettingsTypes";
import { UpperRightToastContainer } from "components/Toast/UpperRightToastContainer";
import theme from "types/theme";
import { newWritingSystem, semDomWritingSystems } from "types/writingSystem";
import { getAnalysisLangsFromWords } from "utilities/wordUtilities";
Expand Down Expand Up @@ -142,7 +141,6 @@ export default function ProjectLanguages(

return (
<>
<UpperRightToastContainer />
<Typography>
{t("projectSettings.language.vernacular")}
{": "}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import * as backend from "backend";
import { asyncRefreshCurrentProjectUsers } from "components/Project/ProjectActions";
import EmailInvite from "components/ProjectSettings/ProjectUsers/EmailInvite";
import UserList from "components/ProjectSettings/ProjectUsers/UserList";
import { UpperRightToastContainer } from "components/Toast/UpperRightToastContainer";
import { StoreState } from "types";
import { useAppDispatch, useAppSelector } from "types/hooks";
import { RuntimeConfig } from "types/runtimeConfig";
Expand Down Expand Up @@ -59,7 +58,6 @@ export default function AddProjectUsers(): ReactElement {
<>
<Grid container spacing={1}>
<UserList projectUsers={projectUsers} addToProject={addToProject} />
<UpperRightToastContainer />
</Grid>

{RuntimeConfig.getInstance().emailServicesEnabled() && (
Expand Down
14 changes: 5 additions & 9 deletions src/components/Pronunciations/AudioRecorder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { toast } from "react-toastify";

import Recorder from "components/Pronunciations/Recorder";
import RecorderIcon from "components/Pronunciations/RecorderIcon";
import { UpperRightToastContainer } from "components/Toast/UpperRightToastContainer";

interface RecorderProps {
wordId: string;
Expand Down Expand Up @@ -49,13 +48,10 @@ export default function AudioRecorder(props: RecorderProps): ReactElement {
}

return (
<>
<UpperRightToastContainer />
<RecorderIcon
wordId={props.wordId}
startRecording={startRecording}
stopRecording={stopRecording}
/>
</>
<RecorderIcon
wordId={props.wordId}
startRecording={startRecording}
stopRecording={stopRecording}
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

exports[`Pronunciations displays buttons 1`] = `
Array [
<div
className="Toastify"
/>,
<button
aria-label="record"
aria-labelledby={null}
Expand Down
2 changes: 0 additions & 2 deletions src/components/SiteSettings/UserManagement/UserManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { User } from "api/models";
import { deleteUser, getAllUsers } from "backend";
import ConfirmDeletion from "components/SiteSettings/UserManagement/ConfirmDeletion";
import UserList from "components/SiteSettings/UserManagement/UserList";
import { UpperRightToastContainer } from "components/Toast/UpperRightToastContainer";

const customStyles = {
content: {
Expand Down Expand Up @@ -70,7 +69,6 @@ export default function UserManagement(): ReactElement {
<>
<Grid container spacing={1}>
<UserList allUsers={allUsers} handleOpenModal={handleOpenModal} />
<UpperRightToastContainer />
</Grid>

<Modal
Expand Down
2 changes: 1 addition & 1 deletion src/components/Toast/UpperRightToastContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "react-toastify/dist/ReactToastify.min.css";

/** A pre-configured ToastContainer to consistently display toasts in the
* upper right corner of the screen. */
export function UpperRightToastContainer(): ReactElement {
export default function UpperRightToastContainer(): ReactElement {
return (
<ToastContainer
position="top-right"
Expand Down

0 comments on commit 7f8b3b0

Please sign in to comment.