Skip to content

Commit

Permalink
chore: improve displaymodel types
Browse files Browse the repository at this point in the history
  • Loading branch information
simonadomnisoru committed Oct 11, 2023
1 parent fa263d7 commit 0282008
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
10 changes: 5 additions & 5 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2023-09-04T07:07:59.195Z\n"
"PO-Revision-Date: 2023-09-04T07:07:59.195Z\n"
"POT-Creation-Date: 2023-10-11T07:28:55.943Z\n"
"PO-Revision-Date: 2023-10-11T07:28:55.943Z\n"

msgid "Choose one or more dates..."
msgstr "Choose one or more dates..."
Expand Down Expand Up @@ -1083,12 +1083,12 @@ msgstr "To work with the selected program,"
msgid "open the Tracker Capture app"
msgstr "open the Tracker Capture app"

msgid "Assign"
msgstr "Assign"

msgid "Event assigned to {{name}}"
msgstr "Event assigned to {{name}}"

msgid "Assign"
msgstr "Assign"

msgid "No one is assigned to this event"
msgstr "No one is assigned to this event"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,19 @@ type Props = {
...CssClasses,
};

const DisplayModePlain = ({ assignee, onEdit, classes }: Props) => {
const renderNoAssigned = () => (
<>
<Button onClick={onEdit} small>
{i18n.t('Assign')}
</Button>
</>
);
const renderAssigned = () => (
const DisplayModePlain = ({ assignee, onEdit, classes }: Props) => (
assignee ? (
<div className={classes.wrapper}>
{i18n.t('Event assigned to {{name}}', { name: assignee?.name })}
{i18n.t('Event assigned to {{name}}', { name: assignee.name })}
<Button onClick={onEdit} className={classes.editButton} dataTest="widget-assignee-edit">
<IconEdit24 />
</Button>
</div>
);

return assignee ? renderAssigned() : renderNoAssigned();
};
) : (
<Button onClick={onEdit} small>
{i18n.t('Assign')}
</Button>
)
);

export const DisplayMode = withStyles(styles)(DisplayModePlain);

0 comments on commit 0282008

Please sign in to comment.