Skip to content

Edge-Drop is a clipboard shelf on the edge of your screen. Hover to open it. Drag files and images into any app, click to copy text and links. Free and open-source for Windows.

feat(filters): add dedicated Colors filter and responsive chip sizing for vertical dock

Deepender258f0f9d82ba61
diff --git a/shared/types.ts b/shared/types.ts
index eff54af..a514d79 100644
--- a/shared/types.ts
+++ b/shared/types.ts
@@ -33,7 +33,7 @@ export type ItemData =
export type ItemKind = ItemData['kind']
-export type TypeFilter = 'all' | 'text' | 'links' | 'images' | 'files'
+export type TypeFilter = 'all' | 'text' | 'links' | 'images' | 'files' | 'colors'
/**
* A single clipboard entry. `id` is stable across the lifetime of the entry;
diff --git a/src/components/EmptyState.tsx b/src/components/EmptyState.tsx
index af0f235..609513b 100644
--- a/src/components/EmptyState.tsx
+++ b/src/components/EmptyState.tsx
@@ -9,8 +9,17 @@ export function EmptyState({ filtered }: { filtered: boolean }) {
let hint = filtered ? t('emptyState.noResultsHint') : t('emptyState.shelfEmptyHint')
if (typeFilter !== 'all') {
- const labelKey = typeFilter === 'text' ? 'emptyState.textClips' : typeFilter === 'links' ? 'emptyState.links' : typeFilter === 'images' ? 'emptyState.images' : 'emptyState.files'
- const label = t(labelKey)
+ const labelKey =
+ typeFilter === 'text'
+ ? 'emptyState.textClips'
+ : typeFilter === 'links'
+ ? 'emptyState.links'
+ : typeFilter === 'images'
+ ? 'emptyState.images'
+ : typeFilter === 'colors'
+ ? 'filters.colors'
+ : 'emptyState.files'
+ const label = (t(labelKey) || 'colors').toLowerCase()
title = t('emptyState.noClipsFound', { type: label })
hint = t('emptyState.copyTypeHint', { type: label })
}
diff --git a/src/components/Header.tsx b/src/components/Header.tsx
index 1036852..f1664e2 100644
--- a/src/components/Header.tsx
+++ b/src/components/Header.tsx
@@ -1,7 +1,7 @@
/** Panel header: title + settings toggle. */
import { motion } from 'framer-motion'
import { useStore } from '../store/appStore'
-import { GearIcon, CloseIcon, InfoIcon, ClockIcon, TypeIcon, LinkIcon, ImageIcon, FilesIcon, EmojiSmileIcon } from './icons'
+import { GearIcon, CloseIcon, InfoIcon, ClockIcon, TypeIcon, LinkIcon, ImageIcon, FilesIcon, PaletteIcon, EmojiSmileIcon } from './icons'
import { playButtonClickSound } from '../lib/soundEffects'
import { loadEmojiCatalog } from '../lib/emoji/load'
@@ -59,13 +59,17 @@ export function Header({ isHorizontal = false, itemCount, clearProps }: HeaderPr
{ id: 'links', label: t('filters.links'), Icon: LinkIcon },
{ id: 'images', label: t('filters.images'), Icon: ImageIcon },
{ id: 'files', label: t('filters.files'), Icon: FilesIcon },
+ { id: 'colors', label: t('filters.colors') || 'Colors', Icon: PaletteIcon },
{ id: 'emoji', label: t('emoji.open'), Icon: EmojiSmileIcon }
]
const activeId: (typeof FILTERS)[number]['id'] = emojiOpen ? 'emoji' : typeFilter
const activeIndex = Math.max(0, FILTERS.findIndex((f) => f.id === activeId))
const ActiveIcon = FILTERS[activeIndex]?.Icon || FILTERS[0].Icon
- const filterChipWidth = 28
+ const filterChipWidth = isHorizontal ? 28 : 25
+ const filterChipHeight = isHorizontal ? 28 : 25
+ const filterChipGap = isHorizontal ? 4 : 3
+ const filterIconSize = isHorizontal ? 14 : 13
const reduceMotion = !!settings.reduceMotion
const headerFade = `opacity ${reduceMotion ? '0.01s' : '0.16s'} ease`
@@ -78,7 +82,7 @@ export function Header({ isHorizontal = false, itemCount, clearProps }: HeaderPr
alignItems: 'center',
minWidth: 0,
flex: 1,
- height: 28,
+ height: filterChipHeight,
overflow: 'hidden'
}}
>
@@ -94,7 +98,7 @@ export function Header({ isHorizontal = false, itemCount, clearProps }: HeaderPr
border: 'none',
borderRadius: 999,
padding: 0,
- gap: 4,
+ gap: filterChipGap,
marginLeft: 0,
maxWidth: '100%',
overflow: 'visible',
@@ -106,7 +110,7 @@ export function Header({ isHorizontal = false, itemCount, clearProps }: HeaderPr
{/* Single Persistent Sliding Pill Indicator (ABOVE the buttons) */}
<motion.div
initial={false}
- animate={{ x: activeIndex * (filterChipWidth + 4) }}
+ animate={{ x: activeIndex * (filterChipWidth + filterChipGap) }}
transition={{
type: 'spring',
stiffness: 440,
@@ -118,7 +122,7 @@ export function Header({ isHorizontal = false, itemCount, clearProps }: HeaderPr
left: 0,
top: 0,
width: filterChipWidth,
- height: 28,
+ height: filterChipHeight,
borderRadius: 999,
background: 'linear-gradient(180deg, #ffffff 0%, #ebebeb 100%)',
border: 'none',
@@ -132,7 +136,7 @@ export function Header({ isHorizontal = false, itemCount, clearProps }: HeaderPr
willChange: 'transform'
}}
>
- <ActiveIcon width={14} height={14} />
+ <ActiveIcon width={filterIconSize} height={filterIconSize} />
</motion.div>
{FILTERS.map((f) => {
@@ -147,6 +151,10 @@ export function Header({ isHorizontal = false, itemCount, clearProps }: HeaderPr
aria-label={f.label}
aria-pressed={active}
tabIndex={settingsOpen ? -1 : 0}
+ style={{
+ width: filterChipWidth,
+ height: filterChipHeight
+ }}
onPointerEnter={() => {
if (f.id === 'emoji') void loadEmojiCatalog()
}}
@@ -156,7 +164,7 @@ export function Header({ isHorizontal = false, itemCount, clearProps }: HeaderPr
else setTypeFilter(f.id)
}}
>
- <Icon width={14} height={14} />
+ <Icon width={filterIconSize} height={filterIconSize} />
</button>
)
})}
diff --git a/src/components/icons.tsx b/src/components/icons.tsx
index c50e484..c6b1ec9 100644
--- a/src/components/icons.tsx
+++ b/src/components/icons.tsx
@@ -45,7 +45,8 @@ import {
Trophy,
Lightbulb,
Shapes,
- Flag
+ Flag,
+ Palette
} from 'lucide-react'
type P = SVGProps<SVGSVGElement>
@@ -142,6 +143,7 @@ export const ClockIcon = (p: P) => {
export const RecentIcon = ClockIcon
export const TypeIcon = uiIcon(Type)
export const FilesIcon = uiIcon(Files)
+export const PaletteIcon = uiIcon(Palette)
export const EmojiSmileIcon = uiIcon(Smile, 18)
export const EmojiClockIcon = (p: P) => <ClockIcon width={p.width ?? 18} height={p.height ?? 18} {...(p as any)} />
diff --git a/src/hooks/useFilteredItems.ts b/src/hooks/useFilteredItems.ts
index 6207d07..e0e02f7 100644
--- a/src/hooks/useFilteredItems.ts
+++ b/src/hooks/useFilteredItems.ts
@@ -8,6 +8,7 @@ import { useMemo } from 'react'
import { useStore } from '../store/appStore'
import type { ClipboardItemDto, TypeFilter } from '../../shared/types'
import { basename, isImagePath } from '../lib/format'
+import { parseColor } from '../lib/colorUtils'
function matches(it: ClipboardItemDto, q: string): boolean {
if (!q) return true
@@ -42,7 +43,7 @@ export function itemMatchesTypeFilter(it: ClipboardItemDto, filter: TypeFilter):
if (filter === 'all') return true
switch (filter) {
case 'text':
- return it.data.kind === 'text' && !it.data.isUrl
+ return it.data.kind === 'text' && !it.data.isUrl && !it.data.isColor && !parseColor(it.data.text)
case 'links':
return it.data.kind === 'text' && !!it.data.isUrl
case 'images':
@@ -50,6 +51,8 @@ export function itemMatchesTypeFilter(it: ClipboardItemDto, filter: TypeFilter):
return isImageOnlyFileItem(it)
case 'files':
return it.data.kind === 'files' && !isImageOnlyFileItem(it)
+ case 'colors':
+ return it.data.kind === 'text' && (!!it.data.isColor || !!parseColor(it.data.text))
}
}
diff --git a/src/i18n/translations.ts b/src/i18n/translations.ts
index 84d2eb5..7416f8f 100644
--- a/src/i18n/translations.ts
+++ b/src/i18n/translations.ts
@@ -5,6 +5,7 @@ export interface TranslationKeys {
links: string
images: string
files: string
+ colors?: string
}
tabs: {
behaviour: string
@@ -480,7 +481,8 @@ export const en: TranslationKeys = {
"text": "Text",
"links": "Links",
"images": "Images",
- "files": "Files"
+ "files": "Files",
+ "colors": "Colors"
},
"tabs": {
"behaviour": "Behaviour",
diff --git a/src/styles/panel.css b/src/styles/panel.css
index d9dc4d0..4a9a2c4 100644
--- a/src/styles/panel.css
+++ b/src/styles/panel.css
@@ -664,6 +664,11 @@
color: #ffffff;
}
+.header:not(.header-horizontal) .filter-chip {
+ width: 25px;
+ height: 25px;
+}
+
/* Copy Indicator Sine Curve Morph Styles */
.copy-curve-container {
pointer-events: none;
diff --git a/tests/typeFilter.test.ts b/tests/typeFilter.test.ts
index 48b191f..4279a2e 100644
--- a/tests/typeFilter.test.ts
+++ b/tests/typeFilter.test.ts
@@ -71,4 +71,25 @@ describe('type filters: image files live in Images only', () => {
expect(itemMatchesTypeFilter(note, 'links')).toBe(false)
expect(itemMatchesTypeFilter(pngFile, 'text')).toBe(false)
})
+
+ it('colors: matches color codes and separates them from text', () => {
+ const colorHex = dto({ kind: 'text', text: '#ebd5ad', isUrl: false, isColor: true })
+ const colorRgb = dto({ kind: 'text', text: 'rgb(235, 213, 173)', isUrl: false })
+ const plainText = dto({ kind: 'text', text: 'just normal notes', isUrl: false })
+
+ expect(itemMatchesTypeFilter(colorHex, 'colors')).toBe(true)
+ expect(itemMatchesTypeFilter(colorRgb, 'colors')).toBe(true)
+ expect(itemMatchesTypeFilter(plainText, 'colors')).toBe(false)
+ expect(itemMatchesTypeFilter(screenshot, 'colors')).toBe(false)
+ expect(itemMatchesTypeFilter(pngFile, 'colors')).toBe(false)
+
+ // Text filter excludes colors so color codes do not clutter text notes
+ expect(itemMatchesTypeFilter(plainText, 'text')).toBe(true)
+ expect(itemMatchesTypeFilter(colorHex, 'text')).toBe(false)
+ expect(itemMatchesTypeFilter(colorRgb, 'text')).toBe(false)
+
+ // All filter still shows colors
+ expect(itemMatchesTypeFilter(colorHex, 'all')).toBe(true)
+ expect(itemMatchesTypeFilter(colorRgb, 'all')).toBe(true)
+ })
})