feat: license UI card in settings (#47) #57

Merged
maximus merged 2 commits from issue-47-license-ui-card into issue-46-license-commands-entitlements 2026-04-10 13:55:00 +00:00
Owner

Fixes #47

Depends on #46 (chain-branched from issue-46-license-commands-entitlements).

Summary

  • New licenseService.ts (Tauri command wrapper)
  • New useLicense hook with useReducer pattern (idle/loading/ready/validating/error)
  • New LicenseCard component shown at the top of SettingsPage
  • Bilingual i18n keys + CHANGELOG entries

Test plan

  • App boots, Settings page loads, License card appears
  • Edition shows "Free" on a fresh install
  • Clicking "Buy Simpl'Result" opens the purchase URL in the browser
  • Entering an invalid key shows an error message
  • Entering a valid key (once #49 is up) updates the edition
Fixes #47 Depends on #46 (chain-branched from `issue-46-license-commands-entitlements`). ## Summary - New `licenseService.ts` (Tauri command wrapper) - New `useLicense` hook with useReducer pattern (idle/loading/ready/validating/error) - New `LicenseCard` component shown at the top of SettingsPage - Bilingual i18n keys + CHANGELOG entries ## Test plan - [ ] App boots, Settings page loads, License card appears - [ ] Edition shows "Free" on a fresh install - [ ] Clicking "Buy Simpl'Result" opens the purchase URL in the browser - [ ] Entering an invalid key shows an error message - [ ] Entering a valid key (once #49 is up) updates the edition
maximus added 1 commit 2026-04-09 12:54:54 +00:00
Adds the user-facing layer on top of the Rust license commands shipped
in #46.

- `licenseService.ts` thin wrapper around the new Tauri commands
- `useLicense` hook follows the project's useReducer pattern (idle,
  loading, ready, validating, error) and exposes `submitKey`,
  `refresh`, and `checkEntitlement` for cross-component use
- `LicenseCard` shows the current edition, the expiry date when set,
  accepts a license key with inline validation feedback, and links to
  the purchase page via `openUrl` from `@tauri-apps/plugin-opener`
- Card is inserted at the top of `SettingsPage` so the edition is the
  first thing users see when looking for license-related actions
- i18n: new `license.*` keys in both `fr.json` and `en.json`
- Bilingual CHANGELOG entries
Author
Owner

Review (sprint inline) — APPROVE

Points vérifiés

  • Pattern useReducer suivi (cohérent avec useUpdater.ts)
  • Service = thin wrapper, hook = state, composant = rendering — séparation respectée
  • i18n complet FR/EN, aucune chaîne en dur dans le JSX
  • Bilingual CHANGELOG (FR + EN)
  • openUrl (signature correcte du plugin v2, pas l'ancien open)
  • Bouton Annuler nettoie l'input
  • Bouton Submit désactivé pendant validating
  • Aucun secret, aucune injection (la clé est passée à la commande Rust pour validation)
  • URL d'achat hardcodée (pas user-controlled)

Suggestion non bloquante

  • Le check state.info.expires_at > 0 est défensif mais théoriquement toujours vrai puisque l'exp claim est mandatory dans la validation Rust. C'est OK de le garder pour la robustesse, mais on pourrait aussi simplifier en state.info?.expires_at && ....

Aucun problème critique.

## Review (sprint inline) — APPROVE ### Points vérifiés - ✅ Pattern useReducer suivi (cohérent avec `useUpdater.ts`) - ✅ Service = thin wrapper, hook = state, composant = rendering — séparation respectée - ✅ i18n complet FR/EN, aucune chaîne en dur dans le JSX - ✅ Bilingual CHANGELOG (FR + EN) - ✅ `openUrl` (signature correcte du plugin v2, pas l'ancien `open`) - ✅ Bouton Annuler nettoie l'input - ✅ Bouton Submit désactivé pendant `validating` - ✅ Aucun secret, aucune injection (la clé est passée à la commande Rust pour validation) - ✅ URL d'achat hardcodée (pas user-controlled) ### Suggestion non bloquante - Le check `state.info.expires_at > 0` est défensif mais théoriquement toujours vrai puisque l'`exp` claim est mandatory dans la validation Rust. C'est OK de le garder pour la robustesse, mais on pourrait aussi simplifier en `state.info?.expires_at && ...`. Aucun problème critique.
maximus force-pushed issue-47-license-ui-card from a6ffd2c4c4 to 2da2de183a 2026-04-09 19:47:16 +00:00 Compare
maximus merged commit 44f98549b5 into issue-46-license-commands-entitlements 2026-04-10 13:55:00 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: maximus/Simpl-Resultat#57
No description provided.