Polish UI, harden company creation, and add error pages
This commit is contained in:
@@ -4,6 +4,7 @@ import { Box, Button, Paper, TextField, Typography } from "@mui/material";
|
||||
|
||||
import { api } from "../api";
|
||||
import { useToast } from "../toast";
|
||||
import { useI18n } from "../i18n/I18nProvider";
|
||||
|
||||
type RuleSettings = {
|
||||
id: number;
|
||||
@@ -17,6 +18,7 @@ type RuleSettings = {
|
||||
|
||||
export default function RulesSettingsCard() {
|
||||
const { toast } = useToast();
|
||||
const { t } = useI18n();
|
||||
const [s, setS] = useState<RuleSettings | null>(null);
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
@@ -29,7 +31,7 @@ export default function RulesSettingsCard() {
|
||||
setSaving(true);
|
||||
try {
|
||||
await api.put("/rules", s);
|
||||
toast("Rules saved.", "success");
|
||||
toast(t("rulesSave"), "success");
|
||||
} catch {
|
||||
toast("Failed to save rules.", "error");
|
||||
} finally {
|
||||
@@ -50,30 +52,29 @@ export default function RulesSettingsCard() {
|
||||
return (
|
||||
<Paper sx={{ mt: 2, p: 2 }}>
|
||||
<Typography variant="h6" sx={{ mb: 1 }}>
|
||||
Follow-up + Ghosting Rules
|
||||
{t("rulesTitle")}
|
||||
</Typography>
|
||||
<Typography variant="body2" sx={{ color: "text.secondary", mb: 2 }}>
|
||||
Jobs get a “Follow up” flag based on these thresholds. Ghosting is automatic.
|
||||
{t("rulesBody")}
|
||||
</Typography>
|
||||
|
||||
<Box sx={{ display: "grid", gridTemplateColumns: { xs: "1fr", md: "1fr 1fr 1fr" }, gap: 2 }}>
|
||||
<TextField label="Applied: follow-up days" {...num("appliedFollowUpDays")} />
|
||||
<TextField label="Applied: ghost days" {...num("appliedGhostDays")} />
|
||||
<TextField label={t("rulesAppliedFollowUpDays")} {...num("appliedFollowUpDays")} />
|
||||
<TextField label={t("rulesAppliedGhostDays")} {...num("appliedGhostDays")} />
|
||||
<Box />
|
||||
<TextField label="Offer: follow-up days" {...num("offerFollowUpDays")} />
|
||||
<TextField label="Offer: ghost days" {...num("offerGhostDays")} />
|
||||
<TextField label={t("rulesOfferFollowUpDays")} {...num("offerFollowUpDays")} />
|
||||
<TextField label={t("rulesOfferGhostDays")} {...num("offerGhostDays")} />
|
||||
<Box />
|
||||
<TextField label="Feedback: follow-up days" {...num("feedbackFollowUpDays")} />
|
||||
<TextField label="Feedback: ghost days" {...num("feedbackGhostDays")} />
|
||||
<TextField label={t("rulesFeedbackFollowUpDays")} {...num("feedbackFollowUpDays")} />
|
||||
<TextField label={t("rulesFeedbackGhostDays")} {...num("feedbackGhostDays")} />
|
||||
<Box />
|
||||
</Box>
|
||||
|
||||
<Box sx={{ display: "flex", justifyContent: "flex-end", mt: 2 }}>
|
||||
<Button variant="contained" onClick={save} disabled={saving}>
|
||||
{saving ? "Saving..." : "Save Rules"}
|
||||
{saving ? t("rulesSaving") : t("rulesSave")}
|
||||
</Button>
|
||||
</Box>
|
||||
</Paper>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user