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-1157: Some dependant fixes #3936

Merged
merged 1 commit into from
Nov 3, 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
2 changes: 1 addition & 1 deletion packages/theme/styles/_layouts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ input.search {
}

/* --------- */
.no-word-wrap { word-wrap: none; }
.no-word-wrap { word-wrap: none; text-wrap: nowrap; }
.relative { position: relative; }
.absolute { position: absolute; }
.abs-lt-content {
Expand Down
8 changes: 1 addition & 7 deletions packages/ui/src/resize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
// See the License for the specific language governing permissions and

import { writable } from 'svelte/store'
import type { DefSeparators, SeparatedItem } from './types'
import { DelayedCaller } from './utils'
import type { SeparatedItem, DefSeparators } from './types'

// limitations under the License.
let observer: ResizeObserver
Expand Down Expand Up @@ -163,10 +163,4 @@ export const settingsSeparators: DefSeparators = [
null
]

export const timeSeparators: DefSeparators = [
{ minSize: 12.5, size: 17.5, maxSize: 22.5, float: 'navigator' },
{ minSize: 25, size: 35, maxSize: 45 },
null
]

export const separatorsStore = writable<string[]>([])
11 changes: 6 additions & 5 deletions plugins/calendar/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function generateDailyValues (
while (true) {
if (bySetPos == null || bySetPos.includes(getSetPos(currentDate))) {
const res = currentDate.getTime()
if (res > from) {
if (res > from && res < to) {
values.push(res)
}
i++
Expand Down Expand Up @@ -92,7 +92,7 @@ function generateWeeklyValues (
while (date < end) {
if ((byDay == null || matchesByDay(date, byDay)) && (bySetPos == null || bySetPos.includes(getSetPos(date)))) {
const res = date.getTime()
if (res > from) {
if (res > from && res < to) {
values.push(res)
}
i++
Expand Down Expand Up @@ -172,7 +172,7 @@ function generateMonthlyValues (
(bySetPos == null || bySetPos.includes(getSetPos(currentDate)))
) {
const res = currentDate.getTime()
if (res > from) {
if (res > from && res < to) {
values.push(res)
}
i++
Expand Down Expand Up @@ -212,7 +212,7 @@ function generateYearlyValues (
(bySetPos == null || bySetPos.includes(getSetPos(currentDate)))
) {
const res = currentDate.getTime()
if (res > from) {
if (res > from && res < to) {
values.push(res)
}
i++
Expand Down Expand Up @@ -316,7 +316,8 @@ export function getAllEvents (events: Event[], from: Timestamp, to: Timestamp):
}
}
for (const rec of recur) {
recurData.push(...getReccuringEventInstances(rec, instancesMap.get(rec.eventId) ?? [], from, to))
const recEvents = getReccuringEventInstances(rec, instancesMap.get(rec.eventId) ?? [], from, to)
recurData.push(...recEvents)
}
const res = [
...base,
Expand Down
4 changes: 2 additions & 2 deletions plugins/hr-resources/src/components/Schedule.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import ScheduleView from './ScheduleView.svelte'
import Sidebar from './sidebar/Sidebar.svelte'

export let visibileNav: boolean = true
export let visibleNav: boolean = true
export let navFloat: boolean = false
export let appsDirection: 'vertical' | 'horizontal' = 'horizontal'

Expand Down Expand Up @@ -127,7 +127,7 @@
</script>

<div class="flex h-full clear-mins">
{#if visibileNav}
{#if visibleNav}
<Sidebar
{department}
{descendants}
Expand Down
4 changes: 2 additions & 2 deletions plugins/notification-resources/src/components/Inbox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import People from './People.svelte'
import { subscribe } from '../utils'

export let visibileNav: boolean = true
export let visibleNav: boolean = true
export let navFloat: boolean = false
export let appsDirection: 'vertical' | 'horizontal' = 'horizontal'
let filter: 'all' | 'read' | 'unread' = 'all'
Expand Down Expand Up @@ -143,7 +143,7 @@
</script>

<div class="flex-row-top h-full">
{#if visibileNav}
{#if visibleNav}
<div
class="antiPanel-navigator {appsDirection === 'horizontal'
? 'portrait'
Expand Down
6 changes: 3 additions & 3 deletions plugins/setting-resources/src/components/Settings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import { onDestroy } from 'svelte'
import CategoryElement from './CategoryElement.svelte'

export let visibileNav: boolean = true
export let visibleNav: boolean = true
export let navFloat: boolean = false
export let appsDirection: 'vertical' | 'horizontal' = 'horizontal'

Expand Down Expand Up @@ -97,7 +97,7 @@
</script>

<div class="flex h-full clear-mins">
{#if visibileNav}
{#if visibleNav}
<div class="antiPanel-navigator {appsDirection === 'horizontal' ? 'portrait' : 'landscape'}">
<div class="antiPanel-wrap__content">
<NavHeader label={setting.string.Settings} />
Expand Down Expand Up @@ -149,7 +149,7 @@
<Component
is={category.component}
props={{
visibileNav
visibleNav
}}
/>
{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
let categories: SettingsCategory[] = []
const account = getCurrentAccount() as PersonAccount

export let visibileNav = true
export let visibleNav = true

const settingsQuery = createQuery()
settingsQuery.query(
Expand Down Expand Up @@ -72,7 +72,7 @@
</script>

<div class="flex h-full clear-mins">
{#if visibileNav}
{#if visibleNav}
<div class="antiPanel-navigator filledNav indent">
<div class="antiPanel-wrap__content">
<div class="antiNav-header overflow-label">
Expand Down
14 changes: 14 additions & 0 deletions plugins/view-resources/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { getResource } from '@hcengineering/platform'
import { AttributeCategory, KeyedAttribute, getAttributePresenterClass, hasResource } from '@hcengineering/presentation'
import {
AnyComponent,
AnySvelteComponent,
ErrorPresenter,
Location,
getCurrentResolvedLocation,
Expand Down Expand Up @@ -889,3 +890,16 @@ export async function openDoc (hierarchy: Hierarchy, object: Doc): Promise<void>
const loc = await getObjectLinkFragment(hierarchy, object, {}, comp)
navigate(loc)
}

/**
* @public
*/
export async function getSpacePresenter (
client: Client,
_class: Ref<Class<Doc>>
): Promise<AnySvelteComponent | undefined> {
const value = client.getHierarchy().classHierarchyMixin(_class, view.mixin.SpacePresenter)
if (value?.presenter !== undefined) {
return await getResource(value.presenter)
}
}
26 changes: 13 additions & 13 deletions plugins/workbench-resources/src/components/Workbench.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@
let panelInstance: PanelInstance
let popupInstance: Popup

let visibileNav: boolean = getMetadata(workbench.metadata.NavigationExpandedDefault) ?? true
let visibleNav: boolean = getMetadata(workbench.metadata.NavigationExpandedDefault) ?? true
async function toggleNav (): Promise<void> {
visibileNav = !visibileNav
visibleNav = !visibleNav
closeTooltip()
if (currentApplication && navigatorModel && navigator) {
await tick()
Expand Down Expand Up @@ -480,16 +480,16 @@

let navFloat: boolean = !($deviceInfo.docWidth < 1024)
$: if ($deviceInfo.docWidth <= 1024 && !navFloat) {
visibileNav = false
visibleNav = false
navFloat = true
} else if ($deviceInfo.docWidth > 1024 && navFloat) {
if (getMetadata(workbench.metadata.NavigationExpandedDefault) === undefined) {
navFloat = false
visibileNav = true
visibleNav = true
}
}
const checkOnHide = (): void => {
if (visibileNav && $deviceInfo.docWidth <= 1024) visibileNav = false
if (visibleNav && $deviceInfo.docWidth <= 1024) visibleNav = false
}
let appsDirection: 'vertical' | 'horizontal'
$: appsDirection = $deviceInfo.isMobile && $deviceInfo.isPortrait ? 'horizontal' : 'vertical'
Expand Down Expand Up @@ -598,7 +598,7 @@
</clipPath>
</svg>
<div class="workbench-container" style:flex-direction={appsDirection === 'horizontal' ? 'column-reverse' : 'row'}>
<div class="antiPanel-application {appsDirection}" class:lastDivider={!visibileNav}>
<div class="antiPanel-application {appsDirection}" class:lastDivider={!visibleNav}>
<div
class="hamburger-container clear-mins"
class:portrait={appsDirection === 'horizontal'}
Expand All @@ -617,8 +617,8 @@
<div class="topmenu-container clear-mins flex-no-shrink" class:mini={appsMini}>
<AppItem
icon={TopMenu}
label={visibileNav ? workbench.string.HideMenu : workbench.string.ShowMenu}
selected={!visibileNav}
label={visibleNav ? workbench.string.HideMenu : workbench.string.ShowMenu}
selected={!visibleNav}
size={appsMini ? 'small' : 'medium'}
on:click={toggleNav}
/>
Expand Down Expand Up @@ -684,9 +684,9 @@
}}
/>
<div class="workbench-container">
{#if currentApplication && navigatorModel && navigator && visibileNav}
{#if currentApplication && navigatorModel && navigator && visibleNav}
<!-- svelte-ignore a11y-click-events-have-key-events -->
{#if navFloat}<div class="cover shown" on:click={() => (visibileNav = false)} />{/if}
{#if navFloat}<div class="cover shown" on:click={() => (visibleNav = false)} />{/if}
<div class="antiPanel-navigator {appsDirection === 'horizontal' ? 'portrait' : 'landscape'}">
<div class="antiPanel-wrap__content">
{#if currentApplication}
Expand Down Expand Up @@ -741,15 +741,15 @@
}}
>
{#if currentApplication && currentApplication.component}
<Component is={currentApplication.component} props={{ currentSpace, visibileNav, navFloat, appsDirection }} />
<Component is={currentApplication.component} props={{ currentSpace, visibleNav, navFloat, appsDirection }} />
{:else if specialComponent}
<Component
is={specialComponent.component}
props={{
model: navigatorModel,
...specialComponent.componentProps,
currentSpace,
visibileNav,
visibleNav,
navFloat,
appsDirection
}}
Expand All @@ -764,7 +764,7 @@
{:else if currentView?.component !== undefined}
<Component
is={currentView.component}
props={{ ...currentView.componentProps, currentView, visibileNav, navFloat, appsDirection }}
props={{ ...currentView.componentProps, currentView, visibleNav, navFloat, appsDirection }}
/>
{:else}
<SpaceView {currentSpace} {currentView} {createItemDialog} {createItemLabel} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@
navigate,
showPopup
} from '@hcengineering/ui'
import { NavLink, TreeItem, TreeNode, getActions as getContributedActions } from '@hcengineering/view-resources'
import {
NavLink,
TreeItem,
TreeNode,
getActions as getContributedActions,
getSpacePresenter
} from '@hcengineering/view-resources'
import { SpacesNavModel } from '@hcengineering/workbench'
import { createEventDispatcher } from 'svelte'
import plugin from '../../plugin'
import { classIcon, getSpaceName, getSpacePresenter } from '../../utils'
import { classIcon, getSpaceName } from '../../utils'
import TreeSeparator from './TreeSeparator.svelte'

export let model: SpacesNavModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@
import { getClient } from '@hcengineering/presentation'
import { Action, IconEdit } from '@hcengineering/ui'
import view from '@hcengineering/view'
import { NavLink, TreeItem, TreeNode, getActions as getContributedActions } from '@hcengineering/view-resources'
import {
NavLink,
TreeItem,
TreeNode,
getActions as getContributedActions,
getSpacePresenter
} from '@hcengineering/view-resources'
import { SpacesNavModel } from '@hcengineering/workbench'
import { classIcon, getSpaceName, getSpacePresenter } from '../../utils'
import { classIcon, getSpaceName } from '../../utils'

export let label: IntlString
export let spaces: Space[]
Expand Down
16 changes: 2 additions & 14 deletions plugins/workbench-resources/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
import type { Class, Client, Doc, Obj, Ref, Space, TxOperations } from '@hcengineering/core'
import core from '@hcengineering/core'
import type { Workspace } from '@hcengineering/login'
import login, { loginId } from '@hcengineering/login'
import type { Asset } from '@hcengineering/platform'
import { getResource, setMetadata } from '@hcengineering/platform'
import preference from '@hcengineering/preference'
import { closeClient, getClient } from '@hcengineering/presentation'
import presentation from '@hcengineering/presentation/src/plugin'
import {
AnySvelteComponent,
closePanel,
fetchMetadataLocalStorage,
getCurrentLocation,
Expand All @@ -33,9 +34,6 @@ import view from '@hcengineering/view'
import type { Application } from '@hcengineering/workbench'
import workbench, { NavigatorModel } from '@hcengineering/workbench'
import { writable } from 'svelte/store'
import login, { loginId } from '@hcengineering/login'
import presentation from '@hcengineering/presentation/src/plugin'

export function classIcon (client: Client, _class: Ref<Class<Obj>>): Asset | undefined {
return client.getHierarchy().getClass(_class).icon
}
Expand Down Expand Up @@ -206,13 +204,3 @@ export function signOut (): void {
void closeClient()
navigate({ path: [loginId] })
}

export async function getSpacePresenter (
client: Client,
_class: Ref<Class<Doc>>
): Promise<AnySvelteComponent | undefined> {
const value = client.getHierarchy().classHierarchyMixin(_class, view.mixin.SpacePresenter)
if (value?.presenter !== undefined) {
return await getResource(value.presenter)
}
}