Skip to content

Commit c22ee6d

Browse files
Merge pull request #133 from VineetBala-AOT/main
Consolidated Condition screen text change and column shift
2 parents 1ab6eb6 + 8dcea73 commit c22ee6d

File tree

6 files changed

+102
-39
lines changed

6 files changed

+102
-39
lines changed

condition-api/src/condition_api/services/condition_service.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from condition_api.models.project import Project
3737
from condition_api.models.subcondition import Subcondition
3838
from condition_api.schemas.condition import ConsolidatedConditionSchema, ProjectDocumentConditionSchema
39-
from condition_api.utils.enums import AttributeKeys, IEMTermsConfig
39+
from condition_api.utils.enums import AttributeKeys, ConditionType, IEMTermsConfig
4040

4141

4242
class ConditionService:
@@ -769,6 +769,7 @@ def get_consolidated_conditions(
769769
.join(Amendment, Amendment.document_id == Document.id)
770770
.join(Condition, Condition.amended_document_id == Amendment.amended_document_id)
771771
.filter(filter_condition)
772+
.filter(Condition.condition_type == ConditionType.AMEND)
772773
.group_by(DocumentCategory.id, Condition.condition_number)
773774
.subquery()
774775
)

condition-web/src/components/Conditions/ConditionTableRow.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ export default function ConditionTableRow({
4242
},
4343
}}
4444
>
45+
{documentTypeId !== DocumentTypes.Amendment && (
46+
<TableCell
47+
colSpan={2}
48+
align="left"
49+
sx={{
50+
borderTop: border,
51+
borderBottom: border,
52+
py: BCDesignTokens.layoutPaddingXsmall,
53+
}}
54+
>
55+
{condition.amendment_names ?? "--"}
56+
</TableCell>
57+
)}
4558
<TableCell
4659
colSpan={2}
4760
align="left"
@@ -88,19 +101,6 @@ export default function ConditionTableRow({
88101
<ArrowForwardIos fontSize="small" />
89102
</Link>
90103
</TableCell>
91-
{documentTypeId !== DocumentTypes.Amendment && (
92-
<TableCell
93-
colSpan={2}
94-
align="right"
95-
sx={{
96-
borderTop: border,
97-
borderBottom: border,
98-
py: BCDesignTokens.layoutPaddingXsmall,
99-
}}
100-
>
101-
{condition.amendment_names ?? "--"}
102-
</TableCell>
103-
)}
104104
<TableCell
105105
colSpan={2}
106106
align="right"

condition-web/src/components/Conditions/ConditionsTable.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,18 @@ export default function ConditionTable({
9191
}}
9292
>
9393
<TableRow>
94+
{documentTypeId !== DocumentTypes.Amendment && (
95+
<StyledTableHeadCell colSpan={2} align="left">
96+
<TableSortLabel
97+
active={orderBy === "amendment_names"}
98+
direction={orderBy === "amendment_names" ? order : "asc"}
99+
onClick={() => handleSort("amendment_names")}
100+
>
101+
Amended In
102+
</TableSortLabel>
103+
</StyledTableHeadCell>
104+
)}
105+
94106
<StyledTableHeadCell colSpan={2}>
95107
<TableSortLabel
96108
active={orderBy === "condition_number"}
@@ -111,18 +123,6 @@ export default function ConditionTable({
111123
</TableSortLabel>
112124
</StyledTableHeadCell>
113125

114-
{documentTypeId !== DocumentTypes.Amendment && (
115-
<StyledTableHeadCell colSpan={2} align="right">
116-
<TableSortLabel
117-
active={orderBy === "amendment_names"}
118-
direction={orderBy === "amendment_names" ? order : "asc"}
119-
onClick={() => handleSort("amendment_names")}
120-
>
121-
Amendment In
122-
</TableSortLabel>
123-
</StyledTableHeadCell>
124-
)}
125-
126126
<StyledTableHeadCell colSpan={2} align="right">
127127
<TableSortLabel
128128
active={orderBy === "topic_tags"}

condition-web/src/components/Conditions/CreateConditionModal.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FC, useState } from "react";
1+
import { FC, useEffect, useState } from "react";
22
import {
33
Box,
44
Button,
@@ -82,6 +82,12 @@ export const ConditionModal: FC<ConditionModalProps> = ({ open, onClose, project
8282
onClose();
8383
};
8484

85+
useEffect(() => {
86+
if (conditionConflictError) {
87+
setConditionConflictError(false);
88+
}
89+
}, [conditionNumber, conditionName, selectedDocumentId, selectedConditionId, conditionConflictError]);
90+
8591
return (
8692
<Modal open={open} onClose={handleClose}>
8793
<Paper sx={{

condition-web/src/components/Filters/AmendedIn.tsx

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,22 @@ export function AmendedInFilter({ conditions }: AmendedInFilterProps) {
3232
id="source-document-select"
3333
value={filters.amendment_names || ""}
3434
onChange={handleChange}
35-
displayEmpty // important to show the empty item
35+
displayEmpty
36+
MenuProps={{
37+
disablePortal: true,
38+
PaperProps: {
39+
sx: {
40+
maxHeight: 300,
41+
overflow: "auto",
42+
},
43+
},
44+
}}
3645
sx={{
3746
"& .MuiInputBase-input": {
3847
p: BCDesignTokens.layoutPaddingSmall,
48+
overflow: "hidden",
49+
textOverflow: "ellipsis",
50+
whiteSpace: "nowrap",
3951
},
4052
"& .MuiOutlinedInput-notchedOutline": {
4153
border: `1px solid ${BCDesignTokens.surfaceColorBorderDefault} !important`,
@@ -48,21 +60,24 @@ export function AmendedInFilter({ conditions }: AmendedInFilterProps) {
4860
variant="body2"
4961
color={BCDesignTokens.typographyColorDisabled}
5062
sx={{
51-
lineHeight: BCDesignTokens.typographyLineHeightsXxdense,
63+
lineHeight:
64+
BCDesignTokens.typographyLineHeightsXxdense,
5265
}}
5366
>
5467
Amended In
5568
</Typography>
5669
);
5770
}
5871
return (
59-
<Box>
72+
<Box sx={{ overflow: "hidden" }}>
6073
<Typography
6174
variant="body2"
75+
noWrap
6276
sx={{
6377
px: 1,
6478
py: 0.25,
65-
borderRadius: 1
79+
borderRadius: 1,
80+
maxWidth: "100%",
6681
}}
6782
>
6883
{selected}
@@ -82,8 +97,23 @@ export function AmendedInFilter({ conditions }: AmendedInFilterProps) {
8297
</MenuItem>
8398

8499
{sourceDocs.map((doc) => (
85-
<MenuItem key={doc} value={doc}>
86-
<Typography variant="body2">{doc}</Typography>
100+
<MenuItem
101+
key={doc}
102+
value={doc}
103+
sx={{
104+
maxWidth: "100%",
105+
overflow: "hidden",
106+
textOverflow: "ellipsis",
107+
whiteSpace: "nowrap",
108+
}}
109+
>
110+
<Typography
111+
variant="body2"
112+
noWrap
113+
sx={{ maxWidth: "100%" }}
114+
>
115+
{doc}
116+
</Typography>
87117
</MenuItem>
88118
))}
89119
</Select>

condition-web/src/components/Filters/SourceDocumentFilter.tsx

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,22 @@ export function SourceDocumentFilter({ conditions }: SourceDocumentFilterProps)
3232
id="source-document-select"
3333
value={filters.source_document || ""}
3434
onChange={handleChange}
35-
displayEmpty // important to show the empty item
35+
displayEmpty
36+
MenuProps={{
37+
disablePortal: true,
38+
PaperProps: {
39+
sx: {
40+
maxHeight: 300,
41+
overflow: "auto",
42+
},
43+
},
44+
}}
3645
sx={{
3746
"& .MuiInputBase-input": {
3847
p: BCDesignTokens.layoutPaddingSmall,
48+
overflow: "hidden",
49+
textOverflow: "ellipsis",
50+
whiteSpace: "nowrap",
3951
},
4052
"& .MuiOutlinedInput-notchedOutline": {
4153
border: `1px solid ${BCDesignTokens.surfaceColorBorderDefault} !important`,
@@ -48,21 +60,24 @@ export function SourceDocumentFilter({ conditions }: SourceDocumentFilterProps)
4860
variant="body2"
4961
color={BCDesignTokens.typographyColorDisabled}
5062
sx={{
51-
lineHeight: BCDesignTokens.typographyLineHeightsXxdense,
63+
lineHeight:
64+
BCDesignTokens.typographyLineHeightsXxdense,
5265
}}
5366
>
5467
Source Document
5568
</Typography>
5669
);
5770
}
5871
return (
59-
<Box>
72+
<Box sx={{ overflow: "hidden" }}>
6073
<Typography
6174
variant="body2"
75+
noWrap
6276
sx={{
6377
px: 1,
6478
py: 0.25,
65-
borderRadius: 1
79+
borderRadius: 1,
80+
maxWidth: "100%",
6681
}}
6782
>
6883
{selected}
@@ -82,8 +97,19 @@ export function SourceDocumentFilter({ conditions }: SourceDocumentFilterProps)
8297
</MenuItem>
8398

8499
{sourceDocs.map((doc) => (
85-
<MenuItem key={doc} value={doc}>
86-
<Typography variant="body2">{doc}</Typography>
100+
<MenuItem
101+
key={doc}
102+
value={doc}
103+
sx={{
104+
maxWidth: "100%",
105+
overflow: "hidden",
106+
textOverflow: "ellipsis",
107+
whiteSpace: "nowrap",
108+
}}
109+
>
110+
<Typography variant="body2" noWrap sx={{ maxWidth: "100%" }}>
111+
{doc}
112+
</Typography>
87113
</MenuItem>
88114
))}
89115
</Select>

0 commit comments

Comments
 (0)