Skip to content

Commit 7566348

Browse files
authored
Merge pull request #5400 from 3drepo/ISSUE_5379
Issue 5379 - Pin types in tickets
2 parents f9179c9 + e250ec5 commit 7566348

File tree

15 files changed

+235
-69
lines changed

15 files changed

+235
-69
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Copyright (C) 2025 3D Repo Ltd
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Affero General Public License as
6+
* published by the Free Software Foundation, either version 3 of the
7+
* License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Affero General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Affero General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
19+
type IProps = {
20+
className?: any;
21+
};
22+
23+
export default ({ className }: IProps) => (
24+
<svg width="18" height="20" viewBox="0 0 18 20" fill="none" xmlns="http://www.w3.org/2000/svg" className={className}>
25+
<ellipse id="selectionFill" strokeWidth="0" fill="#000000" visibility="hidden" cx="9.7955208" cy="8.7244406" rx="5.6085687" ry="5.5306721" />
26+
<path
27+
id="main"
28+
fill="currentColor"
29+
d="m 9.0472506,-0.05845933 c -2.1953879,0 -4.2648738,0.83648718 -5.8203128,2.35351563 -1.550518,1.5148385 -2.40820298,3.5310865 -2.40820298,5.6777344 0,3.2612473 1.58042498,5.9740053 3.31445298,7.9707033 1.736799,1.999798 3.6811205,3.344473 4.5371096,3.888672 0.2302098,0.1464 0.5236965,0.1464 0.7539063,0 0.8559693,-0.544199 2.8003113,-1.888874 4.5371093,-3.888672 1.733998,-1.996698 3.314453,-4.709456 3.314453,-7.9707033 0,-2.1464879 -0.859258,-4.1631928 -2.410156,-5.6757812 -1.555498,-1.51962752 -3.623131,-2.35546883 -5.8183594,-2.35546883 z m -0.00586,4.67578123 c 2.0351604,0 3.6835934,1.6484517 3.6835934,3.6835938 0,2.0350873 -1.648433,3.6855473 -3.6835934,3.6855473 -2.035133,0 -3.6855474,-1.65046 -3.6855474,-3.6855473 1e-6,-2.0351421 1.6504144,-3.6835938 3.6855474,-3.6835938 z"
30+
/>
31+
</svg>
32+
);
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* Copyright (C) 2023 3D Repo Ltd
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Affero General Public License as
6+
* published by the Free Software Foundation, either version 3 of the
7+
* License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Affero General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Affero General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
type IProps = {
19+
className?: any;
20+
};
21+
22+
export default ({ className }: IProps) => (
23+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" className={className}>
24+
<path
25+
id="main"
26+
d="m 10.672,0.109375 c -3.2955383,3e-8 -5.967326,2.6712586 -5.9669219,5.9667969 C 4.7110313,8.9629326 6.6524586,11.431315 9.4945,11.9375 v 7.134766 L 10.693359,19.898438 11.85,18.892578 V 11.894531 C 14.572219,11.282898 16.637461,8.8662557 16.638672,6.0761719 16.639076,2.7806336 13.967538,0.10937497 10.672,0.109375 Z"
27+
fill="currentColor"/>
28+
29+
<path
30+
d="m 10.977607,3.1040296 c 1.996699,0 2.928475,1.4097868 2.928475,2.5809942"
31+
fill="#ffffffcc"
32+
/>
33+
</svg>
34+
);
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Copyright (C) 2025 3D Repo Ltd
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Affero General Public License as
6+
* published by the Free Software Foundation, either version 3 of the
7+
* License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Affero General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Affero General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
type IProps = {
19+
className?: any;
20+
};
21+
22+
export default ({ className }: IProps) => (
23+
<svg width="69" height="64" viewBox="0 0 69 64" fill="none" xmlns="http://www.w3.org/2000/svg" className={className}>
24+
<ellipse id="selectionFill" strokeWidth="0" fill="#000000" visibility="hidden" cx="35.747791" cy="28.091486" rx="14.706719" ry="23.134165" />
25+
<path
26+
id="main"
27+
fill="currentColor"
28+
d="M 4.7423497,0.06085732 C 1.1279459,0.1822271 -1.1319948,4.0945447 0.62924934,7.2993732 L 30.435698,61.527356 c 1.857352,3.379836 6.712781,3.376189 8.564448,-0.0069 L 68.684827,7.292608 C 70.466875,4.0371175 68.113912,0.06086078 64.402603,0.06085732 H 4.9114742 c -0.058048,0 -0.1117517,-0.0019265 -0.1691245,0 z M 34.657038,7.5699719 c 0.819883,-4.849e-4 1.627024,0.1898642 2.360975,0.5547272 0.7336,0.3648274 1.373903,0.8958621 1.867129,1.5491776 2.032132,2.5301693 2.602639,6.8861863 1.542415,11.6695693 -1.337667,6.029609 -3.435633,13.211981 -5.770519,13.211981 -2.334888,0 -4.432679,-7.183328 -5.770517,-13.22551 -1.060192,-4.783384 -0.489578,-9.138479 1.542412,-11.6560403 0.491078,-0.6554976 1.126105,-1.1908726 1.860366,-1.5559424 0.734227,-0.3650698 1.547337,-0.551426 2.367739,-0.5479624 z m 0,31.4706291 c 0.540366,-0.0066 1.074352,0.09102 1.576237,0.290913 0.501885,0.2002 0.959338,0.49618 1.346229,0.87268 0.386545,0.376154 0.700256,0.823864 0.913271,1.319168 0.213015,0.495304 0.324891,1.030526 0.331472,1.569472 -3.46e-4,0.797336 -0.240967,1.57488 -0.683263,2.239204 -0.442303,0.66433 -1.069524,1.185407 -1.806245,1.495059 -0.736721,0.309305 -1.548528,0.398896 -2.333913,0.250319 -0.785454,-0.148245 -1.511414,-0.525438 -2.08361,-1.082395 -0.572162,-0.556957 -0.961727,-1.270462 -1.12975,-2.049786 -0.168022,-0.779671 -0.102739,-1.59165 0.189418,-2.333913 0.29216,-0.741917 0.792794,-1.382522 1.447703,-1.840072 0.654908,-0.457203 1.433269,-0.710529 2.232438,-0.730618 z"
29+
/>
30+
</svg>
31+
);

frontend/assets/icons/filled/ticket_pin-filled.svg.tsx renamed to frontend/assets/icons/filled/pin_ticket-filled.svg.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type IProps = {
2121

2222
export default ({ className }: IProps) => (
2323
<svg width="50" height="64" viewBox="0 0 50 64" fill="none" xmlns="http://www.w3.org/2000/svg" className={className}>
24-
<path id="selectionFill" stroke-width="0" d="M 7.3534566,14.021421 H 42.562804 V 26.360273 H 6.6056475 V 13.959104 Z" fill="0"/>
25-
<path fillRule="evenodd" clipRule="evenodd" d="M0 8C0 3.58172 3.58172 0 8 0H42C46.4183 0 50 3.58172 50 8V41C50 45.4183 46.4183 49 42 49H32L26 64L20 49H8C3.58172 49 0 45.4183 0 41V8ZM10.0002 14.5C10.0002 13.1193 11.1195 12 12.5002 12H37.5002C38.8809 12 40.0002 13.1193 40.0002 14.5C40.0002 15.8807 38.8809 17 37.5002 17H12.5002C11.1195 17 10.0002 15.8807 10.0002 14.5ZM16.0294 23.9999C14.6487 23.9999 13.5294 25.1192 13.5294 26.4999C13.5294 27.8806 14.6487 28.9999 16.0294 28.9999H33.9706C35.3513 28.9999 36.4706 27.8806 36.4706 26.4999C36.4706 25.1192 35.3513 23.9999 33.9706 23.9999H16.0294Z" fill="currentColor"/>
24+
<path id="selectionFill" stroke="black" strokeWidth="7" d="M 7.3534566,14.021421 H 42.562804 V 26.360273 H 6.6056475 V 13.959104 Z" fill="0" visibility="hidden"/>
25+
<path id="main" fillRule="evenodd" clipRule="evenodd" d="M0 8C0 3.58172 3.58172 0 8 0H42C46.4183 0 50 3.58172 50 8V41C50 45.4183 46.4183 49 42 49H32L26 64L20 49H8C3.58172 49 0 45.4183 0 41V8ZM10.0002 14.5C10.0002 13.1193 11.1195 12 12.5002 12H37.5002C38.8809 12 40.0002 13.1193 40.0002 14.5C40.0002 15.8807 38.8809 17 37.5002 17H12.5002C11.1195 17 10.0002 15.8807 10.0002 14.5ZM16.0294 23.9999C14.6487 23.9999 13.5294 25.1192 13.5294 26.4999C13.5294 27.8806 14.6487 28.9999 16.0294 28.9999H33.9706C35.3513 28.9999 36.4706 27.8806 36.4706 26.4999C36.4706 25.1192 35.3513 23.9999 33.9706 23.9999H16.0294Z" fill="currentColor"/>
2626
</svg>
2727
);

frontend/src/v4/services/viewer/viewer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ interface IViewerConstructor {
3939
name?: string;
4040
}
4141

42+
export type PinType = 'issue' | 'risk' | 'bookmark' | 'ticket' | null;
43+
4244
export interface IPin {
4345
id: string;
44-
type?: 'issue' | 'risk' | 'bookmark' | 'ticket' | null;
46+
type?: PinType
4547
position: number[];
4648
norm?: number[];
4749
colour: number[];

frontend/src/v5/store/tickets/card/ticketsCard.selectors.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { SequencingProperties, TicketsCardViews } from '@/v5/ui/routes/viewer/ti
2020
import { createSelector } from 'reselect';
2121
import { selectTemplateById, selectTemplates, selectTicketById, selectTickets } from '../tickets.selectors';
2222
import { ITicketsCardState } from './ticketsCard.redux';
23-
import { DEFAULT_PIN, getPinColorHex, formatPin, getTicketPins } from '@/v5/ui/routes/viewer/tickets/ticketsForm/properties/coordsProperty/coordsProperty.helpers';
23+
import { DEFAULT_PIN, getTicketPins, toPin } from '@/v5/ui/routes/viewer/tickets/ticketsForm/properties/coordsProperty/coordsProperty.helpers';
2424
import { IPin } from '@/v4/services/viewer/viewer';
2525
import { selectSelectedDate } from '@/v4/modules/sequences';
2626
import { ticketIsCompleted } from '@controls/chip/statusChip/statusChip.helpers';
@@ -176,9 +176,7 @@ export const selectTicketPins = createSelector(
176176
(accum, ticket) => {
177177
const pin = ticket.properties?.Pin;
178178
if (!pin) return accum;
179-
const template = templates.find(({ _id }) => _id === ticket.type);
180-
const color = getPinColorHex(DEFAULT_PIN, template, ticket);
181-
179+
182180
const { sequencing } = ticket.modules;
183181

184182
if (sequencing && selectedSequenceDate) {
@@ -189,8 +187,10 @@ export const selectTicketPins = createSelector(
189187
endDate && new Date(endDate) < new Date(selectedSequenceDate)
190188
) return accum;
191189
}
190+
191+
const template = templates.find(({ _id }) => _id === ticket.type);
192192
const isSelected = selectedTicketPinId === ticket._id;
193-
return [...accum, formatPin(ticket._id, pin, isSelected, color)];
193+
return [...accum, toPin(DEFAULT_PIN, template, ticket, isSelected)];
194194
},
195195
[],
196196
);

frontend/src/v5/store/tickets/tickets.selectors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const sortTicketsByCreationDate = (tickets: any[]) => orderBy(tickets, `p
2828

2929
const getTemplateDefaultStatus = (template: ITemplate) => template.properties?.find(({ name }) => name === BaseProperties.STATUS)?.default;
3030

31-
export const getTicketWithStatus = (ticket: ITicket, template: ITemplate) => {
31+
const getTicketWithStatus = (ticket: ITicket, template: ITemplate) => {
3232
if (ticket.properties[BaseProperties.STATUS] || !template) return ticket;
3333
return {
3434
...ticket,

frontend/src/v5/store/tickets/tickets.types.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,12 @@ export type IPinColorMapping = {
6969
]
7070
};
7171

72-
export type IPinSchema = {
73-
name: string;
74-
type: 'coords';
75-
color: RgbArray | IPinColorMapping;
72+
export type PinIcon = 'DEFAULT' | 'RISK' | 'ISSUE' | 'MARKER';
73+
74+
export type PinConfig = {
75+
name?: string;
76+
color?: RgbArray | IPinColorMapping;
77+
icon?: PinIcon;
7678
};
7779

7880
export type StatusValue = {
@@ -96,7 +98,7 @@ export interface ITemplate {
9698
comments?: boolean;
9799
defaultView?: boolean;
98100
issueProperties?: boolean;
99-
pin?: boolean | IPinSchema;
101+
pin?: boolean | PinConfig;
100102
status?: IStatusConfig;
101103
};
102104
}

frontend/src/v5/ui/components/viewer/drawingViewer/pinsLayer/pin2D/pin2D.component.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@
1616
*/
1717

1818
import { IPin } from '@/v4/services/viewer/viewer';
19-
import PinIcon from '@assets/icons/filled/ticket_pin-filled.svg';
2019
import { PinContainer } from './pin2D.styles';
2120
import { TicketsCardActionsDispatchers } from '@/v5/services/actionsDispatchers';
2221
import { TicketsHooksSelectors } from '@/v5/services/selectorsHooks';
2322
import { useParams } from 'react-router';
2423
import { ViewerParams } from '@/v5/ui/routes/routes.constants';
24+
import { Pin } from '@/v5/ui/routes/viewer/tickets/pin';
25+
import { pinTypeToPinIcon } from '@/v5/ui/routes/viewer/tickets/ticketsForm/properties/coordsProperty/coordsProperty.helpers';
2526

2627
type Pin2DProps = IPin & { scale: number };
27-
export const Pin2D = ({ id, isSelected, position, colour, scale }: Pin2DProps) => {
28+
export const Pin2D = ({ id, isSelected, position, colour, scale, type }: Pin2DProps) => {
2829
const { containerOrFederation } = useParams<ViewerParams>();
2930
const tickets = TicketsHooksSelectors.selectTickets(containerOrFederation);
3031

@@ -43,7 +44,7 @@ export const Pin2D = ({ id, isSelected, position, colour, scale }: Pin2DProps) =
4344
selected={isSelected}
4445
style={{ transform: `translate(${position[0]}px, ${position[1]}px) scale(${0.333 / scale})` }}
4546
>
46-
<PinIcon />
47+
<Pin pinIcon={pinTypeToPinIcon(type)} />
4748
</PinContainer>
4849
);
4950
};

frontend/src/v5/ui/components/viewer/drawingViewer/pinsLayer/pin2D/pin2D.styles.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,30 @@ const popupAnimation = keyframes`
4343

4444
export const PinContainer = styled.div<{ colour, selected?: boolean }>`
4545
position: absolute;
46-
color: rgb(${({ colour }) => colour.map((val) => Math.round(val * 256)).join()});
47-
46+
4847
svg {
4948
${({ selected }) => selected && css`
50-
transform-origin: bottom center;
51-
animation: ${popupAnimation} 1s forwards;
52-
53-
#selectionFill {
54-
stroke-width: 7px;
55-
}
49+
transform-origin: bottom center;
50+
animation: ${popupAnimation} 1s forwards;
51+
52+
#selectionFill {
53+
visibility: visible;
54+
}
5655
`}
5756
position: absolute;
58-
57+
5958
left: -25px;
6059
top: -64px;
60+
61+
#main {
62+
color: rgb(${({ colour }) => colour.map((val) => Math.round(val * 256)).join()});
63+
stroke: #000;
64+
stroke-width: 2%;
65+
}
6166
62-
stroke: #000;
63-
stroke-width: 2%;
6467
overflow: visible;
68+
69+
height: 64px;
70+
width: 64px;
6571
}
6672
`;

0 commit comments

Comments
 (0)