Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds quick action to add module to recently focused group #586

Merged
merged 1 commit into from
Jun 24, 2021
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
6 changes: 1 addition & 5 deletions src/components/GalleryItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,7 @@ export default {
},
async doubleClick() {
if (this.$store.state.focus.type !== "group") {
return;
}
const groupId = this.$store.state.focus.id;
const groupId = this.$store.state["ui-groups"].lastFocused;
if (!groupId) {
return;
}
Expand Down
26 changes: 26 additions & 0 deletions src/components/Group.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@
@keypress.enter="endTitleEditable"
/>
</div>
<figure
class="group__focusIndicator"
v-show="lastFocusedGroup"
title="Focused Group"
></figure>
<Container
drag-handle-selector=".handle"
orientation="horizontal"
Expand Down Expand Up @@ -365,6 +370,10 @@ export default {
);
},

lastFocusedGroup() {
return this.$store.state["ui-groups"].lastFocused === this.groupId;
},

enabled: {
get() {
return this.group.enabled;
Expand Down Expand Up @@ -494,6 +503,8 @@ export default {
type: "group"
});
}

this.$store.commit("ui-groups/SET_LAST_FOCUSED", this.groupId);
},

removeModule(moduleId) {
Expand All @@ -507,6 +518,10 @@ export default {
this.$modV.store.dispatch("modules/removeActiveModule", {
moduleId
});

if (this.focused) {
this.$store.commit("ui-groups/CLEAR_LAST_FOCUSED");
}
},

toggleTitleEditable() {
Expand Down Expand Up @@ -594,6 +609,7 @@ export default {
overflow: hidden;
display: flex;
flex-direction: column;
position: relative;
}

.group__enabledCheckbox {
Expand Down Expand Up @@ -671,6 +687,16 @@ export default {
max-width: 120px;
}

.group__focusIndicator {
position: absolute;
top: 6px;
right: 6px;
width: 16px;
height: 16px;
border-radius: 50%;
background: #ffffff;
}

.group__controls {
background: #363636;
color: white;
Expand Down
11 changes: 10 additions & 1 deletion src/ui-store/modules/ui-groups.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const state = {
pinned: []
pinned: [],
lastFocused: null
};

const mutations = {
Expand All @@ -17,6 +18,14 @@ const mutations = {
if (index > -1) {
state.splice(index, 1);
}
},

SET_LAST_FOCUSED(state, id) {
state.lastFocused = id;
},

CLEAR_LAST_FOCUSED(state) {
state.lastFocused = null;
}
};

Expand Down