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

[stable5.0] fix: keyboard shortcut modal not being responsive #6731

Merged
merged 1 commit into from
Feb 17, 2025
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
45 changes: 0 additions & 45 deletions css/app-settings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,51 +57,6 @@
}
}

.shortcut-overview-modal {
.modal-container {
display: flex !important;
flex-wrap: wrap;
padding: 0 12px 12px 12px !important;

* {
box-sizing: border-box;
}

.shortcut-section {
width: 50%;
flex-grow: 0;
flex-shrink: 0;
padding: 10px;

.shortcut-section-item {
width: 100%;
display: grid;
grid-template-columns: 33% 67%;
column-gap: 10px;

&:not(:first-child) {
margin-top: 10px;
}

&__keys {
display: block;
text-align: right;
}

&__label {
display: block;
text-align: left;
padding-top: 5px;
}

&__spacer {
margin: 0 3px;
}
}
}
}
}

// Fix the shortcut overview on smaller screens
@media screen and (max-width: 800px) {
.shortcut-overview-modal .modal-container .shortcut-section {
Expand Down
115 changes: 83 additions & 32 deletions src/components/AppNavigation/Settings/ShortcutOverview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,51 @@
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<Modal class="shortcut-overview-modal"
size="large"
<NcDialog size="large"
:name="$t('calendar', 'Shortcut overview')"
@close="$emit('close')">
<section v-for="category in shortcuts"
:key="category.categoryId"
class="shortcut-section">
<h3 class="shortcut-section__header">
{{ category.categoryLabel }}
</h3>
<div v-for="(shortcut, index) in category.shortcuts"
:key="`${category.categoryId}-${index}`"
class="shortcut-section-item">
<span class="shortcut-section-item__keys">
<template v-for="(keyCombination, index2) of shortcut.keys">
<template v-for="(key, index3) in keyCombination">
<kbd :key="`${category.categoryId}-${index}-${index2}-${index3}`">{{ key }}</kbd>
<span v-if="index3 !== (keyCombination.length - 1)"
:key="`${category.categoryId}-${index}-${index2}-${index3}`"
:closeOnClickOutside="true"

Check warning on line 8 in src/components/AppNavigation/Settings/ShortcutOverview.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Attribute ':closeOnClickOutside' must be hyphenated
@update:open="onUpdateOpen">

Check warning on line 9 in src/components/AppNavigation/Settings/ShortcutOverview.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppNavigation/Settings/ShortcutOverview.vue#L8-L9

Added lines #L8 - L9 were not covered by tests
<div class="shortcut-overview-modal">
<section v-for="category in shortcuts"
:key="category.categoryId"
class="shortcut-section">
<h3 class="shortcut-section__header">
{{ category.categoryLabel }}
</h3>
<div v-for="(shortcut, index) in category.shortcuts"
:key="`${category.categoryId}-${index}`"
class="shortcut-section-item">
<span class="shortcut-section-item__keys">
<template v-for="(keyCombination, index2) of shortcut.keys">
<template v-for="(key, index3) in keyCombination">
<kbd :key="`${category.categoryId}-${index}-${index2}-${index3}`">{{ key }}</kbd>
<span v-if="index3 !== (keyCombination.length - 1)"
:key="`${category.categoryId}-${index}-${index2}-${index3}`"
class="shortcut-section-item__spacer">
+
</span>
</template>
<span v-if="index2 !== (shortcut.keys.length - 1)"
:key="`${category.categoryId}-${index}-${index2}`"
class="shortcut-section-item__spacer">
+
{{ $t('calendar', 'or') }}
</span>
</template>
<span v-if="index2 !== (shortcut.keys.length - 1)"
:key="`${category.categoryId}-${index}-${index2}`"
class="shortcut-section-item__spacer">
{{ $t('calendar', 'or') }}
</span>
</template>
</span>
<span class="shortcut-section-item__label">{{ shortcut.label }}</span>
</div>
</section>
</Modal>
</span>
<span class="shortcut-section-item__label">{{ shortcut.label }}</span>
</div>
</section>
</div>
</NcDialog>
</template>

<script>
import { translate as t } from '@nextcloud/l10n'
import { NcModal as Modal } from '@nextcloud/vue'
import { NcDialog } from '@nextcloud/vue'

export default {
components: {
Modal,
NcDialog,
},
computed: {
shortcuts() {
Expand Down Expand Up @@ -110,5 +112,54 @@
}]
},
},
methods: {
onUpdateOpen(open) {
if (!open) {
this.$emit('close')
}
}
},

Check warning on line 121 in src/components/AppNavigation/Settings/ShortcutOverview.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppNavigation/Settings/ShortcutOverview.vue#L121

Added line #L121 was not covered by tests
}
</script>

Check warning on line 124 in src/components/AppNavigation/Settings/ShortcutOverview.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppNavigation/Settings/ShortcutOverview.vue#L124

Added line #L124 was not covered by tests
<style lang="scss" scoped>
.shortcut-overview-modal {
display: flex;
flex-wrap: wrap;

.shortcut-section {
width: 50%;
min-width: 425px;
flex-grow: 0;
flex-shrink: 0;

Check warning on line 134 in src/components/AppNavigation/Settings/ShortcutOverview.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppNavigation/Settings/ShortcutOverview.vue#L134

Added line #L134 was not covered by tests
padding: 10px;
box-sizing: border-box;

.shortcut-section-item {
width: 100%;
display: grid;
grid-template-columns: 33% 67%;
column-gap: 10px;

&:not(:first-child) {
margin-top: 10px;
}

Check warning on line 147 in src/components/AppNavigation/Settings/ShortcutOverview.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppNavigation/Settings/ShortcutOverview.vue#L147

Added line #L147 was not covered by tests
&__keys {
display: block;
text-align: right;
}

Check warning on line 152 in src/components/AppNavigation/Settings/ShortcutOverview.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppNavigation/Settings/ShortcutOverview.vue#L152

Added line #L152 was not covered by tests
&__label {
display: block;
text-align: left;
padding-top: 5px;
}

&__spacer {
margin: 0 3px;
}
}
}
}
</style>
Loading