Add Prettier for TypeScript formatting

- Install prettier
- Configure .prettierrc.json and .prettierignore
- Add npm scripts: format, format:check
- Add Makefile target: format-frontend
- Format all frontend files
This commit is contained in:
counterweight 2025-12-21 21:59:26 +01:00
parent 4b394b0698
commit 37de6f70e0
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
44 changed files with 906 additions and 856 deletions

View file

@ -66,10 +66,10 @@ export default function AdminInvitesPage() {
setCreateError("Please select a godfather");
return;
}
setIsCreating(true);
setCreateError(null);
try {
await api.post("/api/admin/invites", {
godfather_id: parseInt(newGodfatherId),
@ -185,12 +185,10 @@ export default function AdminInvitesPage() {
<option value={SPENT}>Spent</option>
<option value={REVOKED}>Revoked</option>
</select>
<span style={styles.totalCount}>
{data?.total ?? 0} invites
</span>
<span style={styles.totalCount}>{data?.total ?? 0} invites</span>
</div>
</div>
<div style={styles.tableWrapper}>
<table style={styles.table}>
<thead>
@ -206,43 +204,48 @@ export default function AdminInvitesPage() {
<tbody>
{error && (
<tr>
<td colSpan={6} style={styles.errorRow}>{error}</td>
<td colSpan={6} style={styles.errorRow}>
{error}
</td>
</tr>
)}
{!error && data?.records.map((record) => (
<tr key={record.id} style={styles.tr}>
<td style={styles.tdCode}>{record.identifier}</td>
<td style={styles.td}>{record.godfather_email}</td>
<td style={styles.td}>
<span style={{ ...styles.statusBadge, ...getStatusBadgeStyle(record.status) }}>
{record.status}
</span>
</td>
<td style={styles.td}>
{record.used_by_email || "-"}
</td>
<td style={styles.tdDate}>{formatDate(record.created_at)}</td>
<td style={styles.td}>
{record.status === READY && (
<button
onClick={() => handleRevoke(record.id)}
style={styles.revokeButton}
{!error &&
data?.records.map((record) => (
<tr key={record.id} style={styles.tr}>
<td style={styles.tdCode}>{record.identifier}</td>
<td style={styles.td}>{record.godfather_email}</td>
<td style={styles.td}>
<span
style={{ ...styles.statusBadge, ...getStatusBadgeStyle(record.status) }}
>
Revoke
</button>
)}
</td>
</tr>
))}
{record.status}
</span>
</td>
<td style={styles.td}>{record.used_by_email || "-"}</td>
<td style={styles.tdDate}>{formatDate(record.created_at)}</td>
<td style={styles.td}>
{record.status === READY && (
<button
onClick={() => handleRevoke(record.id)}
style={styles.revokeButton}
>
Revoke
</button>
)}
</td>
</tr>
))}
{!error && (!data || data.records.length === 0) && (
<tr>
<td colSpan={6} style={styles.emptyRow}>No invites yet</td>
<td colSpan={6} style={styles.emptyRow}>
No invites yet
</td>
</tr>
)}
</tbody>
</table>
</div>
{data && data.total_pages > 1 && (
<div style={styles.pagination}>
<button
@ -500,4 +503,3 @@ const pageStyles: Record<string, React.CSSProperties> = {
};
const styles = { ...sharedStyles, ...pageStyles };