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

UBER-888: fixed dragging of the WorkItem #3735

Merged
merged 1 commit into from
Sep 22, 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
1 change: 1 addition & 0 deletions packages/theme/styles/_layouts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ input.search {
.mr-2-5 { margin-right: .625rem; }
.mr-3 { margin-right: .75rem; }
.mr-4 { margin-right: 1rem; }
.mr-5-5 { margin-right: 1.375rem; }
.mr-6 { margin-right: 1.5rem; }
.mr-8 { margin-right: 2rem; }
.mr-10 { margin-right: 2.5rem; }
Expand Down
8 changes: 4 additions & 4 deletions packages/theme/styles/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1125,13 +1125,13 @@
min-width: 0;
}

/* Tasks in Calendar (WorkSlot) */
.tasksGroup-container .task-item.dragged {
/* ToDos in Calendar (WorkSlot) */
.toDos-container .task-item.dragged {
overflow: hidden;
background-color: var(--theme-bg-color);
background-color: var(--theme-bg-dark-color);
border-color: var(--theme-divider-color);
border-radius: .125rem;
opacity: .75;

.task-icon { opacity: 0; }
.hideOnDrag { opacity: 0 !important; }
}
20 changes: 19 additions & 1 deletion plugins/calendar-resources/src/components/DayCalendar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
export let startHour = 0
export let startFromWeekStart = true
export let weekFormat: 'narrow' | 'short' | 'long' | undefined = displayedDaysCount > 4 ? 'short' : 'long'
export let showHeader = true
export let showHeader: boolean = true
export let clearCells: boolean = false

const dispatch = createEventDispatcher()

Expand All @@ -59,6 +60,7 @@
}
}
const rem = (n: number): number => n * fontSize
const initDisplayedDaysCount = displayedDaysCount

export function getCalendarRect (): DOMRect | undefined {
return container ? calendarRect : undefined
Expand Down Expand Up @@ -494,6 +496,9 @@
const checkSizes = (element: HTMLElement | Element) => {
calendarRect = element.getBoundingClientRect()
calendarWidth = calendarRect.width
if (calendarWidth < 356 && initDisplayedDaysCount >= 1) displayedDaysCount = 1
else if (calendarWidth < 512 && initDisplayedDaysCount >= 2) displayedDaysCount = 2
else if (calendarWidth >= 512 && displayedDaysCount < initDisplayedDaysCount) displayedDaysCount = 3
colWidth = (calendarWidth - 3.5 * fontSize) / displayedDaysCount
}
$: if (docHeight && calendarRect?.top) {
Expand Down Expand Up @@ -534,6 +539,8 @@
})
e.preventDefault()
}

const dragOn = (e: DragEvent) => e.preventDefault()
</script>

<Scroller
Expand All @@ -543,7 +550,9 @@
<div
bind:this={container}
on:dragleave
on:dragover={dragOn}
class="calendar-container"
class:clearCells
style:--calendar-ad-height={styleAD + 'px'}
style:grid={`${showHeader ? '[header] 3.5rem ' : ''}[all-day] ${styleAD}px repeat(${
(displayedHours - startHour) * 2
Expand Down Expand Up @@ -764,6 +773,15 @@
position: relative;
display: grid;

&.clearCells .empty-cell {
position: relative;
&::after {
position: absolute;
content: '';
inset: 0;
z-index: 5;
}
}
.now-line,
.now-line::before {
position: absolute;
Expand Down