forked from mirrors/ntfy
1
0
Fork 0

Revert inputProps things

This commit is contained in:
binwiederhier 2023-05-24 21:32:15 -04:00
parent 1251a4adab
commit b7c121e78e
7 changed files with 33 additions and 22 deletions

View File

@ -20,6 +20,12 @@
"react/destructuring-assignment": "off", "react/destructuring-assignment": "off",
"react/jsx-no-useless-fragment": "off", "react/jsx-no-useless-fragment": "off",
"react/jsx-props-no-spreading": "off", "react/jsx-props-no-spreading": "off",
"react/jsx-no-duplicate-props": [
"error",
{
"ignoreCase": false // For <TextField>'s [iI]nputProps
}
],
"react/function-component-definition": [ "react/function-component-definition": [
"error", "error",
{ {

View File

@ -994,6 +994,7 @@ const TokenDialog = (props) => {
const TokenDeleteDialog = (props) => { const TokenDeleteDialog = (props) => {
const { t } = useTranslation(); const { t } = useTranslation();
const [error, setError] = useState("");
const handleSubmit = async () => { const handleSubmit = async () => {
try { try {
@ -1003,6 +1004,8 @@ const TokenDeleteDialog = (props) => {
console.log(`[Account] Error deleting token`, e); console.log(`[Account] Error deleting token`, e);
if (e instanceof UnauthorizedError) { if (e instanceof UnauthorizedError) {
session.resetAndRedirect(routes.login); session.resetAndRedirect(routes.login);
} else {
setError(e.message);
} }
} }
}; };
@ -1015,7 +1018,7 @@ const TokenDeleteDialog = (props) => {
<Trans i18nKey="account_tokens_delete_dialog_description" /> <Trans i18nKey="account_tokens_delete_dialog_description" />
</DialogContentText> </DialogContentText>
</DialogContent> </DialogContent>
<DialogFooter status> <DialogFooter status={error}>
<Button onClick={props.onClose}>{t("common_cancel")}</Button> <Button onClick={props.onClose}>{t("common_cancel")}</Button>
<Button onClick={handleSubmit} color="error"> <Button onClick={handleSubmit} color="error">
{t("account_tokens_delete_dialog_submit_button")} {t("account_tokens_delete_dialog_submit_button")}

View File

@ -30,14 +30,13 @@ export const AccountContext = createContext(null);
const App = () => { const App = () => {
const [account, setAccount] = useState(null); const [account, setAccount] = useState(null);
const accountMemo = useMemo(() => ({ account, setAccount }), [account, setAccount]);
const contextValue = useMemo(() => ({ account, setAccount }), [account, setAccount]);
return ( return (
<Suspense fallback={<Loader />}> <Suspense fallback={<Loader />}>
<BrowserRouter> <BrowserRouter>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<AccountContext.Provider value={contextValue}> <AccountContext.Provider value={accountMemo}>
<CssBaseline /> <CssBaseline />
<ErrorBoundary> <ErrorBoundary>
<Routes> <Routes>

View File

@ -76,11 +76,11 @@ const EmojiPicker = (props) => {
variant="standard" variant="standard"
fullWidth fullWidth
sx={{ marginTop: 0, marginBottom: "12px", paddingRight: 2 }} sx={{ marginTop: 0, marginBottom: "12px", paddingRight: 2 }}
inputProps={{
role: "searchbox",
"aria-label": t("emoji_picker_search_placeholder"),
}}
InputProps={{ InputProps={{
inputProps: {
role: "searchbox",
"aria-label": t("emoji_picker_search_placeholder"),
},
endAdornment: ( endAdornment: (
<InputAdornment position="end" sx={{ display: search ? "" : "none" }}> <InputAdornment position="end" sx={{ display: search ? "" : "none" }}>
<IconButton size="small" onClick={handleSearchClear} edge="end" aria-label={t("emoji_picker_search_clear")}> <IconButton size="small" onClick={handleSearchClear} edge="end" aria-label={t("emoji_picker_search_clear")}>

View File

@ -46,9 +46,10 @@ class ErrorBoundaryImpl extends React.Component {
// Fetch additional info and a better stack trace // Fetch additional info and a better stack trace
StackTrace.fromError(error).then((stack) => { StackTrace.fromError(error).then((stack) => {
console.error("[ErrorBoundary] Stacktrace fetched", stack); console.error("[ErrorBoundary] Stacktrace fetched", stack);
const niceStack = `${error.toString()}\n${stack const stackString = stack
.map((el) => ` at ${el.functionName} (${el.fileName}:${el.columnNumber}:${el.lineNumber})`) .map((el) => ` at ${el.functionName} (${el.fileName}:${el.columnNumber}:${el.lineNumber})`)
.join("\n")}`; .join("\n");
const niceStack = `${error.toString()}\n${stackString}`;
this.setState({ niceStack }); this.setState({ niceStack });
}); });
} }

View File

@ -373,23 +373,23 @@ const PublishDialog = (props) => {
"aria-label": t("publish_dialog_priority_label"), "aria-label": t("publish_dialog_priority_label"),
}} }}
> >
{[5, 4, 3, 2, 1].map((priorityMenuItem) => ( {[5, 4, 3, 2, 1].map((p) => (
<MenuItem <MenuItem
key={`priorityMenuItem${priorityMenuItem}`} key={`priorityMenuItem${p}`}
value={priorityMenuItem} value={p}
aria-label={t("notifications_priority_x", { aria-label={t("notifications_priority_x", {
priority: priorityMenuItem, priority: p,
})} })}
> >
<div style={{ display: "flex", alignItems: "center" }}> <div style={{ display: "flex", alignItems: "center" }}>
<img <img
src={priorities[priorityMenuItem].file} src={priorities[p].file}
style={{ marginRight: "8px" }} style={{ marginRight: "8px" }}
alt={t("notifications_priority_x", { alt={t("notifications_priority_x", {
priority: priorityMenuItem, priority: p,
})} })}
/> />
<div>{priorities[priorityMenuItem].label}</div> <div>{priorities[p].label}</div>
</div> </div>
</MenuItem> </MenuItem>
))} ))}
@ -823,10 +823,10 @@ const ExpandingTextField = (props) => {
sx={{ width: `${textWidth}px`, borderBottom: "none" }} sx={{ width: `${textWidth}px`, borderBottom: "none" }}
InputProps={{ InputProps={{
style: { fontSize: theme.typography[props.variant].fontSize }, style: { fontSize: theme.typography[props.variant].fontSize },
inputProps: { }}
style: { paddingBottom: 0, paddingTop: 0 }, inputProps={{
"aria-label": props.placeholder, style: { paddingBottom: 0, paddingTop: 0 },
}, "aria-label": props.placeholder,
}} }}
disabled={props.disabled} disabled={props.disabled}
/> />

View File

@ -241,6 +241,8 @@ const DisplayNameDialog = (props) => {
inputProps={{ inputProps={{
maxLength: 64, maxLength: 64,
"aria-label": t("display_name_dialog_placeholder"), "aria-label": t("display_name_dialog_placeholder"),
}}
InputProps={{
endAdornment: ( endAdornment: (
<InputAdornment position="end"> <InputAdornment position="end">
<IconButton onClick={() => setDisplayName("")} edge="end"> <IconButton onClick={() => setDisplayName("")} edge="end">