diff --git a/frontend/build_errors.txt b/frontend/build_errors.txt new file mode 100644 index 0000000..0f46bdc Binary files /dev/null and b/frontend/build_errors.txt differ diff --git a/frontend/fix-lines.js b/frontend/fix-lines.js new file mode 100644 index 0000000..0a39524 --- /dev/null +++ b/frontend/fix-lines.js @@ -0,0 +1,83 @@ +const fs = require('fs'); + +let lines = fs.readFileSync('c:/dev/gohorsejobs/frontend/src/app/dashboard/backoffice/page.tsx', 'utf8').split('\n'); + +// 1. Add import ConfirmModal near lucide-react (line 45) +for (let i = 0; i < lines.length; i++) { + if (lines[i].includes('import { Archive, CheckCircle, Copy, ExternalLink, PauseCircle, Plus, RefreshCw, XCircle } from "lucide-react"')) { + lines.splice(i + 1, 0, 'import { ConfirmModal } from "@/components/confirm-modal"'); + break; + } +} + +// 2. Add state deletePlanId near editingPlanId (around line 96) +for (let i = 0; i < lines.length; i++) { + if (lines[i].includes('const [editingPlanId, setEditingPlanId] = useState(null)')) { + lines.splice(i + 1, 0, ' const [deletePlanId, setDeletePlanId] = useState(null)'); + break; + } +} + +// 3. Replace handleDeletePlan block +let startIdx = -1; +let endIdx = -1; +for (let i = 0; i < lines.length; i++) { + if (lines[i].includes('const handleDeletePlan = async (id: string) => {')) { + startIdx = i; + } + if (startIdx !== -1 && i > startIdx && lines[i].includes('} catch (error) {')) { + // found end of try block + } + if (startIdx !== -1 && i > startIdx && lines[i].trim() === '}') { + endIdx = i; + break; + } +} + +if (startIdx !== -1 && endIdx !== -1) { + const newFunc = [ + ' const handleDeletePlan = async (id: string) => {', + ' setDeletePlanId(id)', + ' }', + '', + ' const confirmDeletePlan = async () => {', + ' if (!deletePlanId) return', + ' try {', + ' await plansApi.delete(deletePlanId)', + ' toast.success("Plan deleted")', + ' loadBackoffice(true)', + ' } catch (error) {', + ' toast.error("Failed to delete plan")', + ' } finally {', + ' setDeletePlanId(null)', + ' }', + ' }' + ].map(l => l + (lines[0].endsWith('\\r') ? '\\r' : '')); + + lines.splice(startIdx, endIdx - startIdx + 1, ...newFunc); +} + +// 4. Add ConfirmModal before last closing +let lastDivIdx = -1; +for (let i = lines.length - 1; i >= 0; i--) { + if (lines[i].includes('')) { + lastDivIdx = i; + break; + } +} + +if (lastDivIdx !== -1) { + const modal = [ + ' setDeletePlanId(null)}', + ' onConfirm={confirmDeletePlan}', + ' title="Are you sure you want to delete this plan?"', + ' description="This action cannot be undone."', + ' />' + ].map(l => l + (lines[0].endsWith('\\r') ? '\\r' : '')); + lines.splice(lastDivIdx, 0, ...modal); +} + +fs.writeFileSync('c:/dev/gohorsejobs/frontend/src/app/dashboard/backoffice/page.tsx', lines.join('\n')); +console.log('done lines edit'); diff --git a/frontend/fix.js b/frontend/fix.js new file mode 100644 index 0000000..0ddbdd4 --- /dev/null +++ b/frontend/fix.js @@ -0,0 +1,56 @@ +const fs = require('fs'); + +let content = fs.readFileSync('c:/dev/gohorsejobs/frontend/src/app/dashboard/backoffice/page.tsx', 'utf8'); + +content = content.replace( + 'import { Archive, CheckCircle, Copy, ExternalLink, PauseCircle, Plus, RefreshCw, XCircle } from "lucide-react"', + 'import { Archive, CheckCircle, Copy, ExternalLink, PauseCircle, Plus, RefreshCw, XCircle } from "lucide-react"\r\nimport { ConfirmModal } from "@/components/confirm-modal"' +); + +content = content.replace( + 'const [editingPlanId, setEditingPlanId] = useState(null)', + 'const [editingPlanId, setEditingPlanId] = useState(null)\r\n const [deletePlanId, setDeletePlanId] = useState(null)' +); + +const oldFunction = ` const handleDeletePlan = async (id: string) => {\r + if (!confirm("Delete this plan?")) return\r + try {\r + await plansApi.delete(id)\r + toast.success("Plan deleted")\r + loadBackoffice(true)\r + } catch (error) {\r + toast.error("Failed to delete plan")\r + }\r + }`; + +const newFunction = ` const handleDeletePlan = async (id: string) => {\r + setDeletePlanId(id)\r + }\r +\r + const confirmDeletePlan = async () => {\r + if (!deletePlanId) return\r + try {\r + await plansApi.delete(deletePlanId)\r + toast.success("Plan deleted")\r + loadBackoffice(true)\r + } catch (error) {\r + toast.error("Failed to delete plan")\r + } finally {\r + setDeletePlanId(null)\r + }\r + }`; + +content = content.replace(new RegExp(oldFunction.replace(/[.*+?^$\\{\\}()|[\\]\\\\]/g, '\\\\$&').replace(/\\r\\n/g, '\\r?\\n'), 'g'), newFunction); + +content = content.replace( + ' \r\n \r\n \r\n )\r\n}', + ' \r\n \r\n setDeletePlanId(null)}\r\n onConfirm={confirmDeletePlan}\r\n title="Are you sure you want to delete this plan?"\r\n description="This action cannot be undone."\r\n />\r\n \r\n )\r\n}' +); + +content = content.replace( + ' \n \n \n )\n}', + ' \n \n setDeletePlanId(null)}\n onConfirm={confirmDeletePlan}\n title="Are you sure you want to delete this plan?"\n description="This action cannot be undone."\n />\n \n )\n}' +); + +fs.writeFileSync('c:/dev/gohorsejobs/frontend/src/app/dashboard/backoffice/page.tsx', content); +console.log('done'); diff --git a/frontend/src/app/dashboard/tickets/page.tsx b/frontend/src/app/dashboard/tickets/page.tsx index e90151c..e8ea3fd 100644 --- a/frontend/src/app/dashboard/tickets/page.tsx +++ b/frontend/src/app/dashboard/tickets/page.tsx @@ -322,14 +322,24 @@ export default function AdminTicketsPage() { - Bug - Feature Request - Support - Billing - Other + {t("ticketsPage.category.bug")} + {t("ticketsPage.category.feature")} + {t("ticketsPage.category.support")} + {t("ticketsPage.category.billing")} + {t("ticketsPage.category.other")} +
+ +