chahinebrini 804d4a5861 feat(native): device-info api headers + DeviceLimitSheet UI + profile i18n sweep
- lib/api.ts: sends x-device-name + x-device-model + x-device-os headers
  (cached per session, URL-encoded). Backend persists into user_devices for
  visual differentiation in DeviceLimitSheet.
- DeviceLimitReachedSheet: renders name (primary) + model · OS-version
  (secondary), "Dieses Gerät"-Pill on isCurrent. Stale phantoms become
  distinguishable.
- Profile i18n sweep: 8 keys × 3 languages = 24 fixes — all {{var}} placeholders
  switched to %{var} matching i18next config (Vue-i18n leftover from Nuxt-port).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 21:16:22 +02:00

36 lines
859 B
TypeScript

import { create } from 'zustand';
export type DeviceLimitDevice = {
id: string;
deviceId: string;
platform: string;
model: string | null;
name: string | null;
osVersion: string | null;
lastSeenAt: string;
createdAt: string;
isCurrent?: boolean;
};
type DeviceLimitState = {
visible: boolean;
devices: DeviceLimitDevice[];
max: number;
plan: string;
show: (devices: DeviceLimitDevice[], max: number, plan: string) => void;
hide: () => void;
removeDevice: (id: string) => void;
};
export const useDeviceLimitStore = create<DeviceLimitState>((set) => ({
visible: false,
devices: [],
max: 0,
plan: 'free',
show: (devices, max, plan) => set({ visible: true, devices, max, plan }),
hide: () => set({ visible: false }),
removeDevice: (id) =>
set((s) => ({ devices: s.devices.filter((d) => d.id !== id) })),
}));