Skip to content

Commit

Permalink
✨ hide origin url for square exports
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Feb 5, 2025
1 parent 38bb577 commit 42afac7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
19 changes: 10 additions & 9 deletions adminSiteClient/EditorExportTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,16 @@ export class EditorExportTab<
}
/>
)}
{this.originalGrapher.originUrl && (
<Toggle
label="Origin URL"
value={!this.settings.hideOriginUrl}
onValue={(value) =>
(this.settings.hideOriginUrl = !value)
}
/>
)}
{this.originalGrapher.originUrl &&
!this.grapher.isStaticAndSmall && (
<Toggle
label="Origin URL"
value={!this.settings.hideOriginUrl}
onValue={(value) =>
(this.settings.hideOriginUrl = !value)
}
/>
)}
{this.originalGrapher.detailsOrderedByReference.length >
0 && (
<Toggle
Expand Down
12 changes: 10 additions & 2 deletions packages/@ourworldindata/grapher/src/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ export class Footer<
return this.manager.fontSize ?? BASE_FONT_SIZE
}

@computed protected get hideOriginUrl(): boolean {
return !!this.manager.hideOriginUrl
}

@computed protected get sourcesLine(): string {
return this.manager.sourcesLine?.replace(/\r\n|\n|\r/g, "") ?? ""
}
Expand Down Expand Up @@ -158,7 +162,7 @@ export class Footer<
actionButtons,
} = this

if (this.manager.hideOriginUrl) return undefined
if (this.hideOriginUrl) return undefined

if (!correctedUrlText) return undefined

Expand Down Expand Up @@ -640,6 +644,10 @@ export class StaticFooter extends Footer<StaticFooterProps> {
// eslint-disable-next-line @typescript-eslint/no-empty-function
componentWillUnmount(): void {}

@computed protected get hideOriginUrl(): boolean {
return !!this.manager.hideOriginUrl || !!this.manager.isStaticAndSmall
}

@computed private get textColor(): string {
return GRAPHER_LIGHT_TEXT
}
Expand All @@ -654,7 +662,7 @@ export class StaticFooter extends Footer<StaticFooterProps> {
@computed protected get finalUrlText(): string | undefined {
const { correctedUrlText, licenseText, fontSize, maxWidth } = this

if (this.manager.hideOriginUrl) return undefined
if (this.hideOriginUrl) return undefined

if (!correctedUrlText) return undefined

Expand Down

0 comments on commit 42afac7

Please sign in to comment.