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!

fix(workspace): keep sidebar popout separate from app icons

github-actions[bot]09a69270c6da
diff --git a/src/components/Workspace/SideBarItem.vue b/src/components/Workspace/SideBarItem.vue
index 1e3fa19b..e5f5955c 100644
--- a/src/components/Workspace/SideBarItem.vue
+++ b/src/components/Workspace/SideBarItem.vue
@@ -71,7 +71,6 @@ export default {
<style lang="scss" scoped>
div.side-bar-item {
- position: relative;
color: var(--side-bar-item-color);
background: var(--side-bar-item-background);
text-align: center;
@@ -91,10 +90,10 @@ div.side-bar-item {
display: flex;
align-items: center;
justify-content: center;
- position: absolute;
- top: 50%;
- right: 4px;
- transform: translateY(-50%);
+ // 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;
@@ -124,5 +123,12 @@ div.side-bar-item {
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 030aba4c..60b9759e 100644
--- a/tests/components/sidebar-item.test.js
+++ b/tests/components/sidebar-item.test.js
@@ -65,6 +65,20 @@ describe('SideBarItem', () => {
expect(openSpy).not.toHaveBeenCalled();
});
+ it('launches the workspace app when the icon is clicked', async () => {
+ const wrapper = mountItem({ icon: 'fas fa-server', title: 'App', url: 'https://example.com', target: 'workspace' });
+ await wrapper.findComponent({ name: 'Icon' }).trigger('click');
+ expect(wrapper.emitted('launch-app')).toEqual([[{ url: 'https://example.com', target: 'workspace' }]]);
+ expect(openSpy).not.toHaveBeenCalled();
+ });
+
+ it('launches the workspace app when the title is clicked', async () => {
+ const wrapper = mountItem({ title: 'App', url: 'https://example.com', target: 'workspace' });
+ await wrapper.find('.small-title').trigger('click');
+ expect(wrapper.emitted('launch-app')).toEqual([[{ url: 'https://example.com', target: 'workspace' }]]);
+ 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');