Skip to content

Commit

Permalink
Ntrfcs 207 (#303)
Browse files Browse the repository at this point in the history
* added showLegendAlwaysOpenForDesktop

* test fixes

* small change

* small change

* format chjanges

* added changeset

* added openLegendInitially flag

* added change log

* updated test cases

* lint changes
  • Loading branch information
SrujanaSaka20 authored Jan 27, 2025
1 parent ac70595 commit 67229cf
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/funny-islands-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ticketevolution/seatmaps-client": patch
---

Added openLegendInitially flag
5 changes: 5 additions & 0 deletions .changeset/light-suns-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ticketevolution/seatmaps-client": minor
---

Added showLegendOpenAlwaysForDesktop flag to always display the map legend on desktop when this flag is set to true.
3 changes: 3 additions & 0 deletions packages/seatmaps-client/src/Actions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface Props {
interface DefaultProps {
showLegend: boolean;
showLegendOpenAlwaysForDesktop: boolean;
openLegendInitially: boolean;
showControls: boolean;
onClearSelection(): void;
}
Expand All @@ -46,6 +47,7 @@ export default class Actions extends React.Component<
showLegend: true,
showLegendOpenAlwaysForDesktop: false,
showControls: true,
openLegendInitially: false,
onClearSelection: () => {},
};

Expand Down Expand Up @@ -175,6 +177,7 @@ export default class Actions extends React.Component<
showLegendOpenAlwaysForDesktop={
this.props.showLegendOpenAlwaysForDesktop
}
openLegendInitially={this.props.openLegendInitially}
/>
</ActionGroup>
)}
Expand Down
4 changes: 3 additions & 1 deletion packages/seatmaps-client/src/Legend/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface Props {
ranges: Range[];
isMobile?: boolean;
showLegendOpenAlwaysForDesktop?: boolean;
openLegendInitially?: boolean;
}

interface State {
Expand All @@ -31,10 +32,11 @@ export default class Legend extends Component<Props, State> {
static defaultProps = {
isMobile: false,
showLegendOpenAlwaysForDesktop: false,
openLegendInitially: false,
};

state = {
isOpen: false,
isOpen: this.props.openLegendInitially || false,
};

render() {
Expand Down
2 changes: 2 additions & 0 deletions packages/seatmaps-client/src/TicketMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export class TicketMap extends Component<Props & DefaultProps, State> {
showLegend: true,
showLegendOpenAlwaysForDesktop: false,
showControls: true,
openLegendInitially: false,
mouseControlEnabled: true,
showZoomHelper: true,
mapFontFamily: "inherit",
Expand Down Expand Up @@ -673,6 +674,7 @@ export class TicketMap extends Component<Props & DefaultProps, State> {
this.props.showLegendOpenAlwaysForDesktop
}
showControls={this.props.showControls}
openLegendInitially={this.props.openLegendInitially}
onZoomIn={this.handleZoomIn}
onZoomOut={this.handleZoomOut}
onResetZoom={this.handleResetZoom}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports[`Actions when controls are visible on desktop browsers matches snapshot
onResetZoom={[MockFunction]}
onZoomIn={[MockFunction]}
onZoomOut={[MockFunction]}
openLegendInitially={false}
ranges={[]}
showControls={true}
showLegend={true}
Expand Down Expand Up @@ -251,6 +252,7 @@ exports[`Actions when controls are visible on desktop browsers matches snapshot
>
<Legend
isMobile={false}
openLegendInitially={false}
ranges={[]}
showLegendOpenAlwaysForDesktop={false}
>
Expand Down Expand Up @@ -313,6 +315,7 @@ exports[`Actions when controls are visible on mobile browsers matches snapshot 1
onResetZoom={[MockFunction]}
onZoomIn={[MockFunction]}
onZoomOut={[MockFunction]}
openLegendInitially={false}
ranges={[]}
showControls={true}
showLegend={true}
Expand Down Expand Up @@ -558,6 +561,7 @@ exports[`Actions when controls are visible on mobile browsers matches snapshot 1
>
<Legend
isMobile={false}
openLegendInitially={false}
ranges={[]}
showLegendOpenAlwaysForDesktop={false}
>
Expand Down
1 change: 1 addition & 0 deletions packages/seatmaps-client/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const optionalConfigKeys: (keyof DefaultProps)[] = [
"showControls",
"showLegendOpenAlwaysForDesktop",
"showLegend",
"openLegendInitially",
"mouseControlEnabled",
"showZoomHelper",
];
Expand Down
1 change: 1 addition & 0 deletions packages/seatmaps-client/src/types/TicketMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface DefaultProps {
onSelection(sections: string[]): void;
showControls: boolean;
showLegendOpenAlwaysForDesktop: boolean;
openLegendInitially: boolean;
mouseControlEnabled: boolean;
showZoomHelper: boolean;
missingSeatMapLogo?: React.ReactNode;
Expand Down

0 comments on commit 67229cf

Please sign in to comment.