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

Move edit sidebar into a modal #6488

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
973 changes: 104 additions & 869 deletions css/app-sidebar.scss

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/components/CalendarGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
type: Boolean,
default: false,
},
url: {

Check warning on line 66 in src/components/CalendarGrid.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Prop 'url' requires default value to be set
type: String,
required: false,
},
Expand Down Expand Up @@ -158,7 +158,7 @@
/**
* FullCalendar Plugins
*
* @return {(PluginDef)[]}

Check warning on line 161 in src/components/CalendarGrid.vue

View workflow job for this annotation

GitHub Actions / NPM lint

The type 'PluginDef' is undefined
*/
plugins() {
return [
Expand All @@ -175,7 +175,7 @@
// We do not allow drag and drop when the editor is open.
return this.isAuthenticatedUser
&& this.$route?.name !== 'EditPopoverView'
&& this.$route?.name !== 'EditSidebarView'
&& this.$route?.name !== 'EditFullView'
},
},
watch: {
Expand Down Expand Up @@ -250,9 +250,9 @@
this.saveNewView(to.params.view)
}

if ((from.name === 'NewPopoverView' || from.name === 'NewSidebarView')
if ((from.name === 'NewPopoverView' || from.name === 'NewFullView')
&& to.name !== 'NewPopoverView'
&& to.name !== 'NewSidebarView') {
&& to.name !== 'NewFullView') {
const calendarApi = this.$refs.fullCalendar.getApi()
calendarApi.unselect()
}
Expand All @@ -263,7 +263,7 @@
// Trigger the select event programmatically on initial page load to show the new event
// in the grid. Wait for the next tick because the ref isn't available right away.
await this.$nextTick()
if (['NewPopoverView', 'NewSidebarView'].includes(this.$route.name)) {
if (['NewPopoverView', 'NewFullView'].includes(this.$route.name)) {
const start = new Date(parseInt(this.$route.params.dtstart) * 1000)
const end = new Date(parseInt(this.$route.params.dtend) * 1000)
if (!isNaN(start.getTime()) && !isNaN(end.getTime())) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Editor/Attachments/AttachmentsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export default {
span {
width: 34px;
height: 34px;
margin-left: -10px;
margin-left: -15px;
margin-right: 5px;
}

Expand Down
6 changes: 6 additions & 0 deletions src/components/Editor/Properties/PropertyTitle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,9 @@
},
}
</script>

<style scoped>
input {
width: 100% !important;
}
</style>

Check warning on line 59 in src/components/Editor/Properties/PropertyTitle.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/Properties/PropertyTitle.vue#L57-L59

Added lines #L57 - L59 were not covered by tests
6 changes: 3 additions & 3 deletions src/components/Editor/SaveButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{{ $t('calendar', 'More details') }}
</NcButton>
<NcButton v-if="showSaveButton"
type="primary"
type="secondary"
:disabled="disabled"
@click="saveThisOnly">
<template #icon>
Expand All @@ -21,7 +21,7 @@
{{ $t('calendar', 'Save') }}
</NcButton>
<NcButton v-if="showUpdateButton"
type="primary"
type="secondary"
:disabled="disabled"
@click="saveThisOnly">
<template #icon>
Expand All @@ -36,7 +36,7 @@
{{ $t('calendar', 'Update this and all future') }}
</NcButton>
<NcButton v-if="showUpdateOnlyThisButton"
type="primary"
type="secondary"
:disabled="disabled"
@click="saveThisOnly">
{{ $t('calendar', 'Update this occurrence') }}
Expand Down
6 changes: 3 additions & 3 deletions src/fullcalendar/interaction/eventClick.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ function handleEventClick(event, router, route, window, isWidget = false) {
return
}
let desiredRoute = settingsStore.skipPopover
? 'EditSidebarView'
? 'EditFullView'
: 'EditPopoverView'

// Don't show the popover if the window size is too small (less then its max width of 450 px + a bit)
// The mobile breakpoint of the reworked modals is 1024 px / 2 so simply use that.
if (window.innerWidth <= 1024 / 2 && desiredRoute === 'EditPopoverView') {
desiredRoute = 'EditSidebarView'
desiredRoute = 'EditFullView'
}

const name = getPrefixedRoute(route.name, desiredRoute)
Expand All @@ -75,7 +75,7 @@ function handleEventClick(event, router, route, window, isWidget = false) {
})

// Don't push new route when day didn't change
if ((getPrefixedRoute(route.name, 'EditPopoverView') === route.name || getPrefixedRoute(route.name, 'EditSidebarView') === route.name)
if ((getPrefixedRoute(route.name, 'EditPopoverView') === route.name || getPrefixedRoute(route.name, 'EditFullView') === route.name)
&& params.object === route.params.object
&& params.recurrenceId === route.params.recurrenceId) {
return
Expand Down
6 changes: 3 additions & 3 deletions src/fullcalendar/interaction/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ export default function(router, route, window) {

return function({ start, end, allDay }) {
let name = settingsStore.skipPopover
? 'NewSidebarView'
? 'NewFullView'
: 'NewPopoverView'

// Don't show the popover if the window size is too small (less then its max width of 450 px + a bit)
// The mobile breakpoint of the reworked modals is 1024 px / 2 so simply use that.
if (window.innerWidth <= 1024 / 2 && name === 'NewPopoverView') {
name = 'NewSidebarView'
name = 'NewFullView'
}

// If we are already in a new event view, don't change it
if (['NewSidebarView', 'NewPopoverView'].includes(route.name)) {
if (['NewFullView', 'NewPopoverView'].includes(route.name)) {
name = route.name
}

Expand Down
6 changes: 3 additions & 3 deletions src/mixins/EditorMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ export default {
* @param {Function} next Function to be called when ready to load the next view
*/
async beforeRouteEnter(to, from, next) {
if (to.name === 'NewSidebarView' || to.name === 'NewPopoverView') {
if (to.name === 'NewFullView' || to.name === 'NewPopoverView') {
next(async vm => {
vm.resetState()

Expand Down Expand Up @@ -752,7 +752,7 @@ export default {
*/
async beforeRouteUpdate(to, from, next) {
// If we are in the New Event dialog, we want to update the selected time
if (to.name === 'NewSidebarView' || to.name === 'NewPopoverView') {
if (to.name === 'NewFullView' || to.name === 'NewPopoverView') {
// If allDay, dtstart and dtend are the same there is no need to update.
// This is usally the case when navigating through the calendar while the editor is open
if (to.params.allDay === from.params.allDay
Expand Down Expand Up @@ -837,7 +837,7 @@ export default {

try {
if ((from.name !== 'NewPopoverView' || to.name !== 'EditPopoverView')
&& (from.name !== 'NewPopoverView' || to.name !== 'EditSideBarView')) {
&& (from.name !== 'NewPopoverView' || to.name !== 'EditFullView')) {
await this.save()
}
next()
Expand Down
26 changes: 13 additions & 13 deletions src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getRootUrl, generateUrl } from '@nextcloud/router'

import Calendar from './views/Calendar.vue'
import EditSimple from './views/EditSimple.vue'
import EditSidebar from './views/EditSidebar.vue'
import EditFull from './views/EditFull.vue'
import {
getDefaultEndDateForNewEvent,
getDefaultStartDateForNewEvent,
Expand Down Expand Up @@ -40,9 +40,9 @@ const router = new Router({
component: EditSimple,
},
{
path: '/p/:tokens/:view/:firstDay/view/sidebar/:object/:recurrenceId',
name: 'PublicEditSidebarView',
component: EditSidebar,
path: '/p/:tokens/:view/:firstDay/view/full/:object/:recurrenceId',
name: 'PublicEditFullView',
component: EditFull,
},
],
},
Expand All @@ -57,9 +57,9 @@ const router = new Router({
component: EditSimple,
},
{
path: '/embed/:tokens/:view/:firstDay/view/sidebar/:object/:recurrenceId',
name: 'EmbedEditSidebarView',
component: EditSidebar,
path: '/embed/:tokens/:view/:firstDay/view/full/:object/:recurrenceId',
name: 'EmbedEditFullView',
component: EditFull,
},
],
},
Expand Down Expand Up @@ -117,19 +117,19 @@ const router = new Router({
component: EditSimple,
},
{
path: '/:view/:firstDay/edit/sidebar/:object/:recurrenceId',
name: 'EditSidebarView',
component: EditSidebar,
path: '/:view/:firstDay/edit/full/:object/:recurrenceId',
name: 'EditFullView',
component: EditFull,
},
{
path: '/:view/:firstDay/new/popover/:allDay/:dtstart/:dtend',
name: 'NewPopoverView',
component: EditSimple,
},
{
path: '/:view/:firstDay/new/sidebar/:allDay/:dtstart/:dtend',
name: 'NewSidebarView',
component: EditSidebar,
path: '/:view/:firstDay/new/full/:allDay/:dtstart/:dtend',
name: 'NewFullView',
component: EditFull,
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion src/views/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default {
&& !this.isEmbedded
&& !this.isWidget
&& this.$route?.name !== 'EditPopoverView'
&& this.$route?.name !== 'EditSidebarView'
&& this.$route?.name !== 'EditFullView'
},
isSelectable() {
return !this.isPublicShare && !this.isEmbedded && !this.isWidget
Expand Down
Loading
Loading