feat/Update_Controllers_to_Allow_for_Premium_Membership

This commit is contained in:
cesnimda
2026-08-03 09:17:28 +02:00
parent de937d25dc
commit c3f4a57195
187 changed files with 26062 additions and 991 deletions
+6 -3
View File
@@ -30,6 +30,7 @@ import {
CvTheme, CvVariant, CvVariantSettings, CvVariantVersionInfo, DEFAULT_SECTION_ORDER, SECTION_LABELS,
cvBuilderApi, moveItem,
} from "../cvBuilder";
import { useAccountPlan } from "../accountPlan";
const FONTS = [
"'Segoe UI', Roboto, Arial, sans-serif",
@@ -583,7 +584,7 @@ function CustomizeTab({ settings, update, themes }: {
<Typography variant="caption" color="text.secondary" sx={{ display: "block" }}>{t.category}</Typography>
<Stack direction="row" spacing={0.5} sx={{ mt: 0.5 }}>
{t.atsFriendly && <Chip size="small" label="ATS-friendly" color="success" variant="outlined" sx={{ height: 18, fontSize: 10 }} />}
{t.premium && <Chip size="small" label={locked ? "Premium" : "Premium unlocked"} color="secondary" variant="outlined" sx={{ height: 18, fontSize: 10 }} />}
{t.requiresPro && <Chip size="small" label={locked ? "Pro" : "Pro unlocked"} color="secondary" variant="outlined" sx={{ height: 18, fontSize: 10 }} />}
</Stack>
</Paper>
);
@@ -638,12 +639,14 @@ function CustomizeTab({ settings, update, themes }: {
function AiToolsTab() {
const { toast } = useToast();
const { canUseAi } = useAccountPlan();
const [text, setText] = useState("");
const [role, setRole] = useState("");
const [result, setResult] = useState("");
const [busy, setBusy] = useState(false);
const run = async (action: string) => {
if (!canUseAi) return;
if (!text.trim()) {
toast("Paste some text to work on first.", "info");
return;
@@ -661,13 +664,13 @@ function AiToolsTab() {
return (
<Stack spacing={1.5}>
<Alert severity="info" sx={{ py: 0.5 }}>AI suggestions never change your profile automatically. Copy what you like back into your CV.</Alert>
<Alert severity="info" sx={{ py: 0.5 }} action={!canUseAi ? <Button href="/settings" size="small">View Pro</Button> : undefined}>{canUseAi ? "AI suggestions never change your profile automatically. Copy what you like back into your CV." : "AI writing assistance requires Pro. Your CV content remains editable."}</Alert>
<TextField label="Text to improve" multiline minRows={4} fullWidth size="small" value={text} onChange={(e) => setText(e.target.value)}
placeholder="Paste a summary, a bullet, or a whole section…" />
<TextField label="Target role (optional)" size="small" fullWidth value={role} onChange={(e) => setRole(e.target.value)} />
<Box sx={{ display: "flex", flexWrap: "wrap", gap: 0.5 }}>
{AI_ACTIONS.map((a) => (
<Button key={a.key} size="small" variant="outlined" disabled={busy} startIcon={<AutoFixHighIcon />} onClick={() => run(a.key)}>{a.label}</Button>
<Button key={a.key} size="small" variant="outlined" disabled={busy || !canUseAi} startIcon={<AutoFixHighIcon />} onClick={() => run(a.key)}>{canUseAi ? a.label : "Pro required"}</Button>
))}
</Box>
{result && (