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/Separate date and time picker #6423

Draft
wants to merge 6 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
92 changes: 73 additions & 19 deletions src/components/Editor/Properties/PropertyTitleTimePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,25 @@

<div v-if="!isReadOnly"
class="property-title-time-picker__time-pickers">
<DatePicker :date="startDate"
:timezone-id="startTimezone"
prefix="from"
:is-all-day="isAllDay"
:append-to-body="appendToBody"
:user-timezone-id="userTimezone"
@change="changeStart"
@change-timezone="changeStartTimezone" />
<div class="property-title-time-picker__time-pickers-from">
<DatePicker :date="startDate"
prefix="from"
@change="changeStartDate" />
<DatePicker :date="startDate"
type="time"
@change="changeStartTime" />
<NcTimezonePicker :value="startTimezone" @input="changeStartTimezone" />
</div>

<DatePicker :date="endDate"
:timezone-id="endTimezone"
prefix="to"
:is-all-day="isAllDay"
:append-to-body="appendToBody"
:user-timezone-id="userTimezone"
@change="changeEnd"
@change-timezone="changeEndTimezone" />
<div class="property-title-time-picker__time-pickers-to">
<DatePicker :date="endDate"
prefix="from"
@change="changeEndDate" />
<DatePicker :date="endDate"
type="time"
@change="changeEndTime" />
<NcTimezonePicker :value="endTimezone" @input="changeEndTimezone" />
</div>
</div>
<div v-if="isReadOnly"
class="property-title-time-picker__time-pickers property-title-time-picker__time-pickers--readonly">
Expand Down Expand Up @@ -68,19 +70,22 @@
<script>
import moment from '@nextcloud/moment'
import DatePicker from '../../Shared/DatePicker.vue'
import TimePicker from '../../Shared/TimePicker.vue'
import IconTimezone from 'vue-material-design-icons/Web.vue'
import CalendarIcon from 'vue-material-design-icons/Calendar.vue'
import { NcCheckboxRadioSwitch } from '@nextcloud/vue'
import { NcCheckboxRadioSwitch, NcTimezonePicker } from '@nextcloud/vue'
import { mapState } from 'pinia'
import useSettingsStore from '../../../store/settings.js'

export default {
name: 'PropertyTitleTimePicker',
components: {
DatePicker,
TimePicker,

Check failure on line 84 in src/components/Editor/Properties/PropertyTitleTimePicker.vue

View workflow job for this annotation

GitHub Actions / NPM lint

The "TimePicker" component has been registered but not used
IconTimezone,
CalendarIcon,
NcCheckboxRadioSwitch,
NcTimezonePicker,

Check warning on line 88 in src/components/Editor/Properties/PropertyTitleTimePicker.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/Properties/PropertyTitleTimePicker.vue#L88

Added line #L88 was not covered by tests
},
props: {
/**
Expand Down Expand Up @@ -230,9 +235,17 @@
*
* @param {Date} value The new start date
*/
changeStart(value) {
changeStartDate(value) {
this.$emit('update-start-date', value)
},
/**
* Update the start time

Check warning on line 242 in src/components/Editor/Properties/PropertyTitleTimePicker.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/Properties/PropertyTitleTimePicker.vue#L242

Added line #L242 was not covered by tests
*
* @param {Date} value The new start time
*/
changeStartTime(value) {
this.$emit('update-start-time', value)
},
/**
* Updates the timezone of the start date
*
Expand All @@ -251,9 +264,17 @@
*
* @param {Date} value The new end date
*/
changeEnd(value) {
changeEndDate(value) {
this.$emit('update-end-date', value)
},
/**
* Update the end time
*
* @param {Date} value The new end time
*/
changeEndTime(value) {
this.$emit('update-end-time', value)
},
/**
* Updates the timezone of the end date
*
Expand All @@ -280,3 +301,36 @@
},
}
</script>

<style scoped>
:deep(.button-vue--icon-only), :deep(.button-vue__icon) {
width: 7rem !important;
}

.property-title-time-picker__time-pickers-from, .property-title-time-picker__time-pickers-to {
display: flex;
flex-wrap: wrap;
gap: var(--default-grid-baseline);

:deep(input) {
max-width: 10rem;
}

.native-datetime-picker {
display: inline-block;
}

}

Check warning on line 324 in src/components/Editor/Properties/PropertyTitleTimePicker.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/Properties/PropertyTitleTimePicker.vue#L324

Added line #L324 was not covered by tests
/* Needed because the timezone picker has old styling */
:deep(.vs__dropdown-toggle), :deep(.v-select) {
height: var(--default-clickable-area);
overflow-y: clip !important;
max-width: 200px;
min-width: 200px !important;
}

Check warning on line 331 in src/components/Editor/Properties/PropertyTitleTimePicker.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/Properties/PropertyTitleTimePicker.vue#L331

Added line #L331 was not covered by tests

:deep(button.vs__open-indicator-button) {
padding: 0 !important;
}
</style>
Loading
Loading