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(j-s): Merge case with another that is not in RVG #17516

Merged
merged 41 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d9797e0
Add a mergeCaseNumber field to case
oddsson Jan 15, 2025
7c12a99
Update mergeCaseNumber field
oddsson Jan 15, 2025
b125889
Allow clearing connected case
oddsson Jan 15, 2025
46a56aa
Add clearable option to Select component
oddsson Jan 15, 2025
eb0fa1b
Merge branch 'main' of github.com:island-is/island.is into ui-select-…
oddsson Jan 15, 2025
910d812
feat(j-s): show case number on infocard
thorhildurt Jan 15, 2025
97414b5
fix(j-s): format
thorhildurt Jan 15, 2025
408e87d
Merge branch 'main' of github.com:island-is/island.is into ui-select-…
oddsson Jan 16, 2025
41f1a83
Merge branch 'main' of github.com:island-is/island.is into j-s/merge-…
oddsson Jan 16, 2025
aa0193f
Merge branch 'ui-select-clear' of github.com:island-is/island.is into…
oddsson Jan 16, 2025
65816db
Remove duplicate ClearIndicator
oddsson Jan 16, 2025
1c4fa55
Remove duplicate ClearIndicator
oddsson Jan 16, 2025
9b584d8
Merge branch 'j-s/show-merged-case-number-outside-of-system' of githu…
oddsson Jan 16, 2025
790e094
Merge branch 'main' of github.com:island-is/island.is into j-s/merge-…
oddsson Jan 16, 2025
02b499c
fix(j-s): conditionally show merge case item if it has defined value
thorhildurt Jan 16, 2025
c5653e9
feat(j-s): Expand the string value for external merge case
thorhildurt Jan 16, 2025
841a6f6
chore: nx format:write update dirty files
andes-it Jan 16, 2025
a210b93
Merge branch 'main' of https://github.com/island-is/island.is into j-…
thorhildurt Jan 16, 2025
b7fc798
Merge branch 'j-s/show-merged-case-number-outside-of-system' of https…
thorhildurt Jan 16, 2025
f4f8042
Merge branch 'main' of github.com:island-is/island.is into j-s/merge-…
oddsson Jan 17, 2025
82aefc1
Remove duplicate imports
oddsson Jan 17, 2025
30dd59b
Remove duplicate imports
oddsson Jan 17, 2025
2e97f85
fix(j-s): merge case Item assignment and check
thorhildurt Jan 17, 2025
ac71c2d
fix(j-s): fix tiny bug
thorhildurt Jan 17, 2025
3667e5b
chore: nx format:write update dirty files
andes-it Jan 17, 2025
7f0bf48
Merge branch 'main' of github.com:island-is/island.is into j-s/merge-…
oddsson Jan 17, 2025
a40110b
Merge branch 'j-s/show-merged-case-number-outside-of-system' of githu…
oddsson Jan 17, 2025
df93281
Merge branch 'main' of github.com:island-is/island.is into j-s/merge-…
oddsson Jan 17, 2025
f921a57
Refactor
oddsson Jan 17, 2025
0e73a94
Refactor
oddsson Jan 17, 2025
932c879
Merge branch 'main' of github.com:island-is/island.is into j-s/merge-…
oddsson Jan 17, 2025
c3419a8
Merge branch 'main' of github.com:island-is/island.is into j-s/merge-…
oddsson Jan 20, 2025
e8d63d3
Remove depreacted icon reference
oddsson Jan 20, 2025
43911bf
Remove depreacted icon reference
oddsson Jan 20, 2025
3ca7094
Merge branch 'main' of github.com:island-is/island.is into j-s/merge-…
oddsson Jan 20, 2025
b4ed289
Fix route
oddsson Jan 20, 2025
af6429f
Fix lint
oddsson Jan 20, 2025
7d07620
Merge branch 'main' into j-s/merge-outside-fe
oddsson Jan 20, 2025
3770cba
Merge branch 'main' into j-s/merge-outside-fe
oddsson Jan 21, 2025
7fdab91
Merge branch 'main' of github.com:island-is/island.is into j-s/merge-…
oddsson Jan 21, 2025
bee03c7
Merge branch 'j-s/merge-outside-fe' of github.com:island-is/island.is…
oddsson Jan 21, 2025
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
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import { Dispatch, FC, SetStateAction, useState } from 'react'
import { useIntl } from 'react-intl'
import Select, {
ClearIndicatorProps,
components,
DropdownIndicatorProps,
OptionProps,
PlaceholderProps,
SingleValueProps,
} from 'react-select'
import Select from 'react-select'

import { Box, IconDeprecated, Tag, Text } from '@island.is/island-ui/core'
import { Box, Tag, Text } from '@island.is/island-ui/core'
import { theme } from '@island.is/island-ui/theme'
import { formatRequestCaseType } from '@island.is/judicial-system/formatters'
import { CourtDocument } from '@island.is/judicial-system/types'
Expand All @@ -23,6 +16,13 @@ import { useCase } from '@island.is/judicial-system-web/src/utils/hooks'

import IconButton from '../IconButton/IconButton'
import MultipleValueList from '../MultipleValueList/MultipleValueList'
import {
ClearIndicator,
DropdownIndicator,
Option,
Placeholder,
SingleValue,
} from '../SelectComponents/SelectComponents'
import * as styles from './CourtDocuments.css'

interface Props {
Expand Down Expand Up @@ -51,55 +51,6 @@ const CourtDocuments: FC<Props> = ({ workingCase, setWorkingCase }) => {
},
]

const DropdownIndicator = (
props: DropdownIndicatorProps<ReactSelectOption>,
) => {
return (
<components.DropdownIndicator {...props}>
<IconDeprecated
type="cheveron"
width={12}
height={12}
color="blue400"
/>
</components.DropdownIndicator>
)
}

const Placeholder = (props: PlaceholderProps<ReactSelectOption>) => {
return (
<components.Placeholder {...props}>
<Text color="dark300" variant="small">
{props.children}
</Text>
</components.Placeholder>
)
}

const SingleValue = (props: SingleValueProps<ReactSelectOption>) => {
return (
<components.SingleValue {...props}>
<Text variant="small">{props.children}</Text>
</components.SingleValue>
)
}

const Option = (props: OptionProps<ReactSelectOption>) => {
return (
<components.Option {...props}>
<Text variant="small">{props.children}</Text>
</components.Option>
)
}

const ClearIndicator = (props: ClearIndicatorProps<ReactSelectOption>) => {
return (
<components.ClearIndicator {...props}>
<IconDeprecated type="close" width={12} height={12} color="blue400" />
</components.ClearIndicator>
)
}

const handleRemoveDocument = (index: number) => {
const updatedCourtDocuments = workingCase.courtDocuments?.filter(
(_doc, i) => {
Expand Down Expand Up @@ -178,127 +129,123 @@ const CourtDocuments: FC<Props> = ({ workingCase, setWorkingCase }) => {
</Tag>
</Box>
</div>
{workingCase.courtDocuments?.map((courtDocument, index) => {
return (
<div
key={`${courtDocument.name}-${index}`}
className={styles.valueWrapper}
>
<div className={styles.courtDocumentInfo}>
<div className={styles.nameContainer}>
<Text variant="h4">{courtDocument.name}</Text>
</div>
<div className={styles.dropdownContainer}>
<Select
classNamePrefix="court-documents-select"
options={whoFiledOptions}
placeholder={formatMessage(
courtDocuments.whoFiled.placeholder,
)}
isLoading={isUpdatingCase && updateIndex === index}
components={{
DropdownIndicator,
IndicatorSeparator: null,
Placeholder,
Option,
ClearIndicator,
SingleValue,
}}
styles={{
control: (baseStyles) => ({
...baseStyles,
border: 'none',
cursor: 'pointer',
boxShadow:
submittedByMenuIsOpen === index
? `inset 0 0 0 3px ${theme.color.mint400}`
: 'none',
borderTopLeftRadius: 8,
borderTopRightRadius: 8,
borderBottomLeftRadius:
submittedByMenuIsOpen === index ? 0 : 8,
borderBottomRightRadius:
submittedByMenuIsOpen === index ? 0 : 8,
transition: 'none',
}),
menu: (baseStyles) => ({
...baseStyles,
marginTop: -3,
borderTopLeftRadius: 0,
borderTopRightRadius: 0,
boxShadow: 'none',
borderTop: `none`,
borderRight: `3px solid ${theme.color.mint400}`,
borderLeft: `3px solid ${theme.color.mint400}`,
borderBottom: `3px solid ${theme.color.mint400}`,
borderBottomLeftRadius: 8,
borderBottomRightRadius: 8,
boxSizing: 'border-box',
}),
option: (baseStyles, { isSelected }) => ({
...baseStyles,
cursor: 'pointer',
position: 'relative',
padding: `${theme.spacing[1]}px`,
{workingCase.courtDocuments?.map((courtDocument, index) => (
<div
key={`${courtDocument.name}-${index}`}
className={styles.valueWrapper}
>
<div className={styles.courtDocumentInfo}>
<div className={styles.nameContainer}>
<Text variant="h4">{courtDocument.name}</Text>
</div>
<div className={styles.dropdownContainer}>
<Select
classNamePrefix="court-documents-select"
options={whoFiledOptions}
placeholder={formatMessage(
courtDocuments.whoFiled.placeholder,
)}
isLoading={isUpdatingCase && updateIndex === index}
components={{
DropdownIndicator,
IndicatorSeparator: null,
Placeholder,
Option,
ClearIndicator,
SingleValue,
}}
styles={{
control: (baseStyles) => ({
...baseStyles,
border: 'none',
cursor: 'pointer',
boxShadow:
submittedByMenuIsOpen === index
? `inset 0 0 0 3px ${theme.color.mint400}`
: 'none',
borderTopLeftRadius: 8,
borderTopRightRadius: 8,
borderBottomLeftRadius:
submittedByMenuIsOpen === index ? 0 : 8,
borderBottomRightRadius:
submittedByMenuIsOpen === index ? 0 : 8,
transition: 'none',
}),
menu: (baseStyles) => ({
...baseStyles,
marginTop: -3,
borderTopLeftRadius: 0,
borderTopRightRadius: 0,
boxShadow: 'none',
borderTop: `none`,
borderRight: `3px solid ${theme.color.mint400}`,
borderLeft: `3px solid ${theme.color.mint400}`,
borderBottom: `3px solid ${theme.color.mint400}`,
borderBottomLeftRadius: 8,
borderBottomRightRadius: 8,
boxSizing: 'border-box',
}),
option: (baseStyles, { isSelected }) => ({
...baseStyles,
cursor: 'pointer',
position: 'relative',
padding: `${theme.spacing[1]}px`,
background: isSelected ? theme.color.blue200 : 'white',
'&:hover': {
background: isSelected
? theme.color.blue200
: 'white',
'&:hover': {
background: isSelected
? theme.color.blue200
: theme.color.blue100,
},
}),
container: (baseStyles) => ({
...baseStyles,
width: '100%',
}),
}}
value={
courtDocument.submittedBy
? whoFiledOptions.find(
(option) =>
option.value === courtDocument.submittedBy,
)
: null
: theme.color.blue100,
},
}),
container: (baseStyles) => ({
...baseStyles,
width: '100%',
}),
}}
value={
courtDocument.submittedBy
? whoFiledOptions.find(
(option) =>
option.value === courtDocument.submittedBy,
)
: null
}
onChange={(option) => {
handleSubmittedBy(
index,
(option as ReactSelectOption)?.value as UserRole,
)
}}
onMenuOpen={() => {
setSubmittedByMenuIsOpen(index)
}}
onMenuClose={() => {
setSubmittedByMenuIsOpen(-1)
}}
isSearchable={false}
isClearable
/>
oddsson marked this conversation as resolved.
Show resolved Hide resolved
</div>
<Box display="flex" alignItems="center">
<Box marginRight={2}>
<Tag variant="darkerBlue" outlined disabled>
{
// +2 because index is zero based and "Krafa um ..." is number 1
formatMessage(courtDocuments.tag, {
index: index + 2,
})
}
onChange={(option) => {
handleSubmittedBy(
index,
(option as ReactSelectOption)?.value as UserRole,
)
}}
onMenuOpen={() => {
setSubmittedByMenuIsOpen(index)
}}
onMenuClose={() => {
setSubmittedByMenuIsOpen(-1)
}}
isSearchable={false}
isClearable
/>
</div>
<Box display="flex" alignItems="center">
<Box marginRight={2}>
<Tag variant="darkerBlue" outlined disabled>
{
// +2 because index is zero based and "Krafa um ..." is number 1
formatMessage(courtDocuments.tag, {
index: index + 2,
})
}
</Tag>
</Box>
</Tag>
</Box>
</div>
<IconButton
onClick={() => handleRemoveDocument(index)}
icon="trash"
colorScheme="blue"
/>
</Box>
</div>
)
})}
<IconButton
onClick={() => handleRemoveDocument(index)}
icon="trash"
colorScheme="blue"
/>
</div>
))}
</>
</MultipleValueList>
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Dispatch, FC, SetStateAction, useContext, useState } from 'react'
import { MessageDescriptor, useIntl } from 'react-intl'
import { useIntl } from 'react-intl'

import { Box, RadioButton, Text, Tooltip } from '@island.is/island-ui/core'
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import {
ClearIndicatorProps,
components,
DropdownIndicatorProps,
OptionProps,
PlaceholderProps,
SingleValueProps,
} from 'react-select'

import { Icon, Text } from '@island.is/island-ui/core'

import { ReactSelectOption } from '../../types'

export const ClearIndicator = (
props: ClearIndicatorProps<ReactSelectOption>,
) => {
return (
<components.ClearIndicator {...props}>
<Icon icon="close" color="blue400" />
</components.ClearIndicator>
)
}

export const DropdownIndicator = (
props: DropdownIndicatorProps<ReactSelectOption>,
) => {
return (
<components.DropdownIndicator {...props}>
<Icon type="filled" icon="chevronDown" color="blue400" />
</components.DropdownIndicator>
)
}

export const Placeholder = (props: PlaceholderProps<ReactSelectOption>) => {
return (
<components.Placeholder {...props}>
<Text color="dark300" variant="small">
{props.children}
</Text>
</components.Placeholder>
)
}

export const SingleValue = (props: SingleValueProps<ReactSelectOption>) => {
return (
<components.SingleValue {...props}>
<Text variant="small">{props.children}</Text>
</components.SingleValue>
)
}

export const Option = (props: OptionProps<ReactSelectOption>) => {
return (
<components.Option {...props}>
<Text variant="small">{props.children}</Text>
</components.Option>
)
}
Loading
Loading