Skip to content
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
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
"is-svg": "^4.3.1",
"js-yaml": "^4.0.0",
"ky": "^0.26.0",
"lexorank": "^1.0.4",
"lodash": "^4.17.21",
"lodash.debounce": "^4.0.8",
"lodash.throttle": "^4.1.1",
Expand Down
3 changes: 2 additions & 1 deletion src/cloud/components/DashboardPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,13 @@ const SmartViewPage = ({ data }: SmartViewListPageResponseBody) => {
<Icon path={mdiChevronDown} />
</Button>
</Flexbox>
{selectedSmartView != null ? (
{selectedSmartView != null && team != null ? (
<>
{sendingMap.get(selectedSmartView.id) === 'list-views' ? (
<Spinner />
) : (
<Views
team={team}
views={selectedSmartViewViews}
parent={{ type: 'smartView', target: selectedSmartView }}
docs={selectedSmartViewDocs}
Expand Down
3 changes: 3 additions & 0 deletions src/cloud/components/Props/Pickers/AssigneeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ interface AssigneeSelectProps {
update: (value: string[]) => void
isLoading: boolean
readOnly: boolean
isErrored?: boolean
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there context for adding this state to all of the Pickers instead of just styling the cell? Is there difficult style clashes etc?

Copy link
Copy Markdown
Contributor Author

@Davy-c Davy-c Nov 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are essentially displaying the picker style rather than the cell style in the actual cell.
Also, I feel like error states will most likely end up having specific behaviour on pickers based on what we want ( like for example having only a delete option etc.. ) so that could simplify that if we go with it

popupAlignment?: 'bottom-left' | 'top-left'
}

const AssigneeSelect = ({
disabled = false,
defaultValue,
isLoading,
isErrored,
readOnly,
update,
popupAlignment = 'bottom-left',
Expand Down Expand Up @@ -60,6 +62,7 @@ const AssigneeSelect = ({
<PropertyValueButton
disabled={disabled}
sending={isLoading}
isErrored={isErrored}
empty={defaultValue.length === 0}
isReadOnly={readOnly}
iconPath={
Expand Down
3 changes: 3 additions & 0 deletions src/cloud/components/Props/Pickers/DueDateSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ interface DueDateSelectProps {
disabled?: boolean
shortenedLabel?: boolean
portalId?: string
isErrored?: boolean
}

const DueDateSelect = ({
className,
sending,
disabled,
isReadOnly,
isErrored,
shortenedLabel,
dueDate: dueDateString,
onDueDateChange,
Expand Down Expand Up @@ -71,6 +73,7 @@ const DueDateSelect = ({
sending={sending}
empty={dueDate == null}
isReadOnly={isReadOnly}
isErrored={isErrored}
iconPath={
!isDue ? mdiCalendarMonthOutline : mdiCalendarRemoveOutline
}
Expand Down
11 changes: 11 additions & 0 deletions src/cloud/components/Props/Pickers/PropertyValueButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface PropertyValueButtonProps {
sending?: boolean
empty?: boolean
isReadOnly: boolean
isErrored?: boolean
id?: string
className?: string
onClick?: React.MouseEventHandler<HTMLButtonElement>
Expand All @@ -30,6 +31,7 @@ const PropertyValueButton = forwardRef<
empty,
onClick,
isReadOnly,
isErrored,
className,
id,
},
Expand All @@ -45,6 +47,7 @@ const PropertyValueButton = forwardRef<
'item__property__button',
empty && 'item__property__button--empty',
isReadOnly && 'item__property__button--readOnly',
isErrored && 'item__property__button--errored',
className,
])}
>
Expand Down Expand Up @@ -127,4 +130,12 @@ const ButtonContainer = styled.button`
}
}
}

&.item__property__button--errored {
background-color: rgba(100, 4, 4, 0.2) !important;

&:hover {
background-color: rgba(100, 4, 4, 0.2) !important;
}
}
`
3 changes: 3 additions & 0 deletions src/cloud/components/Props/Pickers/StatusSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface StatusSelectProps {
sending?: boolean
status?: DocStatus | null
disabled?: boolean
isErrored?: boolean
isReadOnly: boolean
onClick?: (event: React.MouseEvent) => void
onStatusChange: (status: DocStatus | null) => void
Expand All @@ -32,6 +33,7 @@ const StatusSelect = ({
status,
sending,
disabled,
isErrored,
isReadOnly,
onStatusChange,
onClick,
Expand All @@ -41,6 +43,7 @@ const StatusSelect = ({
<Container className='item__status__select prop__margin'>
<PropertyValueButton
sending={sending}
isErrored={isErrored}
isReadOnly={isReadOnly}
empty={status == null}
disabled={disabled}
Expand Down
3 changes: 3 additions & 0 deletions src/cloud/components/Props/Pickers/TimePeriodPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface TimePeriodPickerProps {
value?: number | null
disabled?: boolean
isReadOnly?: boolean
isErrored?: boolean
onPeriodChange: (newVal: number | null) => void
popupAlignment?: 'bottom-left' | 'top-left'
}
Expand All @@ -29,6 +30,7 @@ const TimePeriodPicker = ({
disabled,
sending,
value,
isErrored,
isReadOnly = false,
popupAlignment = 'bottom-left',
onPeriodChange,
Expand Down Expand Up @@ -70,6 +72,7 @@ const TimePeriodPicker = ({
disabled={disabled}
empty={parsedValue == null}
isReadOnly={isReadOnly}
isErrored={isErrored}
iconPath={mdiClockOutline}
sending={sending}
onClick={(e) =>
Expand Down
6 changes: 6 additions & 0 deletions src/cloud/components/Props/PropPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface PropPickerProps {
propName: string
propData: SerializedPropData
readOnly?: boolean
isErrored?: boolean
onUpdate?: (newProps: Props) => void
portalId?: string
}
Expand All @@ -28,6 +29,7 @@ const PropPicker = ({
propData,
onUpdate,
readOnly = false,
isErrored,
portalId,
}: PropPickerProps) => {
const { sendingMap, updateDocPropsApi } = useCloudApi()
Expand All @@ -52,6 +54,7 @@ const PropPicker = ({
<AssigneeSelect
disabled={sendingMap.get(parent.target.id) != null || readOnly}
isLoading={sendingMap.get(parent.target.id) === propName}
isErrored={isErrored}
readOnly={readOnly}
defaultValue={
propData.data != null
Expand All @@ -76,6 +79,7 @@ const PropPicker = ({
<DueDateSelect
disabled={sendingMap.get(parent.target.id) != null || readOnly}
sending={sendingMap.get(parent.target.id) === propName}
isErrored={isErrored}
isReadOnly={readOnly}
portalId={portalId}
dueDate={propData.data == null ? null : propData.data.toString()}
Expand Down Expand Up @@ -105,6 +109,7 @@ const PropPicker = ({
? (propData.data as DocStatus)
: null
}
isErrored={isErrored}
sending={sendingMap.get(parent.target.id) === 'status'}
disabled={sendingMap.get(parent.target.id) != null || readOnly}
isReadOnly={readOnly}
Expand Down Expand Up @@ -133,6 +138,7 @@ const PropPicker = ({
<TimePeriodPicker
label={getLabelOfProp(propName)}
isReadOnly={readOnly}
isErrored={isErrored}
sending={sendingMap.get(parent.target.id) === propName}
disabled={sendingMap.get(parent.target.id) != null || readOnly}
value={propData.data.data}
Expand Down
91 changes: 91 additions & 0 deletions src/cloud/components/Views/Table/ColSettingsContext.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { mdiArrowLeft, mdiArrowRight, mdiTrashCanOutline } from '@mdi/js'
import React, { useCallback, useState } from 'react'
import MetadataContainer from '../../../../design/components/organisms/MetadataContainer'
import MetadataContainerRow from '../../../../design/components/organisms/MetadataContainer/molecules/MetadataContainerRow'
import { Column, ColumnMoveType } from '../../../lib/views/table'

interface ColumnSettingsContextProps {
column: Column
moveColumn: (move: ColumnMoveType) => void
removeColumn: (col: Column) => void
close: () => void
}

const ColumnSettingsContext = ({
column,
removeColumn,
moveColumn,
close,
}: ColumnSettingsContextProps) => {
const [sending, setSending] = useState<string>()

const action = useCallback(
async (type: 'move-left' | 'move-right' | 'delete') => {
if (sending != null) {
return
}

setSending(type)

switch (type) {
case 'move-left':
await moveColumn('before')
break
case 'move-right':
await moveColumn('after')
break
case 'delete':
default:
await removeColumn(column)
break
}

setSending(undefined)
close()
},
[sending, close, removeColumn, moveColumn, column]
)

return (
<MetadataContainer>
<MetadataContainerRow
row={{
type: 'button',
props: {
iconPath: mdiArrowLeft,
label: 'Move Left',
spinning: sending === 'move-left',
onClick: () => action('move-left'),
disabled: sending != null,
},
}}
/>
<MetadataContainerRow
row={{
type: 'button',
props: {
iconPath: mdiArrowRight,
label: 'Move Right',
spinning: sending === 'move-right',
onClick: () => action('move-right'),
disabled: sending != null,
},
}}
/>
<MetadataContainerRow
row={{
type: 'button',
props: {
iconPath: mdiTrashCanOutline,
label: 'Delete',
spinning: sending === 'delete',
onClick: () => action('delete'),
disabled: sending != null,
},
}}
/>
</MetadataContainer>
)
}

export default ColumnSettingsContext
Loading