Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

fix: OPTIC-108: Text on grid view should be truncated #295

Merged
merged 7 commits into from
Jan 31, 2024

Conversation

yyassi-heartex
Copy link
Contributor

PR fulfills these requirements

  • Commit message(s) and PR title follows the format [fix|feat|ci|chore|doc]: TICKET-ID: Short description of change made ex. fix: DEV-XXXX: Removed inconsistent code usage causing intermittent errors
  • Tests for the changes have been added/updated (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • Best efforts were made to ensure docs/code are concise and coherent (checked for spelling/grammatical errors, commented out code, debug logs etc.)
  • Self-reviewed and ran all changes on a local instance (for bug fixes/features)

Change has impacts in these area(s)

(check all that apply)

  • Product design
  • Frontend

Describe the reason for change

minor visual tweak to truncate text in grid view. will show a tooltip on hover to show more info about truncated text

</div>
<Tooltip title={output}>
<div
style={{ padding: 5, height: TextDataGroup.height, overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis" }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move it to const as well

const valueToString = (value) => {
if (typeof value === "string") return value;

try {
return JSON.stringify(value);
} catch {
return value.toString();
return (value ?? "").toString();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what kind of value could be here? it won't fail on null or undefined and that's the only values triggering nullish coalescing.

Copy link
Contributor Author

@yyassi-heartex yyassi-heartex Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it could be any non-JSON value - in this case null and undefined should render as "", while 0 and false should render as "0" and "false", every thing else should render as what ever it is, be it string, int, etc

@yyassi-heartex yyassi-heartex merged commit 67ec3f1 into master Jan 31, 2024
5 checks passed
@yyassi-heartex yyassi-heartex deleted the fb-optic-108/text-truncate branch January 31, 2024 15:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants