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.

fix: highlight primary display in settings when stickDisplayId is undefined

Deepender2539137409014a
diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx
index 86f38ae..22176dd 100644
--- a/src/components/Settings.tsx
+++ b/src/components/Settings.tsx
@@ -207,16 +207,19 @@ export function Settings() {
</div>
<div className="setting-pills">
{displays.length === 0 && <div className="pill disabled">Loading...</div>}
- {displays.map((d) => (
- <button
- key={d.id}
- className={`pill display-pill ${settings.stickDisplayId === d.id ? 'active' : ''}`}
- onClick={() => patch({ stickDisplayId: d.id })}
- >
- <div className="pill-name">{d.name}</div>
- <div className="pill-res">{d.resolution}</div>
- </button>
- ))}
+ {displays.map((d) => {
+ const activeDisplayId = settings.stickDisplayId ?? displays.find(d => d.isPrimary)?.id;
+ return (
+ <button
+ key={d.id}
+ className={`pill display-pill ${activeDisplayId === d.id ? 'active' : ''}`}
+ onClick={() => patch({ stickDisplayId: d.id })}
+ >
+ <div className="pill-name">{d.name}</div>
+ <div className="pill-res">{d.resolution}</div>
+ </button>
+ )
+ })}
</div>
</div>