From aed94bfc4caead825b8613cad3875190dd165f1f Mon Sep 17 00:00:00 2001 From: Jaime Baez Date: Thu, 8 Sep 2022 12:53:09 +0200 Subject: [PATCH 1/6] Format web code with prettier Added `.md` and `.json` to .prettierignore --- web/.prettierignore | 3 + web/src/app.css | 96 ++++----- .../asset-viewer/asset-viewer.svelte | 2 +- .../components/forms/create-user-form.svelte | 197 +++++++++--------- web/src/lib/constants.ts | 2 +- 5 files changed, 151 insertions(+), 149 deletions(-) diff --git a/web/.prettierignore b/web/.prettierignore index 38972655fa..a2f960d9ec 100644 --- a/web/.prettierignore +++ b/web/.prettierignore @@ -6,6 +6,9 @@ node_modules .env .env.* !.env.example +src/api/open-api +*.md +*.json # Ignore files for PNPM, NPM and YARN pnpm-lock.yaml diff --git a/web/src/app.css b/web/src/app.css index 05b6772e32..06e9acfd3e 100644 --- a/web/src/app.css +++ b/web/src/app.css @@ -6,86 +6,86 @@ @tailwind utilities; :root { - font-family: 'Work Sans', sans-serif; - /* --immich-icon-button-hover-color: #d3d3d3; */ + font-family: 'Work Sans', sans-serif; + /* --immich-icon-button-hover-color: #d3d3d3; */ } html { - height: 100%; - width: 100%; + height: 100%; + width: 100%; } html::-webkit-scrollbar { - width: 8px; + width: 8px; } /* Track */ html::-webkit-scrollbar-track { - background: #f1f1f1; - border-radius: 16px; + background: #f1f1f1; + border-radius: 16px; } /* Handle */ html::-webkit-scrollbar-thumb { - background: rgba(85, 86, 87, 0.408); - border-radius: 16px; + background: rgba(85, 86, 87, 0.408); + border-radius: 16px; } /* Handle on hover */ html::-webkit-scrollbar-thumb:hover { - background: #4250afad; - border-radius: 16px; + background: #4250afad; + border-radius: 16px; } body { - /* min-height: 100vh; */ - margin: 0; - background-color: #f6f8fe; - color: #5f6368; + /* min-height: 100vh; */ + margin: 0; + background-color: #f6f8fe; + color: #5f6368; } input:focus-visible { - outline-offset: 0px !important; - outline: none !important; + outline-offset: 0px !important; + outline: none !important; } @layer utilities { - .immich-form-input { - @apply bg-slate-100 p-2 rounded-md focus:border-immich-primary text-sm ; - } + .immich-form-input { + @apply bg-slate-100 p-2 rounded-md focus:border-immich-primary text-sm; + } - .immich-form-label { - @apply font-medium text-sm text-gray-500; - } + .immich-form-label { + @apply font-medium text-sm text-gray-500; + } - .immich-btn-primary { - @apply bg-immich-primary text-gray-100 border rounded-xl py-2 px-4 transition-all duration-150 hover:bg-immich-primary hover:shadow-lg text-sm font-medium; - } + .immich-btn-primary { + @apply bg-immich-primary text-gray-100 border rounded-xl py-2 px-4 transition-all duration-150 hover:bg-immich-primary hover:shadow-lg text-sm font-medium; + } - .immich-text-button { - @apply flex place-items-center place-content-center gap-2 hover:bg-immich-primary/5 p-2 rounded-lg font-medium; - } + .immich-text-button { + @apply flex place-items-center place-content-center gap-2 hover:bg-immich-primary/5 p-2 rounded-lg font-medium; + } - /* width */ - .immich-scrollbar::-webkit-scrollbar { - width: 8px; - } + /* width */ + .immich-scrollbar::-webkit-scrollbar { + width: 8px; + } - /* Track */ - .immich-scrollbar::-webkit-scrollbar-track { - background: #f1f1f1; - border-radius: 16px; - } + /* Track */ + .immich-scrollbar::-webkit-scrollbar-track { + background: #f1f1f1; + border-radius: 16px; + } - /* Handle */ - .immich-scrollbar::-webkit-scrollbar-thumb { - background: rgba(85, 86, 87, 0.408); - border-radius: 16px; - } + /* Handle */ + .immich-scrollbar::-webkit-scrollbar-thumb { + background: rgba(85, 86, 87, 0.408); + border-radius: 16px; + } - /* Handle on hover */ - .immich-scrollbar::-webkit-scrollbar-thumb:hover { - background: #4250afad; - border-radius: 16px; - } + /* Handle on hover */ + .immich-scrollbar::-webkit-scrollbar-thumb:hover { + background: #4250afad; + border-radius: 16px; + } } diff --git a/web/src/lib/components/asset-viewer/asset-viewer.svelte b/web/src/lib/components/asset-viewer/asset-viewer.svelte index 7d8eeb29f5..18d7876d1b 100644 --- a/web/src/lib/components/asset-viewer/asset-viewer.svelte +++ b/web/src/lib/components/asset-viewer/asset-viewer.svelte @@ -18,7 +18,7 @@ $: { appearsInAlbums = []; - api.albumApi.getAllAlbums(undefined, asset.id).then(result => { + api.albumApi.getAllAlbums(undefined, asset.id).then((result) => { appearsInAlbums = result.data; }); } diff --git a/web/src/lib/components/forms/create-user-form.svelte b/web/src/lib/components/forms/create-user-form.svelte index b1135028c4..68ea9dd61a 100644 --- a/web/src/lib/components/forms/create-user-form.svelte +++ b/web/src/lib/components/forms/create-user-form.svelte @@ -1,122 +1,121 @@
-
- immich-logo -

Create new user

-

- Please provide your user with the password, they will have to change it on their first sign - in. -

-
+
+ immich-logo +

Create new user

+

+ Please provide your user with the password, they will have to change it on their first sign + in. +

+
-
-
- - -
+ +
+ + +
-
- - -
+
+ + +
-
- - -
+
+ + +
-
- - -
+
+ + +
-
- - -
+
+ + +
- {#if error} -

{error}

- {/if} + {#if error} +

{error}

+ {/if} - {#if success} -

{success}

- {/if} -
- -
-
+ {#if success} +

{success}

+ {/if} +
+ +
+
diff --git a/web/src/lib/constants.ts b/web/src/lib/constants.ts index 1cd049a622..609fe8d2ce 100644 --- a/web/src/lib/constants.ts +++ b/web/src/lib/constants.ts @@ -1,2 +1,2 @@ import { env } from '$env/dynamic/public'; -export const loginPageMessage: string = env.PUBLIC_LOGIN_PAGE_MESSAGE; \ No newline at end of file +export const loginPageMessage: string = env.PUBLIC_LOGIN_PAGE_MESSAGE; From 6725954b70ad43e134fd41ae3973f6a0e7fef5a5 Mon Sep 17 00:00:00 2001 From: Jaime Baez Date: Thu, 8 Sep 2022 17:17:15 +0200 Subject: [PATCH 2/6] Add web check / lint npm commands `svelte-check` returns some "hints" that can be ignored since some are not true and others are not relevant. --- web/package.json | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/web/package.json b/web/package.json index 63631834b8..ead4ef8056 100644 --- a/web/package.json +++ b/web/package.json @@ -6,10 +6,14 @@ "build": "vite build", "package": "svelte-kit package", "preview": "vite preview", - "check": "svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch", - "lint": "prettier --check --plugin-search-dir=. . && eslint .", - "format": "prettier --write --plugin-search-dir=. .", + "check": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings", + "check:watch": "npm run check -- --watch", + "check:code": "npm run format && npm run lint && npm run check", + "check:all": "npm run check:code && npm test", + "lint": "eslint . --max-warnings 0", + "lint:fix": "npm run lint -- --fix", + "format": "prettier --check --plugin-search-dir=. .", + "format:fix": "prettier --write --plugin-search-dir=. .", "test": "jest", "test:watch": "npm test -- --watch" }, From 4f7a3afbfc2254bcd3021ac4989e4fbe1f9de0e7 Mon Sep 17 00:00:00 2001 From: Jaime Baez Date: Thu, 8 Sep 2022 17:30:49 +0200 Subject: [PATCH 3/6] Fix web lint issues --- web/.eslintrc.cjs | 3 ++ web/src/api/utils.ts | 3 +- .../components/album-page/album-card.svelte | 5 +-- .../components/album-page/album-viewer.svelte | 4 +- .../asset-viewer/asser-viewer-nav-bar.svelte | 2 - .../asset-viewer/asset-viewer.svelte | 6 ++- .../asset-viewer/detail-panel.svelte | 11 +++-- .../asset-viewer/intersection-observer.svelte | 2 +- .../asset-viewer/photo-viewer.svelte | 4 +- .../asset-viewer/video-viewer.svelte | 4 +- .../forms/admin-registration-form.svelte | 4 +- .../forms/change-password-form.svelte | 4 +- .../components/forms/edit-user-form.svelte | 5 +-- .../lib/components/forms/login-form.svelte | 4 +- .../photos-page/asset-date-group.svelte | 3 +- .../shared-components/announcement-box.svelte | 3 -- .../shared-components/base-modal.svelte | 2 +- .../shared-components/circle-avatar.svelte | 2 +- .../circle-icon-button.svelte | 8 ++-- .../context-menu/context-menu.svelte | 6 +-- .../shared-components/control-app-bar.svelte | 18 ++++---- .../shared-components/immich-thumbnail.svelte | 10 ++--- .../shared-components/navigation-bar.svelte | 2 +- .../shared-components/portal/portal.svelte | 7 +-- .../scrollbar/scrollbar.svelte | 44 +++++++++---------- .../side-bar/side-bar-button.svelte | 2 + .../side-bar/side-bar.svelte | 4 +- .../shared-components/upload-panel.svelte | 8 ++-- .../shared-album-list-tile.svelte | 3 +- web/src/lib/models/asset-grid-state.ts | 6 +-- web/src/lib/stores/assets.store.ts | 10 ++--- web/src/lib/stores/websocket.ts | 3 +- web/src/lib/utils/click-outside.ts | 5 ++- web/src/lib/utils/file-uploader.ts | 25 +++++++---- web/src/routes/+layout.server.ts | 2 +- web/src/routes/+layout.svelte | 1 - web/src/routes/admin/+page.server.ts | 2 +- web/src/routes/albums/+page.server.ts | 2 +- web/src/routes/photos/+page.svelte | 2 - web/svelte.config.js | 2 +- 40 files changed, 122 insertions(+), 121 deletions(-) diff --git a/web/.eslintrc.cjs b/web/.eslintrc.cjs index 3ccf435f02..91d1ce3f77 100644 --- a/web/.eslintrc.cjs +++ b/web/.eslintrc.cjs @@ -16,5 +16,8 @@ module.exports = { browser: true, es2017: true, node: true + }, + globals: { + NodeJS: true } }; diff --git a/web/src/api/utils.ts b/web/src/api/utils.ts index 5d7cfc4e70..73f4d7213b 100644 --- a/web/src/api/utils.ts +++ b/web/src/api/utils.ts @@ -1,5 +1,4 @@ -import { AssetCountByTimeGroupResponseDto } from '@api'; -let _basePath = '/api'; +const _basePath = '/api'; export function getFileUrl(aid: string, did: string, isThumb?: boolean, isWeb?: boolean) { const urlObj = new URL(`${window.location.origin}${_basePath}/asset/file`); diff --git a/web/src/lib/components/album-page/album-card.svelte b/web/src/lib/components/album-page/album-card.svelte index 62c7624591..36fd52a268 100644 --- a/web/src/lib/components/album-page/album-card.svelte +++ b/web/src/lib/components/album-page/album-card.svelte @@ -15,12 +15,11 @@ import { AlbumResponseDto, api, ThumbnailFormat } from '@api'; import { createEventDispatcher, onMount } from 'svelte'; import DotsVertical from 'svelte-material-icons/DotsVertical.svelte'; - import { fly } from 'svelte/transition'; import CircleIconButton from '../shared-components/circle-icon-button.svelte'; export let album: AlbumResponseDto; - let imageData: string = `/api/asset/thumbnail/${album.albumThumbnailAssetId}?format=${ThumbnailFormat.Webp}`; + let imageData = `/api/asset/thumbnail/${album.albumThumbnailAssetId}?format=${ThumbnailFormat.Webp}`; const dispatchClick = createEventDispatcher(); const dispatchShowContextMenu = createEventDispatcher(); @@ -29,7 +28,7 @@ return; } - const { data } = await api.assetApi.getAssetThumbnail(thubmnailId!, ThumbnailFormat.Jpeg, { + const { data } = await api.assetApi.getAssetThumbnail(thubmnailId, ThumbnailFormat.Jpeg, { responseType: 'blob' }); diff --git a/web/src/lib/components/album-page/album-viewer.svelte b/web/src/lib/components/album-page/album-viewer.svelte index 75f69436b7..caef56f017 100644 --- a/web/src/lib/components/album-page/album-viewer.svelte +++ b/web/src/lib/components/album-page/album-viewer.svelte @@ -11,7 +11,6 @@ import CircleAvatar from '../shared-components/circle-avatar.svelte'; import ImmichThumbnail from '../shared-components/immich-thumbnail.svelte'; import AssetSelection from './asset-selection.svelte'; - import _ from 'lodash-es'; import UserSelectionModal from './user-selection-modal.svelte'; import ShareInfoModal from './share-info-modal.svelte'; import CircleIconButton from '../shared-components/circle-icon-button.svelte'; @@ -53,8 +52,7 @@ let currentViewAssetIndex = 0; let viewWidth: number; - let thumbnailSize: number = 300; - let border = ''; + let thumbnailSize = 300; let backUrl = '/albums'; let currentAlbumName = ''; let currentUser: UserResponseDto; diff --git a/web/src/lib/components/asset-viewer/asser-viewer-nav-bar.svelte b/web/src/lib/components/asset-viewer/asser-viewer-nav-bar.svelte index 4ba542d4ef..09730a0587 100644 --- a/web/src/lib/components/asset-viewer/asser-viewer-nav-bar.svelte +++ b/web/src/lib/components/asset-viewer/asser-viewer-nav-bar.svelte @@ -2,9 +2,7 @@ import { createEventDispatcher } from 'svelte'; import ArrowLeft from 'svelte-material-icons/ArrowLeft.svelte'; - import DotsVertical from 'svelte-material-icons/DotsVertical.svelte'; import CloudDownloadOutline from 'svelte-material-icons/CloudDownloadOutline.svelte'; - import TrashCanOutline from 'svelte-material-icons/TrashCanOutline.svelte'; import InformationOutline from 'svelte-material-icons/InformationOutline.svelte'; import CircleIconButton from '../shared-components/circle-icon-button.svelte'; const dispatch = createEventDispatcher(); diff --git a/web/src/lib/components/asset-viewer/asset-viewer.svelte b/web/src/lib/components/asset-viewer/asset-viewer.svelte index 18d7876d1b..5d7264cc37 100644 --- a/web/src/lib/components/asset-viewer/asset-viewer.svelte +++ b/web/src/lib/components/asset-viewer/asset-viewer.svelte @@ -29,12 +29,14 @@ let isShowDetail = false; let appearsInAlbums: AlbumResponseDto[] = []; + const onKeyboardPress = (keyInfo: KeyboardEvent) => handleKeyboardPress(keyInfo.key); + onMount(() => { - document.addEventListener('keydown', (keyInfo) => handleKeyboardPress(keyInfo.key)); + document.addEventListener('keydown', onKeyboardPress); }); onDestroy(() => { - document.removeEventListener('keydown', (e) => {}); + document.removeEventListener('keydown', onKeyboardPress); }); const handleKeyboardPress = (key: string) => { diff --git a/web/src/lib/components/asset-viewer/detail-panel.svelte b/web/src/lib/components/asset-viewer/detail-panel.svelte index 26c98dbb10..47debc6b32 100644 --- a/web/src/lib/components/asset-viewer/detail-panel.svelte +++ b/web/src/lib/components/asset-viewer/detail-panel.svelte @@ -9,10 +9,14 @@ import { browser } from '$app/env'; import { AssetResponseDto, AlbumResponseDto } from '@api'; + type Leaflet = typeof import('leaflet'); + type LeafletMap = import('leaflet').Map; + type LeafletMarker = import('leaflet').Marker; + // Map Property - let map: any; - let leaflet: any; - let marker: any; + let map: LeafletMap; + let leaflet: Leaflet; + let marker: LeafletMarker; export let asset: AssetResponseDto; $: if (asset.exifInfo?.latitude != null && asset.exifInfo?.longitude != null) { @@ -31,7 +35,6 @@ async function drawMap(lat: number, lon: number) { if (!leaflet) { - // @ts-ignore leaflet = await import('leaflet'); } diff --git a/web/src/lib/components/asset-viewer/intersection-observer.svelte b/web/src/lib/components/asset-viewer/intersection-observer.svelte index c0cf19964b..f08a244db1 100644 --- a/web/src/lib/components/asset-viewer/intersection-observer.svelte +++ b/web/src/lib/components/asset-viewer/intersection-observer.svelte @@ -10,7 +10,7 @@ export let root: HTMLElement | null = null; let intersecting = false; - let container: any; + let container: HTMLDivElement; const dispatch = createEventDispatcher(); onMount(() => { diff --git a/web/src/lib/components/asset-viewer/photo-viewer.svelte b/web/src/lib/components/asset-viewer/photo-viewer.svelte index 9297b8e8c7..42535cb14b 100644 --- a/web/src/lib/components/asset-viewer/photo-viewer.svelte +++ b/web/src/lib/components/asset-viewer/photo-viewer.svelte @@ -33,7 +33,9 @@ const assetData = URL.createObjectURL(data); return assetData; - } catch (e) {} + } catch { + // Do nothing + } }; diff --git a/web/src/lib/components/asset-viewer/video-viewer.svelte b/web/src/lib/components/asset-viewer/video-viewer.svelte index 4e38a17c62..4243040718 100644 --- a/web/src/lib/components/asset-viewer/video-viewer.svelte +++ b/web/src/lib/components/asset-viewer/video-viewer.svelte @@ -1,7 +1,7 @@ diff --git a/web/src/lib/components/shared-components/circle-avatar.svelte b/web/src/lib/components/shared-components/circle-avatar.svelte index a5980921c6..ee26386475 100644 --- a/web/src/lib/components/shared-components/circle-avatar.svelte +++ b/web/src/lib/components/shared-components/circle-avatar.svelte @@ -5,7 +5,7 @@ export let user: UserResponseDto; // Avatar Size In Pixel - export let size: number = 48; + export let size = 48; const dispatch = createEventDispatcher(); diff --git a/web/src/lib/components/shared-components/circle-icon-button.svelte b/web/src/lib/components/shared-components/circle-icon-button.svelte index a92f9acdd7..615a4a011e 100644 --- a/web/src/lib/components/shared-components/circle-icon-button.svelte +++ b/web/src/lib/components/shared-components/circle-icon-button.svelte @@ -4,10 +4,12 @@ */ import { createEventDispatcher } from 'svelte'; + // TODO: why any here? + // eslint-disable-next-line @typescript-eslint/no-explicit-any export let logo: any; - export let backgroundColor: string = 'transparent'; - export let hoverColor: string = '#e2e7e9'; - export let logoColor: string = '#5f6368'; + export let backgroundColor = 'transparent'; + export let hoverColor = '#e2e7e9'; + export let logoColor = '#5f6368'; export let size = '24'; export let title = ''; let iconButton: HTMLButtonElement; diff --git a/web/src/lib/components/shared-components/context-menu/context-menu.svelte b/web/src/lib/components/shared-components/context-menu/context-menu.svelte index 03fcd91fb3..6233f78e50 100644 --- a/web/src/lib/components/shared-components/context-menu/context-menu.svelte +++ b/web/src/lib/components/shared-components/context-menu/context-menu.svelte @@ -6,15 +6,13 @@ /** * x coordiante of the context menu. - * @type {number} */ - export let x: number = 0; + export let x = 0; /** * x coordiante of the context menu. - * @type {number} */ - export let y: number = 0; + export let y = 0; const dispatch = createEventDispatcher(); diff --git a/web/src/lib/components/shared-components/control-app-bar.svelte b/web/src/lib/components/shared-components/control-app-bar.svelte index 13e4083923..449a115c04 100644 --- a/web/src/lib/components/shared-components/control-app-bar.svelte +++ b/web/src/lib/components/shared-components/control-app-bar.svelte @@ -12,21 +12,23 @@ const dispatch = createEventDispatcher(); + const onScroll = () => { + if (window.pageYOffset > 80) { + appBarBorder = 'border border-gray-200 bg-gray-50'; + } else { + appBarBorder = 'bg-immich-bg border border-transparent'; + } + }; + onMount(() => { if (browser) { - document.addEventListener('scroll', (e) => { - if (window.pageYOffset > 80) { - appBarBorder = 'border border-gray-200 bg-gray-50'; - } else { - appBarBorder = 'bg-immich-bg border border-transparent'; - } - }); + document.addEventListener('scroll', onScroll); } }); onDestroy(() => { if (browser) { - document.removeEventListener('scroll', (e) => {}); + document.removeEventListener('scroll', onScroll); } }); diff --git a/web/src/lib/components/shared-components/immich-thumbnail.svelte b/web/src/lib/components/shared-components/immich-thumbnail.svelte index 3d280fc4d5..1140caa37a 100644 --- a/web/src/lib/components/shared-components/immich-thumbnail.svelte +++ b/web/src/lib/components/shared-components/immich-thumbnail.svelte @@ -6,7 +6,7 @@ import PlayCircleOutline from 'svelte-material-icons/PlayCircleOutline.svelte'; import PauseCircleOutline from 'svelte-material-icons/PauseCircleOutline.svelte'; import LoadingSpinner from './loading-spinner.svelte'; - import { api, AssetResponseDto, AssetTypeEnum, getFileUrl, ThumbnailFormat } from '@api'; + import { AssetResponseDto, AssetTypeEnum, getFileUrl, ThumbnailFormat } from '@api'; const dispatch = createEventDispatcher(); @@ -14,14 +14,14 @@ export let groupIndex = 0; export let thumbnailSize: number | undefined = undefined; export let format: ThumbnailFormat = ThumbnailFormat.Webp; - export let selected: boolean = false; - export let disabled: boolean = false; + export let selected = false; + export let disabled = false; let imageData: string; - let mouseOver: boolean = false; + let mouseOver = false; $: dispatch('mouse-event', { isMouseOver: mouseOver, selectedGroupIndex: groupIndex }); - let mouseOverIcon: boolean = false; + let mouseOverIcon = false; let videoPlayerNode: HTMLVideoElement; let isThumbnailVideoPlaying = false; let calculateVideoDurationIntervalHandler: NodeJS.Timer; diff --git a/web/src/lib/components/shared-components/navigation-bar.svelte b/web/src/lib/components/shared-components/navigation-bar.svelte index 3e7c109814..70cabe5ff1 100644 --- a/web/src/lib/components/shared-components/navigation-bar.svelte +++ b/web/src/lib/components/shared-components/navigation-bar.svelte @@ -2,7 +2,7 @@ import { goto } from '$app/navigation'; import { page } from '$app/stores'; import { createEventDispatcher, onMount } from 'svelte'; - import { fade, fly, slide } from 'svelte/transition'; + import { fade, fly } from 'svelte/transition'; import TrayArrowUp from 'svelte-material-icons/TrayArrowUp.svelte'; import { clickOutside } from '../../utils/click-outside'; import { api, UserResponseDto } from '@api'; diff --git a/web/src/lib/components/shared-components/portal/portal.svelte b/web/src/lib/components/shared-components/portal/portal.svelte index b3d3ece6f7..c18b318d9e 100644 --- a/web/src/lib/components/shared-components/portal/portal.svelte +++ b/web/src/lib/components/shared-components/portal/portal.svelte @@ -3,13 +3,10 @@ /** * Usage:
or
- * - * @param {HTMLElement} el - * @param {HTMLElement|string} target DOM Element or CSS Selector */ - export function portal(el: any, target: any = 'body') { + export function portal(el: HTMLElement, target: HTMLElement | string = 'body') { let targetEl; - async function update(newTarget: any) { + async function update(newTarget: HTMLElement | string) { target = newTarget; if (typeof target === 'string') { targetEl = document.querySelector(target); diff --git a/web/src/lib/components/shared-components/scrollbar/scrollbar.svelte b/web/src/lib/components/shared-components/scrollbar/scrollbar.svelte index 9a2172faf4..19f974bd18 100644 --- a/web/src/lib/components/shared-components/scrollbar/scrollbar.svelte +++ b/web/src/lib/components/shared-components/scrollbar/scrollbar.svelte @@ -3,14 +3,14 @@ import { SegmentScrollbarLayout } from './segment-scrollbar-layout'; export let scrollTop = 0; - export let viewportWidth = 0; + // export let viewportWidth = 0; export let scrollbarHeight = 0; let timelineHeight = 0; let segmentScrollbarLayout: SegmentScrollbarLayout[] = []; let isHover = false; let hoveredDate: Date; - let currentMouseYLocation: number = 0; + let currentMouseYLocation = 0; let scrollbarPosition = 0; $: { @@ -34,30 +34,28 @@ onMount(() => { // segmentScrollbarLayout = getLayoutDistance(); - - return () => {}; }); - const getSegmentHeight = (groupCount: number) => { - // if (segmentData.groups.length > 0) { - // const percentage = (groupCount * 100) / segmentData.totalAssets; - // return Math.round((percentage * scrollbarHeight) / 100); - // } else { - // return 0; - // } - }; + // const getSegmentHeight = (groupCount: number) => { + // if (segmentData.groups.length > 0) { + // const percentage = (groupCount * 100) / segmentData.totalAssets; + // return Math.round((percentage * scrollbarHeight) / 100); + // } else { + // return 0; + // } + // }; - const getLayoutDistance = () => { - // let result: SegmentScrollbarLayout[] = []; - // for (const segment of segmentData.groups) { - // let segmentLayout = new SegmentScrollbarLayout(); - // segmentLayout.count = segment.count; - // segmentLayout.height = getSegmentHeight(segment.count); - // segmentLayout.timeGroup = segment.timeGroup; - // result.push(segmentLayout); - // } - // return result; - }; + // const getLayoutDistance = () => { + // let result: SegmentScrollbarLayout[] = []; + // for (const segment of segmentData.groups) { + // let segmentLayout = new SegmentScrollbarLayout(); + // segmentLayout.count = segment.count; + // segmentLayout.height = getSegmentHeight(segment.count); + // segmentLayout.timeGroup = segment.timeGroup; + // result.push(segmentLayout); + // } + // return result; + // }; const handleMouseMove = (e: MouseEvent, currentDate: Date) => { currentMouseYLocation = e.clientY - 71 - 30; diff --git a/web/src/lib/components/shared-components/side-bar/side-bar-button.svelte b/web/src/lib/components/shared-components/side-bar/side-bar-button.svelte index 1139b713d3..ae772efa26 100644 --- a/web/src/lib/components/shared-components/side-bar/side-bar-button.svelte +++ b/web/src/lib/components/shared-components/side-bar/side-bar-button.svelte @@ -1,5 +1,7 @@