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

Keyboard shortcuts #3758

Merged
merged 2 commits into from
Dec 7, 2023
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ You can enable HMR (Hot module replacement) to avoid page reloads when working o

### Docker: Simple app development container

- Fork the app
- Fork the app
- Clone the repository: `git clone https://github.com/nextcloud/deck.git`
- Go into deck directory: `cd deck`
- Build the app as described in the general build instructions
Expand All @@ -93,7 +93,7 @@ docker run --rm \
### Full Nextcloud development environment

You need to setup a [development environment](https://docs.nextcloud.com/server/latest/developer_manual//getting_started/devenv.html) of the current Nextcloud version. You can also alternatively install & run the [nextcloud docker container](https://github.com/juliushaertl/nextcloud-docker-dev).
After the finished installation, you can clone the deck project directly in the `/[nextcloud-docker-dev-dir]/workspace/server/apps/` folder.
After the finished installation, you can clone the deck project directly in the `/[nextcloud-docker-dev-dir]/workspace/server/apps/` folder.

### Running tests
You can use the provided Makefile to run all tests by using:
Expand Down
3 changes: 3 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@

<router-view name="sidebar" :visible="!cardDetailsInModal || !$route.params.cardId" />
</div>
<KeyboardShortcuts />
</NcContent>
</template>

<script>
import { mapState } from 'vuex'
import AppNavigation from './components/navigation/AppNavigation.vue'
import KeyboardShortcuts from './components/KeyboardShortcuts.vue'
import { NcModal, NcContent, NcAppContent } from '@nextcloud/vue'
import { BoardApi } from './services/BoardApi.js'
import { emit, subscribe } from '@nextcloud/event-bus'
Expand All @@ -60,6 +62,7 @@ export default {
NcModal,
NcContent,
NcAppContent,
KeyboardShortcuts,
},
provide() {
return {
Expand Down
48 changes: 43 additions & 5 deletions src/components/Controls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

<template>
<div class="controls">
<NcModal v-if="showAddCardModal" class="card-selector" @close="clickHideAddCardModel">
<CreateNewCardCustomPicker show-created-notice @cancel="clickHideAddCardModel" />
</NcModal>
<div v-if="overviewName" class="board-title">
<div class="board-bullet icon-calendar-dark" />
<h2 dir="auto">
Expand All @@ -32,9 +35,6 @@
{{ t('deck', 'Add card') }}
</NcActionButton>
</NcActions>
<NcModal v-if="showAddCardModal" class="card-selector" @close="clickHideAddCardModel">
<CreateNewCardCustomPicker show-created-notice @cancel="clickHideAddCardModel" />
</NcModal>
</div>
<div v-else-if="board" class="board-title">
<div :style="{backgroundColor: '#' + board.color}" class="board-bullet" />
Expand All @@ -49,9 +49,14 @@
<SessionList v-if="isNotifyPushEnabled && presentUsers.length"
:sessions="presentUsers" />
<div v-if="searchQuery || true" class="deck-search">
<input type="search"
<input id="deck-search-input"
ref="search"
:tabindex="0"
type="search"
class="icon-search"
:value="searchQuery"
@focus="$store.dispatch('toggleShortcutLock', true)"
@blur="$store.dispatch('toggleShortcutLock', false)"
@input="$store.commit('setSearchQuery', $event.target.value)">
</div>
<div v-if="board && canManage && !showArchived && !board.archived"
Expand All @@ -70,7 +75,9 @@
type="text"
class="no-close"
:placeholder="t('deck', 'List name')"
required>
required
@focus="$store.dispatch('toggleShortcutLock', true)"
@blur="$store.dispatch('toggleShortcutLock', false)">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be good if we can use vuex store helper mapActions to run the actions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luka-nextcloud Can you explain the benefit you see in using the mapper in this scenario? I do not see it as only one action is used, therefore resulting in more code than calling it individually.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the store directly in the template is generally not considered good style I believe

<input v-tooltip="t('deck', 'Add list')"
class="icon-confirm"
type="submit"
Expand All @@ -88,6 +95,7 @@
@hide="filterVisible=false">
<!-- We cannot use NcActions here are the popover trigger does not update on reactive icons -->
<NcButton slot="trigger"
ref="filterPopover"
:title="t('deck', 'Apply filter')"
class="filter-button"
:type="isFilterActive ? 'primary' : 'tertiary'">
Expand Down Expand Up @@ -233,6 +241,7 @@

<script>
import { mapState, mapGetters } from 'vuex'
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
import { NcActions, NcActionButton, NcAvatar, NcButton, NcPopover, NcModal } from '@nextcloud/vue'
import labelStyle from '../mixins/labelStyle.js'
import ArchiveIcon from 'vue-material-design-icons/Archive.vue'
Expand All @@ -244,6 +253,7 @@ import ArrowExpandVerticalIcon from 'vue-material-design-icons/ArrowExpandVertic
import SessionList from './SessionList.vue'
import { isNotifyPushEnabled } from '../sessions.js'
import CreateNewCardCustomPicker from '../views/CreateNewCardCustomPicker.vue'
import { getCurrentUser } from '@nextcloud/auth'

export default {
name: 'Controls',
Expand Down Expand Up @@ -327,7 +337,18 @@ export default {
}
},
},
beforeMount() {
subscribe('deck:board:show-new-card', this.clickShowAddCardModel)
subscribe('deck:board:toggle-filter-popover', this.triggerOpenFilters)
subscribe('deck:board:clear-filter', this.triggerClearFilter)
subscribe('deck:board:toggle-filter-by-me', this.triggerFilterByMe)

},
beforeDestroy() {
unsubscribe('deck:board:show-new-card', this.clickShowAddCardModel)
unsubscribe('deck:board:toggle-filter-popover', this.triggerOpenFilters)
unsubscribe('deck:board:clear-filter', this.triggerClearFilter)
unsubscribe('deck:board:toggle-filter-by-me', this.triggerFilterByMe)
this.setPageTitle('')
},
methods: {
Expand Down Expand Up @@ -406,6 +427,23 @@ export default {
}
window.document.title = newTitle
},
triggerOpenFilters() {
this.$refs.filterPopover.$el.click()
},
triggerOpenSearch() {
this.$refs.search.focus()
},
triggerClearFilter() {
this.clearFilter()
},
triggerFilterByMe() {
if (this.isFilterActive) {
this.clearFilter()
} else {
this.filter.users = [getCurrentUser().uid]
this.setFilter()
}
},
},
}
</script>
Expand Down
Loading
Loading