refactor(ui): new icon library and user migration (#1828)

This commit is contained in:
Alex
2026-06-25 08:57:48 +01:00
committed by GitHub
parent 90fa4d7c42
commit d0d884a06b
66 changed files with 963 additions and 486 deletions
@@ -1,7 +1,6 @@
package org.booklore.model.enums;
public enum IconType {
PRIME_NG,
LUCIDE,
CUSTOM_SVG
}
@@ -4,7 +4,7 @@ import lombok.Getter;
@Getter
public enum ShelfType {
KOBO("Kobo", "pi pi-tablet");
KOBO("Kobo", "tablet");
private final String name;
private final String icon;
@@ -107,7 +107,7 @@ public class KoboSettingsService {
ShelfCreateRequest.builder()
.name(ShelfType.KOBO.getName())
.icon(ShelfType.KOBO.getIcon())
.iconType(IconType.PRIME_NG)
.iconType(IconType.LUCIDE)
.build()
);
}
@@ -25,7 +25,7 @@ public class UserDefaultsService {
.user(user)
.name("Favorites")
.icon("heart")
.iconType(IconType.PRIME_NG)
.iconType(IconType.LUCIDE)
.build();
shelfRepository.save(shelf);
}
@@ -52,4 +52,4 @@ public class UserDefaultsService {
log.error("Error serializing setting {} for user {}", key, user.getUsername(), e);
}
}
}
}
@@ -0,0 +1,344 @@
-- Migrates Prime icons to Lucide. Brand-logo icons without a close Lucide replacement use the default book icon.
CREATE TEMPORARY TABLE prime_to_lucide_icon_map (
prime_icon VARCHAR(64) NOT NULL PRIMARY KEY,
lucide_icon VARCHAR(64) NOT NULL
);
INSERT INTO prime_to_lucide_icon_map (prime_icon, lucide_icon) VALUES
('address-book', 'contact'),
('align-center', 'text-align-center'),
('align-justify', 'text-align-justify'),
('align-left', 'text-align-start'),
('align-right', 'text-align-end'),
('amazon', 'book'),
('android', 'book'),
('angle-double-down', 'chevrons-down'),
('angle-double-left', 'chevrons-left'),
('angle-double-right', 'chevrons-right'),
('angle-double-up', 'chevrons-up'),
('angle-down', 'chevron-down'),
('angle-left', 'chevron-left'),
('angle-right', 'chevron-right'),
('angle-up', 'chevron-up'),
('apple', 'book'),
('arrow-circle-down', 'circle-arrow-down'),
('arrow-circle-left', 'circle-arrow-left'),
('arrow-circle-right', 'circle-arrow-right'),
('arrow-circle-up', 'circle-arrow-up'),
('arrow-down', 'arrow-down'),
('arrow-down-left', 'arrow-down-left'),
('arrow-down-left-and-arrow-up-right-to-center', 'shrink'),
('arrow-down-right', 'arrow-down-right'),
('arrow-left', 'arrow-left'),
('arrow-right', 'arrow-right'),
('arrow-right-arrow-left', 'arrow-right-left'),
('arrow-up', 'arrow-up'),
('arrow-up-left', 'arrow-up-left'),
('arrow-up-right', 'arrow-up-right'),
('arrow-up-right-and-arrow-down-left-from-center', 'expand'),
('arrows-alt', 'move'),
('arrows-h', 'move-horizontal'),
('arrows-v', 'move-vertical'),
('asterisk', 'asterisk'),
('at', 'at-sign'),
('backward', 'rewind'),
('ban', 'ban'),
('barcode', 'barcode'),
('bars', 'menu'),
('bell', 'bell'),
('bell-slash', 'bell-off'),
('bitcoin', 'bitcoin'),
('bolt', 'zap'),
('book', 'book'),
('bookmark', 'bookmark'),
('bookmark-fill', 'bookmark'),
('box', 'box'),
('briefcase', 'briefcase'),
('building', 'building'),
('building-columns', 'building-2'),
('bullseye', 'target'),
('calculator', 'calculator'),
('calendar', 'calendar'),
('calendar-clock', 'calendar-clock'),
('calendar-minus', 'calendar-minus'),
('calendar-plus', 'calendar-plus'),
('calendar-times', 'calendar-x'),
('camera', 'camera'),
('car', 'car'),
('caret-down', 'chevron-down'),
('caret-left', 'chevron-left'),
('caret-right', 'chevron-right'),
('caret-up', 'chevron-up'),
('cart-arrow-down', 'shopping-cart'),
('cart-minus', 'shopping-cart'),
('cart-plus', 'shopping-cart'),
('chart-bar', 'chart-column'),
('chart-line', 'chart-line'),
('chart-pie', 'chart-pie'),
('chart-scatter', 'chart-scatter'),
('check', 'check'),
('check-circle', 'circle-check'),
('check-square', 'square-check'),
('chevron-circle-down', 'circle-chevron-down'),
('chevron-circle-left', 'circle-chevron-left'),
('chevron-circle-right', 'circle-chevron-right'),
('chevron-circle-up', 'circle-chevron-up'),
('chevron-down', 'chevron-down'),
('chevron-left', 'chevron-left'),
('chevron-right', 'chevron-right'),
('chevron-up', 'chevron-up'),
('circle', 'circle'),
('circle-fill', 'circle'),
('circle-off', 'circle-slash'),
('circle-on', 'circle'),
('clipboard', 'clipboard'),
('clock', 'clock'),
('clone', 'copy'),
('cloud', 'cloud'),
('cloud-download', 'cloud-download'),
('cloud-upload', 'cloud-upload'),
('code', 'code'),
('cog', 'settings'),
('comment', 'message-circle'),
('comments', 'messages-square'),
('compass', 'compass'),
('copy', 'copy'),
('credit-card', 'credit-card'),
('crown', 'crown'),
('database', 'database'),
('delete-left', 'delete'),
('desktop', 'monitor'),
('directions', 'navigation'),
('directions-alt', 'navigation-2'),
('discord', 'book'),
('dollar', 'dollar-sign'),
('download', 'download'),
('eject', 'unplug'),
('ellipsis-h', 'ellipsis'),
('ellipsis-v', 'ellipsis-vertical'),
('envelope', 'mail'),
('equals', 'equal'),
('eraser', 'eraser'),
('ethereum', 'book'),
('euro', 'euro'),
('exclamation-circle', 'circle-alert'),
('exclamation-triangle', 'triangle-alert'),
('expand', 'expand'),
('external-link', 'external-link'),
('eye', 'eye'),
('eye-slash', 'eye-off'),
('facebook', 'book'),
('face-smile', 'smile'),
('fast-backward', 'skip-back'),
('fast-forward', 'skip-forward'),
('file', 'file'),
('file-arrow-up', 'file-up'),
('file-check', 'file-check'),
('file-edit', 'file-pen'),
('file-excel', 'file-spreadsheet'),
('file-export', 'file-output'),
('file-import', 'file-input'),
('file-o', 'file'),
('file-pdf', 'file-text'),
('file-plus', 'file-plus'),
('file-word', 'file-text'),
('filter', 'funnel'),
('filter-fill', 'funnel'),
('filter-slash', 'funnel-x'),
('flag', 'flag'),
('flag-fill', 'flag'),
('folder', 'folder'),
('folder-open', 'folder-open'),
('folder-plus', 'folder-plus'),
('forward', 'fast-forward'),
('gauge', 'gauge'),
('gift', 'gift'),
('github', 'book'),
('globe', 'globe'),
('google', 'book'),
('graduation-cap', 'graduation-cap'),
('hammer', 'hammer'),
('hashtag', 'hash'),
('headphones', 'headphones'),
('heart', 'heart'),
('heart-fill', 'heart'),
('history', 'history'),
('home', 'house'),
('hourglass', 'hourglass'),
('id-card', 'id-card'),
('image', 'image'),
('images', 'images'),
('instagram', 'book'),
('inbox', 'inbox'),
('indian-rupee', 'indian-rupee'),
('info', 'info'),
('info-circle', 'info'),
('key', 'key'),
('language', 'languages'),
('lightbulb', 'lightbulb'),
('link', 'link'),
('linkedin', 'book'),
('list', 'list'),
('list-check', 'list-checks'),
('lock', 'lock'),
('lock-open', 'lock-open'),
('map', 'map'),
('map-marker', 'map-pin'),
('mars', 'mars'),
('megaphone', 'megaphone'),
('microchip', 'cpu'),
('microchip-ai', 'brain-circuit'),
('microphone', 'mic'),
('microsoft', 'book'),
('minus', 'minus'),
('minus-circle', 'circle-minus'),
('mobile', 'smartphone'),
('money-bill', 'banknote'),
('moon', 'moon'),
('objects-column', 'columns-3'),
('palette', 'palette'),
('paperclip', 'paperclip'),
('paypal', 'book'),
('pause', 'pause'),
('pause-circle', 'circle-pause'),
('pen-to-square', 'square-pen'),
('pencil', 'pencil'),
('percentage', 'percent'),
('phone', 'phone'),
('pinterest', 'book'),
('play', 'play'),
('play-circle', 'circle-play'),
('plus', 'plus'),
('plus-circle', 'circle-plus'),
('pound', 'pound-sterling'),
('power-off', 'power'),
('prime', 'sparkles'),
('print', 'printer'),
('qrcode', 'qr-code'),
('question', 'circle-question-mark'),
('question-circle', 'circle-question-mark'),
('receipt', 'receipt'),
('reddit', 'book'),
('refresh', 'rotate-cw'),
('replay', 'rotate-ccw'),
('reply', 'reply'),
('save', 'save'),
('search', 'search'),
('search-minus', 'zoom-out'),
('search-plus', 'zoom-in'),
('send', 'send'),
('server', 'server'),
('share-alt', 'share-2'),
('shield', 'shield'),
('shop', 'store'),
('shopping-bag', 'shopping-bag'),
('shopping-cart', 'shopping-cart'),
('sign-in', 'log-in'),
('sign-out', 'log-out'),
('sitemap', 'network'),
('slack', 'book'),
('sliders-h', 'sliders-horizontal'),
('sliders-v', 'sliders-vertical'),
('sort', 'arrow-up-down'),
('sort-alpha-down', 'arrow-down-a-z'),
('sort-alpha-down-alt', 'arrow-down-z-a'),
('sort-alpha-up', 'arrow-up-a-z'),
('sort-alpha-up-alt', 'arrow-up-z-a'),
('sort-alt', 'arrow-up-down'),
('sort-alt-slash', 'arrow-up-down'),
('sort-amount-down', 'arrow-down-wide-narrow'),
('sort-amount-down-alt', 'arrow-down-narrow-wide'),
('sort-amount-up', 'arrow-up-narrow-wide'),
('sort-amount-up-alt', 'arrow-up-wide-narrow'),
('sort-down', 'chevron-down'),
('sort-down-fill', 'chevron-down'),
('sort-numeric-down', 'arrow-down-0-1'),
('sort-numeric-down-alt', 'arrow-down-1-0'),
('sort-numeric-up', 'arrow-up-0-1'),
('sort-numeric-up-alt', 'arrow-up-1-0'),
('sort-up', 'chevron-up'),
('sort-up-fill', 'chevron-up'),
('sparkles', 'sparkles'),
('spinner', 'loader-circle'),
('spinner-dotted', 'loader'),
('star', 'star'),
('star-fill', 'star'),
('star-half', 'star-half'),
('star-half-fill', 'star-half'),
('step-backward', 'skip-back'),
('step-backward-alt', 'skip-back'),
('step-forward', 'skip-forward'),
('step-forward-alt', 'skip-forward'),
('stop', 'square'),
('stop-circle', 'circle-stop'),
('stopwatch', 'timer'),
('sun', 'sun'),
('sync', 'refresh-cw'),
('table', 'table'),
('tablet', 'tablet'),
('tag', 'tag'),
('tags', 'tags'),
('telegram', 'book'),
('th-large', 'layout-grid'),
('thumbs-down', 'thumbs-down'),
('thumbs-down-fill', 'thumbs-down'),
('thumbs-up', 'thumbs-up'),
('thumbs-up-fill', 'thumbs-up'),
('thumbtack', 'pin'),
('ticket', 'ticket'),
('tiktok', 'book'),
('times', 'x'),
('times-circle', 'circle-x'),
('trash', 'trash-2'),
('trophy', 'trophy'),
('truck', 'truck'),
('turkish-lira', 'turkish-lira'),
('twitch', 'book'),
('twitter', 'book'),
('undo', 'undo'),
('unlock', 'lock-open'),
('upload', 'upload'),
('user', 'user'),
('user-edit', 'user-pen'),
('user-minus', 'user-minus'),
('user-plus', 'user-plus'),
('users', 'users'),
('venus', 'venus'),
('verified', 'badge-check'),
('video', 'video'),
('vimeo', 'book'),
('volume-down', 'volume-1'),
('volume-off', 'volume-x'),
('volume-up', 'volume-2'),
('wallet', 'wallet'),
('warehouse', 'warehouse'),
('wave-pulse', 'activity'),
('whatsapp', 'book'),
('wifi', 'wifi'),
('window-maximize', 'maximize'),
('window-minimize', 'minimize'),
('wrench', 'wrench'),
('youtube', 'book');
UPDATE library
LEFT JOIN prime_to_lucide_icon_map
ON REPLACE(REPLACE(library.icon, 'pi pi-', ''), 'pi-', '') = prime_to_lucide_icon_map.prime_icon
SET library.icon = COALESCE(prime_to_lucide_icon_map.lucide_icon, IF(library.icon IS NULL, NULL, 'book')),
library.icon_type = IF(library.icon IS NULL, NULL, 'LUCIDE')
WHERE library.icon_type = 'PRIME_NG';
UPDATE shelf
LEFT JOIN prime_to_lucide_icon_map
ON REPLACE(REPLACE(shelf.icon, 'pi pi-', ''), 'pi-', '') = prime_to_lucide_icon_map.prime_icon
SET shelf.icon = COALESCE(prime_to_lucide_icon_map.lucide_icon, IF(shelf.icon IS NULL, NULL, 'book')),
shelf.icon_type = IF(shelf.icon IS NULL, NULL, 'LUCIDE')
WHERE shelf.icon_type = 'PRIME_NG';
UPDATE magic_shelf
LEFT JOIN prime_to_lucide_icon_map
ON REPLACE(REPLACE(magic_shelf.icon, 'pi pi-', ''), 'pi-', '') = prime_to_lucide_icon_map.prime_icon
SET magic_shelf.icon = COALESCE(prime_to_lucide_icon_map.lucide_icon, IF(magic_shelf.icon IS NULL, NULL, 'book')),
magic_shelf.icon_type = IF(magic_shelf.icon IS NULL, NULL, 'LUCIDE')
WHERE magic_shelf.icon_type = 'PRIME_NG';
DROP TEMPORARY TABLE prime_to_lucide_icon_map;