Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

♻️ Drop sidebar popout button, keep Cmd/Ctrl- and middle-click to open in new tab

github-actions[bot]813b5bc533a2
diff --git a/src/components/Workspace/SideBarItem.vue b/src/components/Workspace/SideBarItem.vue
index e5f5955c..3b9fd413 100644
--- a/src/components/Workspace/SideBarItem.vue
+++ b/src/components/Workspace/SideBarItem.vue
@@ -7,22 +7,12 @@
>
<Icon v-if="icon" :icon="icon" size="small" :url="url" />
<p class="small-title" v-else>{{ title }}</p>
- <button
- v-if="url"
- class="popout-btn"
- :title="$t ? $t('context-menus.item.newtab') : 'Open in new tab'"
- :aria-label="$t ? $t('context-menus.item.newtab') : 'Open in new tab'"
- @click.stop="openInNewTab($event)"
- >
- <NewTabOpenIcon />
- </button>
</div>
</template>
<script>
import Icon from '@/components/LinkItems/ItemIcon.vue';
-import NewTabOpenIcon from '@/assets/interface-icons/open-new-tab.svg';
export default {
name: 'SideBarItem',
@@ -36,7 +26,6 @@ export default {
emits: ['launch-app'],
components: {
Icon,
- NewTabOpenIcon,
},
methods: {
itemClicked(e) {
@@ -85,50 +74,5 @@ div.side-bar-item {
padding: 0.5rem 0;
}
}
-
- .popout-btn {
- display: flex;
- align-items: center;
- justify-content: center;
- // Reserve a separate row so the button never intercepts icon or title clicks.
- width: 1rem;
- height: 1rem;
- margin: 0.5rem auto 0;
- background: none;
- border: none;
- cursor: pointer;
- padding: 2px;
- color: currentColor;
- opacity: 0;
- pointer-events: none;
- border-radius: var(--curve-factor, 4px);
- transition: opacity 0.15s ease-in-out, background 0.15s ease-in-out;
-
- &:hover,
- &:focus-visible {
- opacity: 1;
- background: rgba(255, 255, 255, 0.15);
- outline: 1px solid currentColor;
- pointer-events: auto;
- }
-
- svg {
- width: 0.75rem;
- height: 0.75rem;
- }
- }
-
- &:hover .popout-btn,
- &:focus-within .popout-btn {
- opacity: 0.7;
- pointer-events: auto;
- }
-
- @media (hover: none) {
- .popout-btn {
- opacity: 0.7;
- pointer-events: auto;
- }
- }
}
</style>
diff --git a/tests/components/sidebar-item.test.js b/tests/components/sidebar-item.test.js
index 60b9759e..6381ecd0 100644
--- a/tests/components/sidebar-item.test.js
+++ b/tests/components/sidebar-item.test.js
@@ -16,7 +16,6 @@ function mountItem(props = {}) {
},
stubs: {
Icon: true,
- NewTabOpenIcon: true,
},
},
});
@@ -47,16 +46,6 @@ describe('SideBarItem', () => {
expect(wrapper.find('p.small-title').text()).toBe('No Icon App');
});
- it('does not render popout button when url is not set', () => {
- const wrapper = mountItem({ title: 'Section Header' });
- expect(wrapper.find('.popout-btn').exists()).toBe(false);
- });
-
- it('renders popout button when url is provided', () => {
- const wrapper = mountItem({ title: 'App', url: 'https://example.com' });
- expect(wrapper.find('.popout-btn').exists()).toBe(true);
- });
-
it('emits launch-app on normal click', async () => {
const wrapper = mountItem({ title: 'App', url: 'https://example.com', target: 'workspace' });
await wrapper.trigger('click');
@@ -79,15 +68,6 @@ describe('SideBarItem', () => {
expect(openSpy).not.toHaveBeenCalled();
});
- it('opens in new tab on popout button click without emitting launch-app', async () => {
- const wrapper = mountItem({ title: 'App', url: 'https://example.com', target: 'workspace' });
- const popoutBtn = wrapper.find('.popout-btn');
- expect(popoutBtn.exists()).toBe(true);
- await popoutBtn.trigger('click');
- expect(openSpy).toHaveBeenCalledWith('https://example.com', '_blank', 'noopener,noreferrer');
- expect(wrapper.emitted('launch-app')).toBeFalsy();
- });
-
it('opens in new tab when clicked with ctrlKey or metaKey', async () => {
const wrapper = mountItem({ title: 'App', url: 'https://example.com', target: 'workspace' });
await wrapper.trigger('click', { ctrlKey: true });