feat(collections): per-collection custom labels

Each list can now define its own labels (e.g. Berlin, Hamburg, Ostsee in a
"Germany 2026" list) and organise its places by them:

- manage labels (create / rename / recolor / delete) from a label manager
- assign labels to a place from its detail sheet, or to many places at once
  from the selection toolbar
- filter the place list AND the map by label (multi-select, any-match)

Labels are scoped to a collection and shared by all its members. Managing and
assigning labels needs edit rights; filtering is available to everyone. Moving
a place to another list drops its labels, since they belong to the source list.
This commit is contained in:
Maurice
2026-07-05 00:19:51 +02:00
committed by Maurice
parent 6f20c11dff
commit a5522e99d8
45 changed files with 1224 additions and 26 deletions
@@ -22,6 +22,17 @@ export const collectionLinkSchema = z.object({
export type CollectionLink = z.infer<typeof collectionLinkSchema>;
export const collectionLinksSchema = z.array(collectionLinkSchema).max(30);
/** A custom label defined per-collection (distinct from the instance-wide tags).
* Members group and filter a list's places by these. */
export const collectionLabelSchema = z.object({
id: z.number(),
collection_id: z.number(),
name: z.string(),
color: z.string().nullable().optional(),
sort_order: z.number().optional(),
});
export type CollectionLabel = z.infer<typeof collectionLabelSchema>;
/** A saved place — assignmentPlace minus itinerary, plus status + provenance. */
export const collectionPlaceSchema = z.object({
id: z.number(),
@@ -52,6 +63,8 @@ export const collectionPlaceSchema = z.object({
links: collectionLinksSchema.optional(),
category: placeCategorySchema.optional(),
tags: z.array(tagSchema.partial()).optional(),
/** Ids of the per-collection labels assigned to this place. */
label_ids: z.array(z.number()).optional(),
});
export type CollectionPlace = z.infer<typeof collectionPlaceSchema>;
@@ -81,6 +94,7 @@ export const collectionSchema = z.object({
place_count: z.number().optional(),
is_owner: z.boolean().optional(),
members: z.array(collectionMemberSchema).optional(),
labels: z.array(collectionLabelSchema).optional(),
created_at: z.string().optional(),
updated_at: z.string().optional(),
});
@@ -156,6 +170,8 @@ export const collectionPlaceUpdateRequestSchema = z.object({
collection_id: z.number().optional(), // move to another list
links: collectionLinksSchema.optional(),
tag_ids: z.array(z.number()).optional(),
// Replace the place's per-collection label assignments (omit to leave unchanged).
label_ids: z.array(z.number()).optional(),
});
export type CollectionPlaceUpdateRequest = z.infer<typeof collectionPlaceUpdateRequestSchema>;
@@ -202,6 +218,32 @@ export const collectionSetMemberRoleRequestSchema = z.object({
});
export type CollectionSetMemberRoleRequest = z.infer<typeof collectionSetMemberRoleRequestSchema>;
// ── Labels ──────────────────────────────────────────────────────────────────
const labelColorSchema = z.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);
/** Create a custom label in a list. */
export const collectionLabelCreateRequestSchema = z.object({
collection_id: z.number(),
name: z.string().trim().min(1).max(60),
color: labelColorSchema.optional(),
});
export type CollectionLabelCreateRequest = z.infer<typeof collectionLabelCreateRequestSchema>;
/** Rename / recolor a label (all fields optional). */
export const collectionLabelUpdateRequestSchema = z.object({
name: z.string().trim().min(1).max(60).optional(),
color: labelColorSchema.optional(),
sort_order: z.number().optional(),
});
export type CollectionLabelUpdateRequest = z.infer<typeof collectionLabelUpdateRequestSchema>;
/** Bulk add or remove one/several labels across many selected places. */
export const collectionLabelAssignRequestSchema = z.object({
label_ids: z.array(z.number()).min(1).max(50),
place_ids: z.array(z.number()).min(1).max(1000),
});
export type CollectionLabelAssignRequest = z.infer<typeof collectionLabelAssignRequestSchema>;
// ── Responses ─────────────────────────────────────────────────────────────
export const collectionListResponseSchema = z.object({
collections: z.array(collectionSchema),
+10
View File
@@ -144,6 +144,16 @@ const collection: TranslationStrings = {
'collections.widget.title': 'المجموعات',
'collections.widget.empty': 'لا توجد أماكن محفوظة بعد',
'collections.widget.savedCount': '{count} محفوظة',
'collections.labels.title': 'التسميات',
'collections.labels.manage': 'إدارة التسميات',
'collections.labels.add': 'إضافة تسمية',
'collections.labels.name': 'اسم التسمية',
'collections.labels.namePlaceholder': 'مثال: برلين',
'collections.labels.assign': 'تعيين تسمية',
'collections.labels.assignN': 'إضافة تسميات إلى {count} أماكن',
'collections.labels.assignedCount': 'تمت تسمية {count} أماكن',
'collections.labels.empty': 'لا توجد تسميات بعد',
'collections.labels.emptyHint': 'أنشئ تسمية أولًا لتجميع الأماكن في هذه القائمة.',
};
export default collection;
+10
View File
@@ -144,6 +144,16 @@ const collection: TranslationStrings = {
'collections.widget.title': 'Coleções',
'collections.widget.empty': 'Nenhum lugar salvo ainda',
'collections.widget.savedCount': '{count} salvos',
'collections.labels.title': 'Rótulos',
'collections.labels.manage': 'Gerenciar rótulos',
'collections.labels.add': 'Adicionar rótulo',
'collections.labels.name': 'Nome do rótulo',
'collections.labels.namePlaceholder': 'ex.: Berlin',
'collections.labels.assign': 'Atribuir rótulo',
'collections.labels.assignN': 'Adicionar rótulos a {count} lugares',
'collections.labels.assignedCount': '{count} lugares rotulados',
'collections.labels.empty': 'Nenhum rótulo ainda',
'collections.labels.emptyHint': 'Crie um rótulo primeiro para agrupar lugares nesta lista.',
};
export default collection;
+10
View File
@@ -144,6 +144,16 @@ const collection: TranslationStrings = {
'collections.widget.title': 'Sbírky',
'collections.widget.empty': 'Zatím žádná uložená místa',
'collections.widget.savedCount': 'Uloženo: {count}',
'collections.labels.title': 'Štítky',
'collections.labels.manage': 'Spravovat štítky',
'collections.labels.add': 'Přidat štítek',
'collections.labels.name': 'Název štítku',
'collections.labels.namePlaceholder': 'např. Berlin',
'collections.labels.assign': 'Přiřadit štítek',
'collections.labels.assignN': 'Přidat štítky k {count} místům',
'collections.labels.assignedCount': 'Označeno {count} míst',
'collections.labels.empty': 'Zatím žádné štítky',
'collections.labels.emptyHint': 'Nejprve vytvořte štítek, abyste mohli seskupit místa v tomto seznamu.',
};
export default collection;
+10
View File
@@ -144,6 +144,16 @@ const collection: TranslationStrings = {
'collections.widget.title': 'Sammlungen',
'collections.widget.empty': 'Noch keine gespeicherten Orte',
'collections.widget.savedCount': '{count} gespeichert',
'collections.labels.title': 'Labels',
'collections.labels.manage': 'Labels verwalten',
'collections.labels.add': 'Label hinzufügen',
'collections.labels.name': 'Labelname',
'collections.labels.namePlaceholder': 'z. B. Berlin',
'collections.labels.assign': 'Label zuweisen',
'collections.labels.assignN': 'Labels zu {count} Orten hinzufügen',
'collections.labels.assignedCount': '{count} Orte gelabelt',
'collections.labels.empty': 'Noch keine Labels',
'collections.labels.emptyHint': 'Erstelle zuerst ein Label, um Orte in dieser Liste zu gruppieren.',
};
export default collection;
+11
View File
@@ -144,6 +144,17 @@ const collection: TranslationStrings = {
'collections.widget.title': 'Collections',
'collections.widget.empty': 'No saved places yet',
'collections.widget.savedCount': '{count} saved',
'collections.labels.title': 'Labels',
'collections.labels.manage': 'Manage labels',
'collections.labels.add': 'Add label',
'collections.labels.name': 'Label name',
'collections.labels.namePlaceholder': 'e.g. Berlin',
'collections.labels.assign': 'Assign label',
'collections.labels.assignN': 'Add labels to {count} places',
'collections.labels.assignedCount': 'Labelled {count} places',
'collections.labels.empty': 'No labels yet',
'collections.labels.emptyHint': 'Create a label first to group places in this list.',
};
export default collection;
+10
View File
@@ -144,6 +144,16 @@ const collection: TranslationStrings = {
'collections.widget.title': 'Colecciones',
'collections.widget.empty': 'Aún no hay lugares guardados',
'collections.widget.savedCount': '{count} guardados',
'collections.labels.title': 'Etiquetas',
'collections.labels.manage': 'Gestionar etiquetas',
'collections.labels.add': 'Añadir etiqueta',
'collections.labels.name': 'Nombre de la etiqueta',
'collections.labels.namePlaceholder': 'p. ej. Berlin',
'collections.labels.assign': 'Asignar etiqueta',
'collections.labels.assignN': 'Añadir etiquetas a {count} lugares',
'collections.labels.assignedCount': 'Etiquetados {count} lugares',
'collections.labels.empty': 'Aún no hay etiquetas',
'collections.labels.emptyHint': 'Crea primero una etiqueta para agrupar lugares en esta lista.',
};
export default collection;
+10
View File
@@ -144,6 +144,16 @@ const collection: TranslationStrings = {
'collections.widget.title': 'Collections',
'collections.widget.empty': 'Aucun lieu enregistré pour le moment',
'collections.widget.savedCount': '{count} enregistrés',
'collections.labels.title': 'Libellés',
'collections.labels.manage': 'Gérer les libellés',
'collections.labels.add': 'Ajouter un libellé',
'collections.labels.name': 'Nom du libellé',
'collections.labels.namePlaceholder': 'p. ex. Berlin',
'collections.labels.assign': 'Attribuer un libellé',
'collections.labels.assignN': 'Ajouter des libellés à {count} lieux',
'collections.labels.assignedCount': 'Libellés ajoutés à {count} lieux',
'collections.labels.empty': 'Aucun libellé pour le moment',
'collections.labels.emptyHint': 'Créez d’abord un libellé pour regrouper les lieux de cette liste.',
};
export default collection;
+11
View File
@@ -144,6 +144,17 @@ const collection: TranslationStrings = {
'collections.widget.title': 'Συλλογές',
'collections.widget.empty': 'Δεν υπάρχουν αποθηκευμένα μέρη ακόμα',
'collections.widget.savedCount': '{count} αποθηκευμένα',
'collections.labels.title': 'Ετικέτες',
'collections.labels.manage': 'Διαχείριση ετικετών',
'collections.labels.add': 'Προσθήκη ετικέτας',
'collections.labels.name': 'Όνομα ετικέτας',
'collections.labels.namePlaceholder': 'π.χ. Berlin',
'collections.labels.assign': 'Αντιστοίχιση ετικέτας',
'collections.labels.assignN': 'Προσθήκη ετικετών σε {count} μέρη',
'collections.labels.assignedCount': 'Προστέθηκαν ετικέτες σε {count} μέρη',
'collections.labels.empty': 'Δεν υπάρχουν ετικέτες ακόμα',
'collections.labels.emptyHint': 'Δημιούργησε πρώτα μια ετικέτα για να ομαδοποιήσεις μέρη σε αυτή τη λίστα.',
};
export default collection;
+10
View File
@@ -144,6 +144,16 @@ const collection: TranslationStrings = {
'collections.widget.title': 'Gyűjtemények',
'collections.widget.empty': 'Még nincsenek mentett helyek',
'collections.widget.savedCount': '{count} mentve',
'collections.labels.title': 'Címkék',
'collections.labels.manage': 'Címkék kezelése',
'collections.labels.add': 'Címke hozzáadása',
'collections.labels.name': 'Címke neve',
'collections.labels.namePlaceholder': 'pl. Berlin',
'collections.labels.assign': 'Címke hozzárendelése',
'collections.labels.assignN': 'Címkék hozzáadása {count} helyhez',
'collections.labels.assignedCount': '{count} hely felcímkézve',
'collections.labels.empty': 'Még nincsenek címkék',
'collections.labels.emptyHint': 'Előbb hozz létre egy címkét a helyek csoportosításához ebben a listában.',
};
export default collection;
+10
View File
@@ -144,6 +144,16 @@ const collection: TranslationStrings = {
'collections.widget.title': 'Koleksi',
'collections.widget.empty': 'Belum ada tempat tersimpan',
'collections.widget.savedCount': '{count} tersimpan',
'collections.labels.title': 'Label',
'collections.labels.manage': 'Kelola label',
'collections.labels.add': 'Tambah label',
'collections.labels.name': 'Nama label',
'collections.labels.namePlaceholder': 'mis. Berlin',
'collections.labels.assign': 'Beri label',
'collections.labels.assignN': 'Beri label ke {count} tempat',
'collections.labels.assignedCount': '{count} tempat diberi label',
'collections.labels.empty': 'Belum ada label',
'collections.labels.emptyHint': 'Buat label dulu untuk mengelompokkan tempat di daftar ini.',
};
export default collection;
+11
View File
@@ -144,6 +144,17 @@ const collection: TranslationStrings = {
'collections.widget.title': 'Raccolte',
'collections.widget.empty': 'Ancora nessun luogo salvato',
'collections.widget.savedCount': '{count} salvati',
'collections.labels.title': 'Etichette',
'collections.labels.manage': 'Gestisci etichette',
'collections.labels.add': 'Aggiungi etichetta',
'collections.labels.name': 'Nome etichetta',
'collections.labels.namePlaceholder': 'es. Berlin',
'collections.labels.assign': 'Assegna etichetta',
'collections.labels.assignN': 'Aggiungi etichette a {count} luoghi',
'collections.labels.assignedCount': 'Etichettati {count} luoghi',
'collections.labels.empty': 'Ancora nessuna etichetta',
'collections.labels.emptyHint': 'Crea prima un\'etichetta per raggruppare i luoghi in questa lista.',
};
export default collection;
+10
View File
@@ -144,6 +144,16 @@ const collection: TranslationStrings = {
'collections.widget.title': 'コレクション',
'collections.widget.empty': 'まだ保存した場所がありません',
'collections.widget.savedCount': '{count}件保存済み',
'collections.labels.title': 'ラベル',
'collections.labels.manage': 'ラベルを管理',
'collections.labels.add': 'ラベルを追加',
'collections.labels.name': 'ラベル名',
'collections.labels.namePlaceholder': '例: Berlin',
'collections.labels.assign': 'ラベルを割り当て',
'collections.labels.assignN': '{count} 件の場所にラベルを追加',
'collections.labels.assignedCount': '{count} 件の場所にラベルを付けました',
'collections.labels.empty': 'ラベルがまだありません',
'collections.labels.emptyHint': 'まずラベルを作成して、このリスト内の場所をグループ化しましょう。',
};
export default collection;
+10
View File
@@ -144,6 +144,16 @@ const collection: TranslationStrings = {
'collections.widget.title': '컬렉션',
'collections.widget.empty': '아직 저장한 장소가 없습니다',
'collections.widget.savedCount': '{count}개 저장됨',
'collections.labels.title': '레이블',
'collections.labels.manage': '레이블 관리',
'collections.labels.add': '레이블 추가',
'collections.labels.name': '레이블 이름',
'collections.labels.namePlaceholder': '예: Berlin',
'collections.labels.assign': '레이블 지정',
'collections.labels.assignN': '{count}개 장소에 레이블 추가',
'collections.labels.assignedCount': '{count}개 장소에 레이블 지정됨',
'collections.labels.empty': '아직 레이블이 없습니다',
'collections.labels.emptyHint': '먼저 레이블을 만들어 이 목록의 장소를 그룹화하세요.',
};
export default collection;
+10
View File
@@ -144,6 +144,16 @@ const collection: TranslationStrings = {
'collections.widget.title': 'Collecties',
'collections.widget.empty': 'Nog geen opgeslagen plekken',
'collections.widget.savedCount': '{count} opgeslagen',
'collections.labels.title': 'Labels',
'collections.labels.manage': 'Labels beheren',
'collections.labels.add': 'Label toevoegen',
'collections.labels.name': 'Labelnaam',
'collections.labels.namePlaceholder': 'bijv. Berlin',
'collections.labels.assign': 'Label toewijzen',
'collections.labels.assignN': 'Labels toevoegen aan {count} plaatsen',
'collections.labels.assignedCount': '{count} plaatsen gelabeld',
'collections.labels.empty': 'Nog geen labels',
'collections.labels.emptyHint': 'Maak eerst een label om plekken in deze lijst te groeperen.',
};
export default collection;
+10
View File
@@ -144,6 +144,16 @@ const collection: TranslationStrings = {
'collections.widget.title': 'Kolekcje',
'collections.widget.empty': 'Brak zapisanych miejsc',
'collections.widget.savedCount': '{count} zapisanych',
'collections.labels.title': 'Etykiety',
'collections.labels.manage': 'Zarządzaj etykietami',
'collections.labels.add': 'Dodaj etykietę',
'collections.labels.name': 'Nazwa etykiety',
'collections.labels.namePlaceholder': 'np. Berlin',
'collections.labels.assign': 'Przypisz etykietę',
'collections.labels.assignN': 'Dodaj etykiety do {count} miejsc',
'collections.labels.assignedCount': 'Oznaczono {count} miejsc',
'collections.labels.empty': 'Brak etykiet',
'collections.labels.emptyHint': 'Najpierw utwórz etykietę, aby pogrupować miejsca na tej liście.',
};
export default collection;
+10
View File
@@ -144,6 +144,16 @@ const collection: TranslationStrings = {
'collections.widget.title': 'Коллекции',
'collections.widget.empty': 'Пока нет сохранённых мест',
'collections.widget.savedCount': 'Сохранено: {count}',
'collections.labels.title': 'Метки',
'collections.labels.manage': 'Управление метками',
'collections.labels.add': 'Добавить метку',
'collections.labels.name': 'Название метки',
'collections.labels.namePlaceholder': 'например, Berlin',
'collections.labels.assign': 'Назначить метку',
'collections.labels.assignN': 'Добавить метки к {count} местам',
'collections.labels.assignedCount': 'Отмечено мест: {count}',
'collections.labels.empty': 'Пока нет меток',
'collections.labels.emptyHint': 'Сначала создайте метку, чтобы группировать места в этом списке.',
};
export default collection;
+10
View File
@@ -144,6 +144,16 @@ const collection: TranslationStrings = {
'collections.widget.title': 'Samlingar',
'collections.widget.empty': 'Inga sparade platser ännu',
'collections.widget.savedCount': '{count} sparade',
'collections.labels.title': 'Etiketter',
'collections.labels.manage': 'Hantera etiketter',
'collections.labels.add': 'Lägg till etikett',
'collections.labels.name': 'Etikettnamn',
'collections.labels.namePlaceholder': 't.ex. Berlin',
'collections.labels.assign': 'Tilldela etikett',
'collections.labels.assignN': 'Lägg till etiketter på {count} platser',
'collections.labels.assignedCount': 'Etiketterade {count} platser',
'collections.labels.empty': 'Inga etiketter ännu',
'collections.labels.emptyHint': 'Skapa en etikett först för att gruppera platser i den här listan.',
};
export default collection;
+10
View File
@@ -144,6 +144,16 @@ const collection: TranslationStrings = {
'collections.widget.title': 'Koleksiyonlar',
'collections.widget.empty': 'Henüz kaydedilmiş yer yok',
'collections.widget.savedCount': '{count} kayıtlı',
'collections.labels.title': 'Etiketler',
'collections.labels.manage': 'Etiketleri yönet',
'collections.labels.add': 'Etiket ekle',
'collections.labels.name': 'Etiket adı',
'collections.labels.namePlaceholder': 'örn. Berlin',
'collections.labels.assign': 'Etiket ata',
'collections.labels.assignN': '{count} yere etiket ekle',
'collections.labels.assignedCount': '{count} yer etiketlendi',
'collections.labels.empty': 'Henüz etiket yok',
'collections.labels.emptyHint': 'Bu listedeki yerleri gruplamak için önce bir etiket oluştur.',
};
export default collection;
+10
View File
@@ -144,6 +144,16 @@ const collection: TranslationStrings = {
'collections.widget.title': 'Колекції',
'collections.widget.empty': 'Поки немає збережених місць',
'collections.widget.savedCount': 'Збережено: {count}',
'collections.labels.title': 'Мітки',
'collections.labels.manage': 'Керувати мітками',
'collections.labels.add': 'Додати мітку',
'collections.labels.name': 'Назва мітки',
'collections.labels.namePlaceholder': 'напр., Berlin',
'collections.labels.assign': 'Призначити мітку',
'collections.labels.assignN': 'Додати мітки до {count} місць',
'collections.labels.assignedCount': 'Позначено місць: {count}',
'collections.labels.empty': 'Поки немає міток',
'collections.labels.emptyHint': 'Спершу створіть мітку, щоб групувати місця в цьому списку.',
};
export default collection;
+10
View File
@@ -144,6 +144,16 @@ const collection: TranslationStrings = {
'collections.widget.title': 'Bộ sưu tập',
'collections.widget.empty': 'Chưa có địa điểm đã lưu',
'collections.widget.savedCount': 'Đã lưu {count}',
'collections.labels.title': 'Nhãn',
'collections.labels.manage': 'Quản lý nhãn',
'collections.labels.add': 'Thêm nhãn',
'collections.labels.name': 'Tên nhãn',
'collections.labels.namePlaceholder': 'vd. Berlin',
'collections.labels.assign': 'Gán nhãn',
'collections.labels.assignN': 'Thêm nhãn cho {count} địa điểm',
'collections.labels.assignedCount': 'Đã gán nhãn {count} địa điểm',
'collections.labels.empty': 'Chưa có nhãn nào',
'collections.labels.emptyHint': 'Tạo một nhãn trước để nhóm các địa điểm trong danh sách này.',
};
export default collection;
+11
View File
@@ -144,6 +144,17 @@ const collection: TranslationStrings = {
'collections.widget.title': '收藏',
'collections.widget.empty': '尚無已儲存的地點',
'collections.widget.savedCount': '已儲存 {count} 個',
'collections.labels.title': '標籤',
'collections.labels.manage': '管理標籤',
'collections.labels.add': '新增標籤',
'collections.labels.name': '標籤名稱',
'collections.labels.namePlaceholder': '例如:柏林',
'collections.labels.assign': '指派標籤',
'collections.labels.assignN': '為 {count} 個地點新增標籤',
'collections.labels.assignedCount': '已為 {count} 個地點加上標籤',
'collections.labels.empty': '尚無標籤',
'collections.labels.emptyHint': '請先建立標籤,以將此清單中的地點分組。',
};
export default collection;
+11
View File
@@ -144,6 +144,17 @@ const collection: TranslationStrings = {
'collections.widget.title': '收藏',
'collections.widget.empty': '还没有保存的地点',
'collections.widget.savedCount': '已保存 {count} 个',
'collections.labels.title': '标签',
'collections.labels.manage': '管理标签',
'collections.labels.add': '添加标签',
'collections.labels.name': '标签名称',
'collections.labels.namePlaceholder': '例如:Berlin',
'collections.labels.assign': '分配标签',
'collections.labels.assignN': '为 {count} 个地点添加标签',
'collections.labels.assignedCount': '已为 {count} 个地点添加标签',
'collections.labels.empty': '还没有标签',
'collections.labels.emptyHint': '请先创建一个标签来对此列表中的地点分组。',
};
export default collection;