mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-09-12 19:58:21 +02:00
## Move editor under `frontend/editor/`
Pure restructure: `frontend/` becomes the workspace, `frontend/editor/`
holds
the PDF editor. 1775 file renames + 40 wiring edits. No logic changes.
### Why
`frontend/` is currently the editor — its `src/`, `public/`,
`src-tauri/`,
config files all sit at the root. Promoting `frontend/` to a
workspace and putting the editor in a sibling folder leaves room for
future
apps to drop in alongside it, sharing one `package.json` /
`node_modules` /
lint config / Storybook.
### What moves
frontend/
├── editor/ ← NEW: everything editor-specific
│ ├── src/ ← was frontend/src/
│ ├── public/ ← was frontend/public/
│ ├── src-tauri/ ← was frontend/src-tauri/
│ ├── index.html, vite.config.ts, vitest.config.ts, playwright.config.ts
│ ├── tsconfig*.json, tailwind.config.js, postcss.config.js
│ ├── scripts/
│ ├── .env, .env.desktop, .env.saas
│ └── DeveloperGuide.md
├── package.json, package-lock.json, node_modules/ ← workspace install
├── eslint.config.mjs, .prettierrc, .prettierignore ← shared tooling
├── .gitignore
└── README.md
### Wiring edits (40 files)
- `.taskfiles/frontend.yml`, `desktop.yml`, `e2e.yml`
- `build.gradle`, `app/core/build.gradle`
- `eslint.config.mjs`, `frontend/package.json`, `.gitignore`,
`.prettierignore`
- `docker/frontend/Dockerfile`
- 8 `.github/workflows/*.yml`, plus `.github/dependabot.yml`,
`.github/config/.files.yaml`, `.github/labeler-config-srvaroa.yml`
- `scripts/translations/**`
- Docs: `AGENTS.md`, `CLAUDE.md`, `ADDING_TOOLS.md`,
`DeveloperGuide.md`,
`WINDOWS_SIGNING.md`, `devGuide/HowToAddNewLanguage.md`,
`frontend/README.md`,
`frontend/editor/DeveloperGuide.md`
Plus 3 renamed + edited: `editor/vite.config.ts` (env path +
node_modules
walk-up), `editor/scripts/setup-env.mts` (renamed from `.ts` for
`import.meta.url`), `editor/scripts/build-provisioner.mjs` (resolve
src-tauri
relative to script).
### Verification
| Check | Result |
|---|---|
| `task frontend:typecheck:all` (6 variants) | exit 0 |
| `task frontend:lint` (eslint + dpdm) | exit 0 |
| `task frontend:format:check` | exit 0 |
| `task frontend:test` | 657 tests pass, 50 files |
| `task frontend:build:{core,proprietary,saas,desktop,prototypes}` | all
green |
| `task desktop:build` | full Tauri pipeline →
`Stirling-PDF_2.11.0_x64_en-US.msi` |
| `playwright test --list --project=stubbed` | 172 tests discovered |
`task desktop:build` exercises the heaviest path — Rust + WiX + MSI
bundle
against the moved `editor/src-tauri/`. If anything in the restructure
was
wrong it wouldn't have built.
### Test plan
- [ ] `frontend-validation.yml` green
- [ ] `e2e-stubbed.yml` green
- [ ] `tauri-build.yml` green on at least one platform
- [ ] `check_toml.yml` runs on a translation-touching PR
---------
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
116 lines
3.1 KiB
TypeScript
116 lines
3.1 KiB
TypeScript
import React from "react";
|
|
import { Button, Group, ActionIcon } from "@mantine/core";
|
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
import { TFunction } from "i18next";
|
|
import {
|
|
ButtonDefinition,
|
|
type FlowState,
|
|
type ButtonAction,
|
|
} from "@app/components/onboarding/saasOnboardingFlowConfig";
|
|
|
|
interface RenderButtonsProps {
|
|
slideDefinition: {
|
|
buttons: ButtonDefinition[];
|
|
id: string;
|
|
};
|
|
flowState: FlowState;
|
|
onAction: (action: ButtonAction) => void;
|
|
t: TFunction;
|
|
}
|
|
|
|
export function renderButtons({
|
|
slideDefinition,
|
|
flowState,
|
|
onAction,
|
|
t,
|
|
}: RenderButtonsProps) {
|
|
const leftButtons = slideDefinition.buttons.filter(
|
|
(btn) => btn.group === "left",
|
|
);
|
|
const rightButtons = slideDefinition.buttons.filter(
|
|
(btn) => btn.group === "right",
|
|
);
|
|
|
|
const buttonStyles = (variant: ButtonDefinition["variant"]) =>
|
|
variant === "primary"
|
|
? {
|
|
root: {
|
|
background: "var(--onboarding-primary-button-bg)",
|
|
color: "var(--onboarding-primary-button-text)",
|
|
},
|
|
}
|
|
: {
|
|
root: {
|
|
background: "var(--onboarding-secondary-button-bg)",
|
|
border: "1px solid var(--onboarding-secondary-button-border)",
|
|
color: "var(--onboarding-secondary-button-text)",
|
|
},
|
|
};
|
|
|
|
const resolveButtonLabel = (button: ButtonDefinition) => {
|
|
// Translate the label (it's a translation key)
|
|
const label = button.label ?? "";
|
|
if (!label) return "";
|
|
|
|
// Extract fallback text from translation key (e.g., 'onboarding.buttons.next' -> 'Next')
|
|
const fallback = label.split(".").pop() || label;
|
|
return t(label, fallback);
|
|
};
|
|
|
|
const renderButton = (button: ButtonDefinition) => {
|
|
const disabled = button.disabledWhen?.(flowState) ?? false;
|
|
|
|
if (button.type === "icon") {
|
|
return (
|
|
<ActionIcon
|
|
key={button.key}
|
|
onClick={() => onAction(button.action)}
|
|
radius="md"
|
|
size={40}
|
|
disabled={disabled}
|
|
styles={{
|
|
root: {
|
|
background: "var(--onboarding-secondary-button-bg)",
|
|
border: "1px solid var(--onboarding-secondary-button-border)",
|
|
color: "var(--onboarding-secondary-button-text)",
|
|
},
|
|
}}
|
|
>
|
|
{button.icon === "chevron-left" && (
|
|
<ChevronLeftIcon fontSize="small" />
|
|
)}
|
|
</ActionIcon>
|
|
);
|
|
}
|
|
|
|
const variant = button.variant ?? "secondary";
|
|
const label = resolveButtonLabel(button);
|
|
|
|
return (
|
|
<Button
|
|
key={button.key}
|
|
onClick={() => onAction(button.action)}
|
|
disabled={disabled}
|
|
styles={buttonStyles(variant)}
|
|
>
|
|
{label}
|
|
</Button>
|
|
);
|
|
};
|
|
|
|
if (leftButtons.length === 0) {
|
|
return <Group justify="flex-end">{rightButtons.map(renderButton)}</Group>;
|
|
}
|
|
|
|
if (rightButtons.length === 0) {
|
|
return <Group justify="flex-start">{leftButtons.map(renderButton)}</Group>;
|
|
}
|
|
|
|
return (
|
|
<Group justify="space-between">
|
|
<Group gap={12}>{leftButtons.map(renderButton)}</Group>
|
|
<Group gap={12}>{rightButtons.map(renderButton)}</Group>
|
|
</Group>
|
|
);
|
|
}
|