Fix code quality issues in timeline components
• Fix variable naming consistency (leadout → leadOut) • Remove unused props from timeline-asset-viewer interface • Add styleMarginRightOverride prop for dynamic margin control • Simplify skeleton component styling
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
showArchiveIcon?: boolean;
|
||||
showSkeleton?: boolean;
|
||||
isShowDeleteConfirmation?: boolean;
|
||||
styleMarginRightOverride?: string;
|
||||
onAssetOpen?: (dayGroup: DayGroup, asset: TimelineAsset, defaultAssetOpen: () => void) => void;
|
||||
onSelect?: (asset: TimelineAsset) => void;
|
||||
header?: Snippet<[handleScrollTop: (top: number) => void]>;
|
||||
@@ -49,6 +50,7 @@
|
||||
withStacked = false,
|
||||
showSkeleton = $bindable(true),
|
||||
showArchiveIcon = false,
|
||||
styleMarginRightOverride,
|
||||
isShowDeleteConfirmation = $bindable(false),
|
||||
|
||||
onAssetOpen,
|
||||
@@ -63,10 +65,8 @@
|
||||
|
||||
let element: HTMLElement | undefined = $state();
|
||||
let timelineElement: HTMLElement | undefined = $state();
|
||||
let scrubberWidth = $state(0);
|
||||
|
||||
const maxMd = $derived(mobileDevice.maxMd);
|
||||
const usingMobileDevice = $derived(mobileDevice.pointerCoarse);
|
||||
const isEmpty = $derived(timelineManager.isInitialized && timelineManager.months.length === 0);
|
||||
|
||||
$effect(() => {
|
||||
@@ -213,7 +213,7 @@
|
||||
};
|
||||
|
||||
const updateIsScrolling = () => (timelineManager.scrolling = true);
|
||||
// note: don't throttle, debounch, or otherwise do this function async - it causes flicker
|
||||
// note: don't throttle, debounce, or otherwise do this function async - it causes flicker
|
||||
const updateSlidingWindow = () => timelineManager.updateSlidingWindow(element?.scrollTop || 0);
|
||||
|
||||
const scrollCompensation = ({ heightDelta, scrollTop }: { heightDelta?: number; scrollTop?: number }) => {
|
||||
@@ -249,7 +249,7 @@
|
||||
<section
|
||||
id="asset-grid"
|
||||
class={['scrollbar-hidden h-full overflow-y-auto outline-none', { 'm-0': isEmpty }, { 'ms-0': !isEmpty }]}
|
||||
style:margin-right={(usingMobileDevice ? 0 : scrubberWidth) + 'px'}
|
||||
style:margin-right={styleMarginRightOverride}
|
||||
tabindex="-1"
|
||||
bind:clientHeight={timelineManager.viewportHeight}
|
||||
bind:clientWidth={null, (v: number) => ((timelineManager.viewportWidth = v), updateSlidingWindow())}
|
||||
|
||||
Reference in New Issue
Block a user