-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into feature/9433-commit-m…
…odal
- Loading branch information
Showing
26 changed files
with
688 additions
and
80 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
36 changes: 36 additions & 0 deletions
36
applications/browser-extension/src/components/richTextEditor/ErrorContext.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,36 @@ | ||
/* | ||
* Copyright (C) 2024 PixieBrix, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { createContext, useContext } from "react"; | ||
|
||
type ErrorContextType = { | ||
error: string | null; | ||
setError: (error: string | null) => void; | ||
}; | ||
|
||
const ErrorContext = createContext<ErrorContextType | null>(null); | ||
|
||
export function useShowError() { | ||
const context = useContext(ErrorContext); | ||
if (!context) { | ||
throw new Error("useRichTextError must be used within a RichTextEditor"); | ||
} | ||
|
||
return context; | ||
} | ||
|
||
export default ErrorContext; |
45 changes: 45 additions & 0 deletions
45
applications/browser-extension/src/components/richTextEditor/ErrorToast.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,45 @@ | ||
/* | ||
* Copyright (C) 2024 PixieBrix, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import React from "react"; | ||
import { Toast, Button } from "react-bootstrap"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import { faExclamationCircle, faTimes } from "@fortawesome/free-solid-svg-icons"; | ||
import styles from "./RichTextEditor.module.scss"; | ||
|
||
interface ErrorToastProps { | ||
error: string | null; | ||
onClose: () => void; | ||
} | ||
|
||
const ErrorToast: React.FC<ErrorToastProps> = ({ error, onClose }) => ( | ||
<Toast | ||
show={Boolean(error)} | ||
onClose={onClose} | ||
className={styles.error} | ||
autohide | ||
animation={false} | ||
delay={5000} | ||
> | ||
<FontAwesomeIcon className="mr-2" icon={faExclamationCircle} /> {error} | ||
<Button variant="outline-danger" onClick={onClose}> | ||
<FontAwesomeIcon icon={faTimes} /> | ||
</Button> | ||
</Toast> | ||
); | ||
|
||
export default ErrorToast; |
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.