Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions apps/desktop/src/components/main/body/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -658,12 +658,13 @@ function useScrollActiveTabIntoView(tabs: Tab[]) {
}

function useTabsShortcuts() {
const { tabs, currentTab, close, select } = useTabs(
const { tabs, currentTab, close, select, unpin } = useTabs(
useShallow((state) => ({
tabs: state.tabs,
currentTab: state.currentTab,
close: state.close,
select: state.select,
unpin: state.unpin,
})),
);
const newNote = useNewNote({ behavior: "new" });
Expand Down Expand Up @@ -702,15 +703,19 @@ function useTabsShortcuts() {
"mod+w",
async () => {
if (currentTab) {
close(currentTab);
if (currentTab.pinned) {
unpin(currentTab);
} else {
close(currentTab);
}
}
},
{
preventDefault: true,
enableOnFormTags: true,
enableOnContentEditable: true,
},
[currentTab, close],
[currentTab, close, unpin],
);

useHotkeys(
Expand Down
14 changes: 13 additions & 1 deletion apps/desktop/src/components/main/body/shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,19 @@ export function TabItemBase({
<div className="absolute inset-0 rounded-full bg-red-300 animate-ping"></div>
</div>
) : pinned ? (
<Pin size={14} className="text-neutral-500" />
<button
onClick={(e) => {
e.stopPropagation();
handleUnpinThis();
}}
className={cn([
"flex items-center justify-center transition-colors",
selected && "text-neutral-700 hover:text-neutral-900",
!selected && "text-neutral-500 hover:text-neutral-700",
])}
>
<Pin size={14} />
</button>
) : (
icon
)}
Expand Down