From 1741628f9a93c82b0ce93dc532ab4f9a39333662 Mon Sep 17 00:00:00 2001 From: Loan TALVAT <23056644+loan-talvat@users.noreply.github.com> Date: Sat, 21 Nov 2026 17:24:11 +0000 Subject: [PATCH] feat(export): one-time card to follow Pelli on Instagram or star the project After the third successful export, the export report shows a small card, once: follow @pelli.io on Instagram first (photographers rarely have a GitHub account), and in second place a GitHub star ("it's free, and it's the best way to help us"). Closing the card or opening either link means it never shows again. It replaces the Pelli line of that report, never a pop-up, and is hidden with Plus like the other Pelli cards. --- README.fr.md | 2 +- README.md | 2 +- src/components/export/ExportProgress.tsx | 6 +- src/components/promo/SupportCard.tsx | 81 ++++++++++++++++++++++++ src/lib/i18n/locales/de.ts | 6 ++ src/lib/i18n/locales/en.ts | 6 ++ src/lib/i18n/locales/es.ts | 6 ++ src/lib/i18n/locales/fr.ts | 6 ++ src/lib/i18n/locales/it.ts | 6 ++ src/lib/i18n/locales/nl.ts | 6 ++ src/lib/i18n/locales/pl.ts | 6 ++ src/lib/i18n/locales/pt.ts | 6 ++ src/lib/i18n/locales/sv.ts | 6 ++ src/lib/links.ts | 2 + src/lib/support.test.ts | 22 +++++++ src/lib/support.ts | 23 +++++++ src/store/export-store.ts | 3 + src/store/prefs-store.test.ts | 20 ++++++ src/store/prefs-store.ts | 12 ++++ 19 files changed, 224 insertions(+), 3 deletions(-) create mode 100644 src/components/promo/SupportCard.tsx create mode 100644 src/lib/support.test.ts create mode 100644 src/lib/support.ts diff --git a/README.fr.md b/README.fr.md index 3f7b8e0..882477d 100644 --- a/README.fr.md +++ b/README.fr.md @@ -112,7 +112,7 @@ Le tri reste gratuit et illimité. **Plus**, c'est pour vos séances les plus ex | **La précision maximale** | 5 modèles de plus, environ 777 Mo à télécharger une fois : RetinaFace ResNet-50 trouve les petits visages des photos de groupe (un second passage à 1 280 px), DINOv2 regroupe les rafales et les quasi-doublons (il sépare les doublons des scènes différentes environ deux fois plus nettement que le CLIP B/32 de la précision Standard : +0,25 de cosinus contre +0,11), CLIP ViT-L/14 (un modèle de vision environ 3,5 fois plus grand) pour la recherche et la note esthétique, RF-DETR-Seg juge les sujets sans visage exploitable (de dos, les animaux), avec la note esthétique LAION V2. Plus lent, plus fin. | | **La recherche IA** | Tapez « première danse », « robe bleue » ou « blue dress » : les bonnes photos remontent en tête. | | **Des statistiques détaillées** | Sur toutes vos séances : le taux de sélection, global et par séance ; pourquoi des photos sont rejetées (la raison principale donnée par l'IA, ou votre propre choix) ; combien de fois vous avez inversé le choix de l'IA, dans un sens et dans l'autre ; les photos par mois de prise de vue ; les rafales regroupées ; vos boîtiers et leur taux de sélection ; et la vitesse d'analyse mesurée sur votre ordinateur, par précision. Un tableau de vos séances ouvre chacune d'elles. Calculées sur votre ordinateur, jamais envoyées. | -| **Aucune promotion Pelli** | La version gratuite montre deux petites cartes Pelli, sur l'écran d'accueil et à la fin d'un export. Plus les retire. | +| **Aucune promotion Pelli** | La version gratuite montre deux petites cartes Pelli, sur l'écran d'accueil et à la fin d'un export, et une seule fois, après votre troisième export, une carte qui invite à suivre Pelli sur Instagram ou à mettre une étoile au projet sur GitHub. Plus les retire. | - **Une clé par ordinateur, transférable.** Le paiement se fait avec Stripe dans votre navigateur, et l'app s'active toute seule. Votre clé (`XXXX-XXXX-XXXX-XXXX`) s'affiche dans l'app et sur la page de confirmation : pour passer Plus sur un autre ordinateur, *Libérer cette licence* dans *Réglages → Pelli Instant Plus*, puis saisissez la clé sur l'autre. Réinstaller sur le même ordinateur demande seulement de ressaisir la clé. - **Discret.** Pelli ne garde ni nom, ni e-mail, ni pays pour Plus : seulement la clé, une empreinte de l'identifiant de votre ordinateur et la référence du paiement. Stripe s'occupe du paiement et envoie le reçu, comme pour tout paiement Pelli. Une fois activé, Plus marche hors ligne. diff --git a/README.md b/README.md index 2933cbf..d23f7e1 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ Sorting stays free and unlimited. **Plus** is for your most demanding shoots: ** | **Maximum precision** | 5 more models, about 777 MB, downloaded once: RetinaFace ResNet-50 finds the small faces of group photos (a second pass at 1280 px), DINOv2 groups bursts and near-duplicates (it separates duplicates from different scenes about twice as clearly as Standard's CLIP B/32: +0.25 of cosine against +0.11), CLIP ViT-L/14 (a vision model about 3.5 times bigger) for search and the aesthetic score, RF-DETR-Seg judges subjects without a usable face (seen from behind, animals), with the LAION V2 aesthetic head. Slower, finer. | | **AI search** | Type "first dance", "blue dress" or "robe bleue": the matching photos come first. | | **Detailed statistics** | Across all your shoots: the keep rate, overall and per shoot; why photos were rejected (the main reason the AI gave, or your own choice); how often you turned the AI's call around, both ways; photos per month of capture; bursts stacked; your cameras and their keep rate; and the analysis speed measured on your computer, per precision. A table of your shoots opens each one. Computed on your computer, never sent. | -| **No Pelli promotion** | The free version shows two small Pelli cards, on the home screen and at the end of an export. Plus removes them. | +| **No Pelli promotion** | The free version shows two small Pelli cards, on the home screen and at the end of an export, and once, after your third export, a card inviting you to follow Pelli on Instagram or star the project on GitHub. Plus removes them. | - **One key per computer, transferable.** Payment goes through Stripe in your browser, and the app activates by itself. Your key (`XXXX-XXXX-XXXX-XXXX`) is shown in the app and on the confirmation page: to move Plus to another computer, *Release this licence* in *Settings → Pelli Instant Plus*, then enter the key on the other one. Reinstalling on the same computer just needs the key again. - **Private.** Pelli keeps no name, no e-mail and no country for Plus: only the key, a hash of your computer's id and the payment's reference. Stripe handles the payment and sends the receipt, as for every Pelli payment. Once activated, Plus works offline. diff --git a/src/components/export/ExportProgress.tsx b/src/components/export/ExportProgress.tsx index cdbae31..27f8c97 100644 --- a/src/components/export/ExportProgress.tsx +++ b/src/components/export/ExportProgress.tsx @@ -2,6 +2,7 @@ import { Button, Progress, Spinner } from '@heroui/react' import { CircleCheck, ExternalLink, FolderSearch, Info, TriangleAlert, UploadCloud } from 'lucide-react' import type { ReactNode } from 'react' import { PelliExportPromo } from '@/components/promo/PelliPromo' +import { SupportCard, useSupportCard } from '@/components/promo/SupportCard' import { IconBox } from '@/components/ui/IconBox' import { api } from '@/lib/api' import { formatBytes, formatNumber } from '@/lib/format' @@ -70,6 +71,7 @@ export function ExportReportView() { const error = useExportStore((s) => s.error) const errorCode = useExportStore((s) => s.errorCode) const signOut = useAppStore((s) => s.signOut) + const askSupport = useSupportCard() const folder = context?.rejectsFolder ?? '_Rejets Pelli' return ( @@ -115,7 +117,9 @@ export function ExportReportView() { {t('export.lightroomHint')}

)} - {!error && !uploadReport && } + {/* One card at a time: the one-time support card replaces the Pelli line when it shows. */} + {!error && askSupport && } + {!error && !askSupport && !uploadReport && }
{context && ( +
+ + + +
+

{t('support.title')}

+

{t('support.body')}

+ + +
+
+
+ ) +} diff --git a/src/lib/i18n/locales/de.ts b/src/lib/i18n/locales/de.ts index 506c796..ecf3170 100644 --- a/src/lib/i18n/locales/de.ts +++ b/src/lib/i18n/locales/de.ts @@ -727,6 +727,12 @@ export const de: Catalogue = { homeCta: 'Kostenlos testen', export: 'Senden Sie diese Auswahl mit einer Pelli-Galerie an Ihre Kunden', }, + support: { + title: 'Spart Ihnen Pelli Instant Zeit?', + body: 'Folgen Sie Pelli auf Instagram: Tipps zur Bildauswahl, Neuigkeiten und Blicke hinter die Kulissen.', + instagram: '@pelli.io auf Instagram folgen', + github: 'Oder geben Sie uns einen Stern auf GitHub: Das ist kostenlos und hilft uns am meisten.', + }, onboarding: { skip: 'Überspringen', back: 'Zurück', diff --git a/src/lib/i18n/locales/en.ts b/src/lib/i18n/locales/en.ts index 3b48ad6..d984cf3 100644 --- a/src/lib/i18n/locales/en.ts +++ b/src/lib/i18n/locales/en.ts @@ -727,6 +727,12 @@ export const en: Catalogue = { homeCta: 'Free trial', export: 'Send this selection to your clients with a Pelli gallery', }, + support: { + title: 'Is Pelli Instant saving you time?', + body: 'Follow Pelli on Instagram for culling tips, news and behind the scenes.', + instagram: 'Follow @pelli.io on Instagram', + github: 'Or leave a star on GitHub: it’s free, and it’s the best way to help us.', + }, onboarding: { skip: 'Skip', back: 'Back', diff --git a/src/lib/i18n/locales/es.ts b/src/lib/i18n/locales/es.ts index 6981649..1946e6d 100644 --- a/src/lib/i18n/locales/es.ts +++ b/src/lib/i18n/locales/es.ts @@ -727,6 +727,12 @@ export const es: Catalogue = { homeCta: 'Prueba gratis', export: 'Envía esta selección a tus clientes con una galería de Pelli', }, + support: { + title: '¿Pelli Instant te ahorra tiempo?', + body: 'Sigue a Pelli en Instagram: consejos de selección, novedades y entre bastidores.', + instagram: 'Seguir a @pelli.io en Instagram', + github: 'O deja una estrella en GitHub: es gratis y es la mejor manera de ayudarnos.', + }, onboarding: { skip: 'Omitir', back: 'Atrás', diff --git a/src/lib/i18n/locales/fr.ts b/src/lib/i18n/locales/fr.ts index 815ae28..35394f7 100644 --- a/src/lib/i18n/locales/fr.ts +++ b/src/lib/i18n/locales/fr.ts @@ -725,6 +725,12 @@ export const fr = { homeCta: 'Essai gratuit', export: 'Envoyez cette sélection à vos clients avec une galerie Pelli', }, + support: { + title: 'Pelli Instant vous fait gagner du temps ?', + body: 'Suivez Pelli sur Instagram : astuces de tri, nouveautés et coulisses.', + instagram: 'Suivre @pelli.io sur Instagram', + github: 'Ou laissez une étoile sur GitHub : c’est gratuit, et c’est la meilleure façon de nous aider.', + }, onboarding: { skip: 'Passer', back: 'Retour', diff --git a/src/lib/i18n/locales/it.ts b/src/lib/i18n/locales/it.ts index 32c1231..53bf017 100644 --- a/src/lib/i18n/locales/it.ts +++ b/src/lib/i18n/locales/it.ts @@ -727,6 +727,12 @@ export const it: Catalogue = { homeCta: 'Prova gratuita', export: 'Invia questa selezione ai tuoi clienti con una galleria Pelli', }, + support: { + title: 'Pelli Instant ti fa risparmiare tempo?', + body: 'Segui Pelli su Instagram: consigli per la selezione, novità e dietro le quinte.', + instagram: 'Segui @pelli.io su Instagram', + github: 'Oppure lascia una stella su GitHub: è gratis ed è il modo migliore per aiutarci.', + }, onboarding: { skip: 'Salta', back: 'Indietro', diff --git a/src/lib/i18n/locales/nl.ts b/src/lib/i18n/locales/nl.ts index 09fe61f..979818e 100644 --- a/src/lib/i18n/locales/nl.ts +++ b/src/lib/i18n/locales/nl.ts @@ -727,6 +727,12 @@ export const nl: Catalogue = { homeCta: 'Gratis proberen', export: 'Stuur deze selectie naar je klanten met een Pelli-galerij', }, + support: { + title: 'Bespaart Pelli Instant je tijd?', + body: 'Volg Pelli op Instagram: tips voor het selecteren, nieuws en een kijkje achter de schermen.', + instagram: 'Volg @pelli.io op Instagram', + github: 'Of geef ons een ster op GitHub: het is gratis en de beste manier om ons te helpen.', + }, onboarding: { skip: 'Overslaan', back: 'Terug', diff --git a/src/lib/i18n/locales/pl.ts b/src/lib/i18n/locales/pl.ts index f7b04da..85123ca 100644 --- a/src/lib/i18n/locales/pl.ts +++ b/src/lib/i18n/locales/pl.ts @@ -802,6 +802,12 @@ export const pl: Catalogue = { homeCta: 'Bezpłatny okres próbny', export: 'Wyślij ten wybór klientom w galerii Pelli', }, + support: { + title: 'Pelli Instant oszczędza Ci czas?', + body: 'Obserwuj Pelli na Instagramie: porady dotyczące selekcji, nowości i kulisy.', + instagram: 'Obserwuj @pelli.io na Instagramie', + github: 'Albo zostaw gwiazdkę na GitHubie: to nic nie kosztuje, a najbardziej nam pomaga.', + }, onboarding: { skip: 'Pomiń', back: 'Wstecz', diff --git a/src/lib/i18n/locales/pt.ts b/src/lib/i18n/locales/pt.ts index b514dfd..73fe70e 100644 --- a/src/lib/i18n/locales/pt.ts +++ b/src/lib/i18n/locales/pt.ts @@ -727,6 +727,12 @@ export const pt: Catalogue = { homeCta: 'Teste grátis', export: 'Envie esta seleção aos seus clientes com uma galeria Pelli', }, + support: { + title: 'O Pelli Instant economiza seu tempo?', + body: 'Siga o Pelli no Instagram: dicas de seleção, novidades e bastidores.', + instagram: 'Seguir @pelli.io no Instagram', + github: 'Ou deixe uma estrela no GitHub: é grátis e é a melhor forma de nos ajudar.', + }, onboarding: { skip: 'Pular', back: 'Voltar', diff --git a/src/lib/i18n/locales/sv.ts b/src/lib/i18n/locales/sv.ts index 34c46e2..d7bdcfd 100644 --- a/src/lib/i18n/locales/sv.ts +++ b/src/lib/i18n/locales/sv.ts @@ -727,6 +727,12 @@ export const sv: Catalogue = { homeCta: 'Prova gratis', export: 'Skicka det här urvalet till dina kunder med ett Pelli-galleri', }, + support: { + title: 'Sparar Pelli Instant tid åt dig?', + body: 'Följ Pelli på Instagram: tips om bildurval, nyheter och en titt bakom kulisserna.', + instagram: 'Följ @pelli.io på Instagram', + github: 'Eller ge oss en stjärna på GitHub: det är gratis och det bästa sättet att hjälpa oss.', + }, onboarding: { skip: 'Hoppa över', back: 'Tillbaka', diff --git a/src/lib/links.ts b/src/lib/links.ts index 5f4c4d3..345cdf4 100644 --- a/src/lib/links.ts +++ b/src/lib/links.ts @@ -2,6 +2,8 @@ export const GITHUB_URL = 'https://github.com/Synapsr/Pelli-Instant' export const PELLI_URL = 'https://pelli.io' +/** Pelli's Instagram, which the one-time support card invites to follow. */ +export const INSTAGRAM_URL = 'https://www.instagram.com/pelli.io/' /** Where the Pelli promotion of the free version leads (`home`, `export`). */ export function pelliPromoUrl(campaign: 'home' | 'export'): string { diff --git a/src/lib/support.test.ts b/src/lib/support.test.ts new file mode 100644 index 0000000..fc35823 --- /dev/null +++ b/src/lib/support.test.ts @@ -0,0 +1,22 @@ +import { describe, expect, it } from 'vitest' +import { SUPPORT_AFTER_EXPORTS, shouldAskSupport } from './support' + +const base = { exportsDone: SUPPORT_AFTER_EXPORTS, closed: false, plusLoaded: true, plusActive: false } + +describe('support card', () => { + it('shows after a few successful exports', () => { + expect(shouldAskSupport(base)).toBe(true) + expect(shouldAskSupport({ ...base, exportsDone: SUPPORT_AFTER_EXPORTS + 5 })).toBe(true) + expect(shouldAskSupport({ ...base, exportsDone: SUPPORT_AFTER_EXPORTS - 1 })).toBe(false) + expect(shouldAskSupport({ ...base, exportsDone: 0 })).toBe(false) + }) + + it('never comes back once closed or used', () => { + expect(shouldAskSupport({ ...base, closed: true })).toBe(false) + }) + + it('is hidden with Plus, and until the engine said whether Plus is active', () => { + expect(shouldAskSupport({ ...base, plusActive: true })).toBe(false) + expect(shouldAskSupport({ ...base, plusLoaded: false })).toBe(false) + }) +}) diff --git a/src/lib/support.ts b/src/lib/support.ts new file mode 100644 index 0000000..d5a2656 --- /dev/null +++ b/src/lib/support.ts @@ -0,0 +1,23 @@ +/** + * The free version's one-time "support us" card: after a few successful + * exports, it asks to follow Pelli on Instagram, and in second place to star + * the project on GitHub. Shown once, at the end of an export, never as a + * pop-up; hidden with Plus, like the other Pelli cards. + */ + +/** Successful exports before the card shows: by then the app has proved useful. */ +export const SUPPORT_AFTER_EXPORTS = 3 + +export interface SupportCardInput { + /** successful exports on this computer */ + exportsDone: number + /** the card was closed, or one of its links opened */ + closed: boolean + /** whether the engine already said if Plus is active */ + plusLoaded: boolean + plusActive: boolean +} + +export function shouldAskSupport({ exportsDone, closed, plusLoaded, plusActive }: SupportCardInput): boolean { + return plusLoaded && !plusActive && !closed && exportsDone >= SUPPORT_AFTER_EXPORTS +} diff --git a/src/store/export-store.ts b/src/store/export-store.ts index 5abd9d5..ea21406 100644 --- a/src/store/export-store.ts +++ b/src/store/export-store.ts @@ -6,6 +6,7 @@ import { t } from '@/lib/i18n' import { notify } from '@/lib/notify' import { playSound } from '@/lib/sound' import { useAppStore } from './app-store' +import { usePrefsStore } from './prefs-store' export type ExportPhase = 'configure' | 'exporting' | 'uploading' | 'done' @@ -94,6 +95,7 @@ export const useExportStore = create((set, get) => ({ await api().uploadToPelli(projectId, upload) } else { set({ phase: 'done' }) + if (report.errors.length === 0) usePrefsStore.getState().countExport() playSound('exportDone') } } catch (error) { @@ -161,6 +163,7 @@ export const useExportStore = create((set, get) => ({ onUploadDone: (report) => { if (report.projectId !== get().projectId || get().phase !== 'uploading') return set({ phase: 'done', uploadReport: report }) + if (report.failed === 0 && (get().report?.errors.length ?? 0) === 0) usePrefsStore.getState().countExport() playSound('exportDone') if (!get().background) return const skippedOnly = report.uploaded === 0 && (report.skipped ?? 0) > 0 diff --git a/src/store/prefs-store.test.ts b/src/store/prefs-store.test.ts index 7ad68a3..86af80b 100644 --- a/src/store/prefs-store.test.ts +++ b/src/store/prefs-store.test.ts @@ -51,4 +51,24 @@ describe('preferences', () => { expect(mapping.labelLanguage).toBe('en') expect(xmpExportMapping(mapping, 'fr')).toMatchObject({ labelLanguage: 'en', label: { toReview: 'blue' } }) }) + + it('counts successful exports and remembers a closed support card', async () => { + const saved = new Map() + vi.stubGlobal('localStorage', { + getItem: (key: string) => saved.get(key) ?? null, + setItem: (key: string, value: string) => saved.set(key, value), + removeItem: (key: string) => saved.delete(key), + }) + vi.resetModules() + const { usePrefsStore: fresh } = await import('./prefs-store') + // Preferences saved before the card existed start from zero, card not closed. + expect(fresh.getState().exportsDone).toBe(0) + expect(fresh.getState().supportCardClosed).toBe(false) + fresh.getState().countExport() + fresh.getState().countExport() + fresh.getState().closeSupportCard() + const stored = JSON.parse(saved.get('pelli-cull:prefs') ?? '{}') + expect(stored.state.exportsDone).toBe(2) + expect(stored.state.supportCardClosed).toBe(true) + }) }) diff --git a/src/store/prefs-store.ts b/src/store/prefs-store.ts index 06e239e..9181d5b 100644 --- a/src/store/prefs-store.ts +++ b/src/store/prefs-store.ts @@ -35,6 +35,10 @@ export interface PrefsState { xmpMapping: XmpMapping /** the last version the update announcement was closed for: it is not announced again */ dismissedUpdate: string | null + /** successful exports on this computer, for the one-time support card */ + exportsDone: number + /** the support card was closed, or one of its links opened: it doesn't show again */ + supportCardClosed: boolean setThumbSize: (size: number) => void toggleSidebar: () => void toggleInspector: () => void @@ -45,6 +49,8 @@ export interface PrefsState { setXmpMapping: (decision: FinalDecision, patch: { rating?: number; label?: ColorLabel }) => void setLabelLanguage: (language: Language | null) => void setDismissedUpdate: (version: string) => void + countExport: () => void + closeSupportCard: () => void } export const THUMB_MIN = 120 @@ -110,6 +116,8 @@ export const usePrefsStore = create()( voice: true, xmpMapping: DEFAULT_XMP_MAPPING, dismissedUpdate: null, + exportsDone: 0, + supportCardClosed: false, setThumbSize: (size) => set({ thumbSize: Math.round(Math.min(THUMB_MAX, Math.max(THUMB_MIN, size))) }), toggleSidebar: () => set((s) => ({ sidebarOpen: !s.sidebarOpen })), toggleInspector: () => set((s) => ({ inspectorOpen: !s.inspectorOpen })), @@ -127,6 +135,8 @@ export const usePrefsStore = create()( })), setLabelLanguage: (labelLanguage) => set(({ xmpMapping }) => ({ xmpMapping: { ...xmpMapping, labelLanguage } })), setDismissedUpdate: (dismissedUpdate) => set({ dismissedUpdate }), + countExport: () => set((s) => ({ exportsDone: (Number.isFinite(s.exportsDone) ? s.exportsDone : 0) + 1 })), + closeSupportCard: () => set({ supportCardClosed: true }), }), { name: 'pelli-cull:prefs', @@ -145,6 +155,8 @@ export const usePrefsStore = create()( voice: s.voice, xmpMapping: s.xmpMapping, dismissedUpdate: s.dismissedUpdate, + exportsDone: s.exportsDone, + supportCardClosed: s.supportCardClosed, }), }, ),