UBERF-4062 (#3892)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-10-26 14:14:44 +06:00 committed by GitHub
parent 4d0d29bc8d
commit b312a416c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 0 deletions

View File

@ -29,6 +29,7 @@
import ReccurancePopup from './ReccurancePopup.svelte' import ReccurancePopup from './ReccurancePopup.svelte'
import VisibilityEditor from './VisibilityEditor.svelte' import VisibilityEditor from './VisibilityEditor.svelte'
import CalendarSelector from './CalendarSelector.svelte' import CalendarSelector from './CalendarSelector.svelte'
import LocationEditor from './LocationEditor.svelte'
export let attachedTo: Ref<Doc> = calendar.ids.NoAttached export let attachedTo: Ref<Doc> = calendar.ids.NoAttached
export let attachedToClass: Ref<Class<Doc>> = calendar.class.Event export let attachedToClass: Ref<Class<Doc>> = calendar.class.Event
@ -46,6 +47,7 @@
const duration = defaultDuration const duration = defaultDuration
let dueDate = startDate + duration let dueDate = startDate + duration
let allDay = false let allDay = false
let location = ''
let reminders = [30 * 60 * 1000] let reminders = [30 * 60 * 1000]
@ -93,6 +95,7 @@
participants, participants,
visibility, visibility,
title, title,
location,
allDay, allDay,
access: 'owner', access: 'owner',
originalStartTime: allDay ? saveUTC(date) : date originalStartTime: allDay ? saveUTC(date) : date
@ -108,6 +111,7 @@
participants, participants,
reminders, reminders,
title, title,
location,
allDay, allDay,
access: 'owner' access: 'owner'
}) })
@ -163,6 +167,7 @@
<EventTimeExtraButton bind:allDay bind:rules on:repeat={setRecurrance} on:allday={allDayChangeHandler} /> <EventTimeExtraButton bind:allDay bind:rules on:repeat={setRecurrance} on:allday={allDayChangeHandler} />
</div> </div>
<div class="block rightCropPadding"> <div class="block rightCropPadding">
<LocationEditor bind:value={location} />
<EventParticipants bind:participants bind:externalParticipants /> <EventParticipants bind:participants bind:externalParticipants />
</div> </div>
<div class="block flex-no-shrink"> <div class="block flex-no-shrink">

View File

@ -30,6 +30,7 @@
import ReccurancePopup from './ReccurancePopup.svelte' import ReccurancePopup from './ReccurancePopup.svelte'
import VisibilityEditor from './VisibilityEditor.svelte' import VisibilityEditor from './VisibilityEditor.svelte'
import CalendarSelector from './CalendarSelector.svelte' import CalendarSelector from './CalendarSelector.svelte'
import LocationEditor from './LocationEditor.svelte'
export let object: Event export let object: Event
$: readOnly = isReadOnly(object) $: readOnly = isReadOnly(object)
@ -48,6 +49,7 @@
let space = object.space let space = object.space
let description = object.description let description = object.description
let location = object.location
let rules: RecurringRule[] = (object as ReccuringEvent).rules ?? [] let rules: RecurringRule[] = (object as ReccuringEvent).rules ?? []
@ -78,6 +80,9 @@
if (object.space !== space) { if (object.space !== space) {
update.space = space update.space = space
} }
if (object.location !== location) {
update.location = location
}
if (allDay !== object.allDay) { if (allDay !== object.allDay) {
update.date = allDay ? saveUTC(startDate) : startDate update.date = allDay ? saveUTC(startDate) : startDate
update.dueDate = allDay ? saveUTC(dueDate) : dueDate update.dueDate = allDay ? saveUTC(dueDate) : dueDate
@ -164,6 +169,7 @@
<EventTimeExtraButton bind:allDay bind:rules on:repeat={setRecurrance} on:allday={allDayChangeHandler} noRepeat /> <EventTimeExtraButton bind:allDay bind:rules on:repeat={setRecurrance} on:allday={allDayChangeHandler} noRepeat />
</div> </div>
<div class="block rightCropPadding"> <div class="block rightCropPadding">
<LocationEditor bind:value={location} />
<EventParticipants bind:participants bind:externalParticipants disabled={readOnly} /> <EventParticipants bind:participants bind:externalParticipants disabled={readOnly} />
</div> </div>
<div class="block flex-no-shrink"> <div class="block flex-no-shrink">

View File

@ -0,0 +1,44 @@
<script lang="ts">
import { Button, EditBox, Icon, IconArrowRight, parseURL } from '@hcengineering/ui'
import calendar from '../plugin'
export let value: string | undefined
function isLink (value: string | undefined): boolean {
if (value === undefined) return false
const url = parseURL(value)
return url.startsWith('http://') || url.startsWith('https://')
}
function open () {
if (value === undefined) return
const url = parseURL(value)
if (url.startsWith('http://') || url.startsWith('https://')) {
window.open(url, '_blank')
}
}
</script>
<div class="flex-row-center flex-gap-1 container">
<Icon icon={calendar.icon.Location} size={'small'} />
<div class="flex-row-center">
<EditBox bind:value placeholder={calendar.string.Location} kind={'ghost'} fullSize focusable />
{#if isLink(value)}
<div class="tool">
<Button focusIndex={4} kind={'ghost'} size={'small'} icon={IconArrowRight} on:click={open} />
</div>
{/if}
</div>
</div>
<style lang="scss">
.tool {
visibility: hidden;
}
.container:hover {
.tool {
visibility: visible;
}
}
</style>