Skip to content

Commit

Permalink
refactor: update localization strings for pending announcements and a…
Browse files Browse the repository at this point in the history
…ctions
  • Loading branch information
a-ng-d committed Sep 1, 2024
1 parent 8dc9341 commit d26c549
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 53 deletions.
9 changes: 7 additions & 2 deletions src/content/locals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,13 @@ export const locals: { [key: string]: any } = {
statusUptoDate: 'No change',
statusUnpublished: 'Unpublished',
statusRemoteChanges: 'Remote changes',
statusWaiting: 'Waiting…',
statusWaiting: 'Pending…',
statusNotFound: 'Not found',
publish: 'Publish…',
unpublish: 'Unpublish',
synchronize: 'Synchronize…',
revert: 'Revert',
detach: 'Detach',
waiting: 'Waiting…',
signIn: 'Sign in to publish',
},
relaunch: {
Expand Down Expand Up @@ -456,6 +455,11 @@ export const locals: { [key: string]: any } = {
'A top analytics platform for tracking and understanding user interactions',
},
},
pending: {
announcements: 'Pending announcements…',
primaryAction: '………',
secondaryAction: '………',
},
success: {
publication: '✓ The palette has been published',
nonPublication: '✓ The palette has been unpublished',
Expand Down Expand Up @@ -511,6 +515,7 @@ export const locals: { [key: string]: any } = {
addToFile: '✕ The palette cannot be added',
noInternetConnection:
'✕ The connection with the remote palette is unlinked',
announcements: 'The announcements cannot be loaded',
},
},
}
74 changes: 44 additions & 30 deletions src/ui/modules/Highlight.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Dialog, Icon, texts } from '@a_ng_d/figmug-ui'
import { Dialog, Icon, Message, texts } from '@a_ng_d/figmug-ui'
import React from 'react'

import { locals } from '../../content/locals'
import { Language } from '../../types/app'
import { HighlightDigest, Language } from '../../types/app'
import { announcementsWorkerUrl } from '../../utils/config'

interface HighlightProps {
highlight: HighlightDigest
lang: Language
onCloseHighlight: React.ReactEventHandler
}
Expand Down Expand Up @@ -41,15 +42,6 @@ export default class Highlight extends React.Component<
})
})
.catch(() => {
parent.postMessage(
{
pluginMessage: {
type: 'SEND_MESSAGE',
message: 'Nope',
},
},
'*'
)
this.setState({ status: 'ERROR' })
})
}
Expand All @@ -67,28 +59,37 @@ export default class Highlight extends React.Component<
if (this.state.status === 'LOADING')
return (
<Dialog
title="Loading..."
title={locals[this.props.lang].pending.announcements}
actions={{
primary: {
label: locals[this.props.lang].publication.waiting,
state: 'DISABLED',
action: () => null,
},
secondary: {
label: locals[this.props.lang].publication.waiting,
state: 'DISABLED',
action: () => null,
},
primary: undefined,
secondary: undefined,
}}
onClose={(e) => {
this.props.onCloseHighlight(e)
this.setState({ position: 0 })
onClose={this.props.onCloseHighlight}
>
<div className="onboarding__callout--centered">
<Icon
type="PICTO"
iconName="spinner"
/>
</div>
</Dialog>
)
else if (this.state.status === 'ERROR')
return (
<Dialog
title={locals[this.props.lang].error.generic}
actions={{
primary: undefined,
secondary: undefined,
}}
onClose={this.props.onCloseHighlight}
>
<Icon
type="PICTO"
iconName="spinner"
/>
<div className="onboarding__callout--centered">
<Message
icon="warning"
messages={[locals[this.props.lang].error.announcements]}
/>
</div>
</Dialog>
)
else
Expand Down Expand Up @@ -122,8 +123,21 @@ export default class Highlight extends React.Component<
: undefined
}
onClose={(e) => {
parent.postMessage(
{
pluginMessage: {
type: 'SET_ITEMS',
items: [
{
key: 'highlight_version',
value: this.props.highlight.version,
},
],
},
},
'*'
)
this.props.onCloseHighlight(e)
this.setState({ position: 0 })
}}
>
<div className="dialog__cover">
Expand Down
20 changes: 2 additions & 18 deletions src/ui/modules/PriorityContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,24 +291,8 @@ export default class PriorityContainer extends React.Component<
}
>
<Highlight
lang={this.props.lang}
onCloseHighlight={() => {
parent.postMessage(
{
pluginMessage: {
type: 'SET_ITEMS',
items: [
{
key: 'highlight_version',
value: this.props.highlight.version,
},
],
},
},
'*'
)
this.props.onClose()
}}
{...this.props}
onCloseHighlight={this.props.onClose}
/>
</Feature>
)
Expand Down
4 changes: 2 additions & 2 deletions src/ui/modules/Publication.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -779,12 +779,12 @@ export default class Publication extends React.Component<
},
WAITING: {
primary: {
label: locals[this.props.lang].publication.waiting,
label: locals[this.props.lang].pending.primaryAction,
state: 'DISABLED',
action: () => null,
},
secondary: {
label: locals[this.props.lang].publication.waiting,
label: locals[this.props.lang].pending.secondaryAction,
state: 'DISABLED',
action: () => null,
},
Expand Down
2 changes: 1 addition & 1 deletion src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const authWorkerUrl =
: (process.env.REACT_APP_AUTH_WORKER_URL as string)
export const announcementsWorkerUrl =
process.env.NODE_ENV === 'development'
? 'http://localhost:8787'
? 'http://localhost:8888'
: (process.env.REACT_APP_ANNOUNCEMENTS_WORKER_URL as string)
export const databaseUrl = process.env.REACT_APP_SUPABASE_URL as string
export const authUrl =
Expand Down

0 comments on commit d26c549

Please sign in to comment.