Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,49 @@ missing or unauthorized code, tag overflow, or activation-limit failure rolls
back the whole batch. Changing filters clears selection. Individual and batch
activation writes share an organization lock to protect plan limits under
concurrent requests. This release requires no database schema migration.

## Campaign workspace additions

Twenty additions extend the toolkit and managed library:

1. Website QR codes with HTTP/HTTPS validation.
2. Calendar event QR codes with validated UTC start/end times and escaped event text.
3. Place/address QR codes using Google Maps search links.
4. Social profile QR codes for Instagram, TikTok, X, GitHub, and LinkedIn.
5. Campaign source/medium presets for posters, packaging, events, and newsletters.
6. Import UTM parameters from an existing campaign URL.
7. Normalize campaign values to lowercase with hyphenated spaces.
8. Generate up to 100 campaign source variants and export them as CSV.
9. Open the managed QR builder with a completed campaign destination and name.
10. Save, load, and delete up to 30 toolkit drafts in the current browser.
11. Export/import validated, versioned JSON draft files.
12. Classic, Teal, and Ink QR design presets.
13. Custom foreground/background colors for toolkit QR codes and print cards.
14. Contrast checks that block low-contrast or inverted QR exports.
15. Raster export resolutions of 600, 1200, or 2400 pixels.
16. JPEG and WebP toolkit downloads, alongside existing PNG/SVG exports.
17. Custom, sanitized export filenames.
18. Persistent QR library favorites and a favorites-only filter.
19. Destination domain filtering, including secondary weighted destinations.
20. Save, apply, and delete up to 20 library views with search, filters, and sorting.

Drafts, favorites, and saved views use versioned browser storage scoped by both
user ID and organization ID. They stay on this browser; portable draft files can
be explicitly moved between browsers. Wi-Fi passwords are omitted from saved,
exported, and imported drafts. A contrast check is a design guard, not a guarantee
of scanner compatibility: test the final code on the intended scanning devices.
Calendar event scanner support varies by device; the payload uses the
[ZXing VEVENT convention](https://github.com/zxing/zxing/wiki/Barcode-Contents#calendar-events).

This release adds no database migration, changes no API responses, and preserves
existing managed short links. Campaign handoff only prefills the existing create
screen; the code is saved when the user submits that screen. Toolkit image exports
contain the QR, while printing includes the card heading and caption.

The style review used Mobbin screen references retrieved by the coordinating
session and visually inspected here:
[Braintrust library](https://mobbin.com/screens/b6ba8022-ce35-4276-9539-c4a59bb0507c)
and [Claude utility](https://mobbin.com/screens/31119433-f7f8-48aa-91a6-cee4d0360e83).
The cleanup unifies shared/workspace light and dark color tokens, removes legacy
border/shadow overrides, aligns labeled controls, groups related actions, and
keeps the existing responsive navigation and library layout.
2 changes: 1 addition & 1 deletion src/components/auth/auth-brand.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export function AuthBrand() {
return (
<div className="mb-8 sm:mb-10">
<span className="text-[2rem] font-extrabold leading-none tracking-tight text-[#de6346] sm:text-[2.45rem]">
<span className="text-[2rem] font-semibold leading-none tracking-tight text-[#de6346] sm:text-[2.45rem]">
Easy Access QR
</span>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/marketing/marketing-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function MarketingHeader({
<Link
to="/"
aria-label="Easy Access QR home"
className="shrink-0 whitespace-nowrap text-xl font-extrabold leading-none tracking-tight text-[#de6346] sm:text-2xl lg:text-[30px]"
className="shrink-0 whitespace-nowrap text-xl font-semibold leading-none tracking-tight text-[#de6346] sm:text-2xl lg:text-[30px]"
>
Easy Access QR
</Link>
Expand Down Expand Up @@ -114,7 +114,7 @@ export function MarketingHeader({
className="w-[88vw] max-w-sm border-r border-ds-border bg-ds-surface p-0 text-ds-fg"
>
<SheetHeader className="border-b border-ds-border p-5 text-left">
<SheetTitle className="text-xl font-extrabold text-[#de6346]">
<SheetTitle className="text-xl font-semibold text-[#de6346]">
Easy Access QR
</SheetTitle>
<SheetDescription className="text-ds-text-secondary">
Expand Down
156 changes: 156 additions & 0 deletions src/components/qr/campaign-tools.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
import { Link } from "@tanstack/react-router";
import { ArrowUpRight, Download, WandSparkles } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";
import { Button } from "@/components/ui/button";
import {
Field,
FieldDescription,
FieldGroup,
FieldLabel,
} from "@/components/ui/field";
import { NativeSelect } from "@/components/ui/native-select";
import { Textarea } from "@/components/ui/textarea";
import { downloadCsv } from "@/lib/client-export";
import { cleanTrackingUrl, type ToolkitFields } from "@/lib/qr-toolkit";
import {
campaignPresets,
campaignVariants,
importCampaignUrl,
normalizeCampaign,
} from "@/lib/qr-workspace";

export function CampaignTools({
fields,
onChange,
payload,
}: {
fields: ToolkitFields;
onChange: (fields: ToolkitFields) => void;
payload: string;
}) {
const [sources, setSources] = useState("");
const action = (operation: () => void) => {
try {
operation();
} catch (cause) {
toast.error((cause as Error).message);
}
};
return (
<div className="flex flex-col gap-4">
<Field>
<FieldLabel htmlFor="campaign-preset">Campaign preset</FieldLabel>
<NativeSelect
id="campaign-preset"
value=""
onChange={(event) => {
const preset = campaignPresets.find(
(item) => item.id === event.target.value,
);
if (preset)
onChange({
...fields,
source: preset.source,
medium: preset.medium,
});
}}
>
<option value="">Apply a source and medium…</option>
{campaignPresets.map((preset) => (
<option key={preset.id} value={preset.id}>
{preset.name}
</option>
))}
</NativeSelect>
</Field>
<div className="flex flex-wrap gap-2">
<Button
variant="outline"
size="sm"
onClick={() =>
action(() => {
onChange(importCampaignUrl(fields.url || ""));
toast.success("Campaign parameters imported");
})
}
>
Import parameters from URL
</Button>
<Button
variant="outline"
size="sm"
onClick={() => onChange(normalizeCampaign(fields))}
>
<WandSparkles data-icon="inline-start" />
Normalize campaign values
</Button>
<Button
variant="outline"
size="sm"
onClick={() =>
action(() => {
onChange({ ...fields, url: cleanTrackingUrl(fields.url || "") });
toast.success("Tracking parameters removed from destination");
})
}
>
Clean tracking parameters
</Button>
</div>
<details className="rounded-lg border p-3">
<summary className="cursor-pointer text-sm font-medium">
Generate campaign variants
</summary>
<FieldGroup className="mt-4">
<Field>
<FieldLabel htmlFor="campaign-sources">Variant sources</FieldLabel>
<Textarea
id="campaign-sources"
placeholder={"store-chicago\nstore-austin\nstore-boston"}
maxLength={8000}
value={sources}
onChange={(event) => setSources(event.target.value)}
/>
<FieldDescription>
One source per line, up to 100. Other campaign fields stay the
same.
</FieldDescription>
</Field>
<Button
variant="outline"
disabled={!sources.trim()}
onClick={() =>
action(() => {
const variants = campaignVariants(fields, sources);
downloadCsv("campaign-variants", [
["Source", "Campaign URL"],
...variants.map((item) => [item.source, item.url]),
]);
toast.success(`Exported ${variants.length} campaign URLs`);
})
}
>
<Download data-icon="inline-start" />
Export variants CSV
</Button>
</FieldGroup>
</details>
{payload ? (
<Button asChild variant="secondary">
<Link
to="/app/qr-codes/new"
search={{ destination: payload, name: fields.campaign || "" }}
>
Create managed campaign QR
<ArrowUpRight data-icon="inline-end" />
</Link>
</Button>
) : null}
<p className="text-xs text-muted-foreground">
Managed codes track scans and let you change the destination after
printing.
</p>
</div>
);
}
152 changes: 152 additions & 0 deletions src/components/qr/library-productivity.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
import { Bookmark, Star, Trash2 } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";
import { Button } from "@/components/ui/button";
import {
Field,
FieldDescription,
FieldGroup,
FieldLabel,
} from "@/components/ui/field";
import { Input } from "@/components/ui/input";
import { NativeSelect } from "@/components/ui/native-select";
import type { SavedLibraryView } from "@/lib/qr-workspace";
import { createLocalId } from "@/lib/qr-workspace";

export function LibraryProductivity({
hosts,
current,
views,
onChange,
onSave,
onDelete,
}: {
hosts: string[];
current: Omit<SavedLibraryView, "id" | "name">;
views: SavedLibraryView[];
onChange: (view: Omit<SavedLibraryView, "id" | "name">) => void;
onSave: (view: SavedLibraryView) => boolean;
onDelete: (id: string) => boolean;
}) {
const [name, setName] = useState("");
const [selected, setSelected] = useState("");
return (
<div className="flex flex-col gap-3 border-t pt-3">
<div className="flex flex-wrap items-end gap-3">
<Field className="min-w-0 flex-1">
<FieldLabel htmlFor="destination-host">Destination domain</FieldLabel>
<NativeSelect
id="destination-host"
value={current.host}
onChange={(event) => {
setSelected("");
onChange({ ...current, host: event.target.value });
}}
>
<option value="all">All destination domains</option>
{hosts.map((host) => (
<option key={host} value={host}>
{host}
</option>
))}
{current.host !== "all" && !hosts.includes(current.host) ? (
<option value={current.host}>{current.host} (no codes)</option>
) : null}
</NativeSelect>
</Field>
<Button
variant="outline"
aria-pressed={current.favoritesOnly}
onClick={() => {
setSelected("");
onChange({ ...current, favoritesOnly: !current.favoritesOnly });
}}
>
<Star data-icon="inline-start" />
{current.favoritesOnly ? "Showing favorites" : "Favorites only"}
</Button>
</div>
<details>
<summary className="cursor-pointer text-xs font-medium text-muted-foreground">
Saved library views
</summary>
<FieldGroup className="mt-4">
<Field>
<FieldLabel htmlFor="library-view">Saved view</FieldLabel>
<NativeSelect
id="library-view"
value={views.some((view) => view.id === selected) ? selected : ""}
onChange={(event) => {
setSelected(event.target.value);
const view = views.find(
(item) => item.id === event.target.value,
);
if (view) {
onChange(view);
toast.success(`Applied ${view.name}`);
}
}}
>
<option value="">Choose a view…</option>
{views.map((view) => (
<option value={view.id} key={view.id}>
{view.name}
</option>
))}
</NativeSelect>
</Field>
<Field>
<FieldLabel htmlFor="library-view-name">New view name</FieldLabel>
<Input
id="library-view-name"
maxLength={60}
value={name}
placeholder="Active store posters"
onChange={(event) => setName(event.target.value)}
/>
<FieldDescription>
Save search, filters, and sort order in this browser and
workspace.
</FieldDescription>
</Field>
<div className="flex flex-wrap gap-2">
<Button
size="sm"
variant="outline"
disabled={!name.trim() || views.length >= 20}
onClick={() => {
const view = {
...current,
id: createLocalId(),
name: name.trim(),
};
if (onSave(view)) {
setName("");
setSelected(view.id);
toast.success("View saved");
} else toast.error("Browser storage is unavailable.");
}}
>
<Bookmark data-icon="inline-start" />
Save current view
</Button>
<Button
size="sm"
variant="ghost"
disabled={!selected}
onClick={() => {
if (onDelete(selected)) {
setSelected("");
toast.success("View deleted");
} else toast.error("Browser storage is unavailable.");
}}
>
<Trash2 data-icon="inline-start" />
Delete view
</Button>
</div>
</FieldGroup>
</details>
</div>
);
}
2 changes: 1 addition & 1 deletion src/components/qr/qr-preview-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export function QrPreviewModal({
</div>
<div
ref={handlePreviewContainerRef}
className="flex min-h-[260px] items-center justify-center overflow-hidden rounded-lg border border-ds-border bg-white p-3 [&>canvas]:h-auto [&>canvas]:max-w-full [&>svg]:h-auto [&>svg]:max-w-full"
className="flex min-h-[260px] items-center justify-center overflow-hidden rounded-lg border border-ds-border bg-ds-surface p-3 [&>canvas]:h-auto [&>canvas]:max-w-full [&>svg]:h-auto [&>svg]:max-w-full"
/>
</div>

Expand Down
Loading
Loading