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

Commit

Permalink
Merge branch 'master' into fb-optic-108/text-truncate
Browse files Browse the repository at this point in the history
  • Loading branch information
yyassi-heartex committed Jan 30, 2024
2 parents 99dc78b + 0df716f commit 6e8c048
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 25 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/git-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: hmarr/[email protected]

- name: Add Workflow link to command comment
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
echo "merge_conflict=$(git merge-tree $(git merge-base HEAD origin/$SLASH_COMMAND_ARG_BRANCH) origin/$SLASH_COMMAND_ARG_BRANCH HEAD | grep '<<')" >> $GITHUB_OUTPUT
- name: Add reaction to command comment on merge conflict
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
if: ${{ steps.check-conflict.outputs.merge_conflict }}
with:
token: ${{ secrets.GIT_PAT }}
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Add reaction to command comment on nothing to do
if: ${{ !steps.check-conflict.outputs.merge_conflict && steps.commit_and_push.outputs.changes == 'no' }}
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
Expand All @@ -92,7 +92,7 @@ jobs:

- name: Add reaction to command comment on success
if: ${{ !steps.check-conflict.outputs.merge_conflict && steps.commit_and_push.outputs.changes == 'yes' }}
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
Expand All @@ -103,7 +103,7 @@ jobs:
reactions: "+1"

- name: Add reaction to command comment on failure
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
if: failure()
with:
token: ${{ secrets.GIT_PAT }}
Expand All @@ -119,7 +119,7 @@ jobs:
timeout-minutes: 1
steps:
- name: Update comment
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/help-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- name: Update comment if empty
if: ${{ github.event.client_payload.slash_command.args.all == '' }}
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/jira-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: hmarr/[email protected]

- name: Add Workflow link to command comment
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
type: ${{ github.event.client_payload.slash_command.args.unnamed.arg2 || 'task' }}

- name: Add reaction to command comment on success
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
Expand All @@ -74,7 +74,7 @@ jobs:
reactions: "+1"

- name: Add reaction to command comment on failure
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
if: failure()
with:
token: ${{ secrets.GIT_PAT }}
Expand All @@ -91,7 +91,7 @@ jobs:
timeout-minutes: 1
steps:
- name: Update comment
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/slash-command-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:

- name: Edit comment with error message
if: ${{ steps.determine_command.outputs.command_state == 'unknown' }}
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ github.event.comment.id }}
body: |
Expand Down
4 changes: 2 additions & 2 deletions src/components/CellViews/DateTimeCell.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { format, isValid } from "date-fns";
export const dateTimeFormat = "MMM dd yyyy, HH:mm:ss";

export const DateTimeCell = (column) => {
const date = new Date(column.value);
const dateFormat = "MMM dd yyyy, HH:mm:ss";

return column.value ? (
<div style={{ whiteSpace: "nowrap" }}>
{isValid(date) ? format(date, dateFormat) : ""}
{isValid(date) ? format(date, dateTimeFormat) : ""}
</div>
) : (
""
Expand Down
29 changes: 18 additions & 11 deletions src/components/CellViews/StringCell.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
const valueToString = (value) => {
import { format, isValid } from "date-fns";
import { dateTimeFormat } from "./DateTimeCell";

export const valueToString = (value) => {
if (typeof value === "string") return value;
/* if undefined or null we'll treat it as empty string */
if (value === undefined || value === null) return "";
if (value instanceof Date && isValid(value)) return format(value, dateTimeFormat);

try {
/* JSON.stringify will handle JSON and non-strings, non-null, non-undefined */
return JSON.stringify(value);
} catch {
return value.toString();
return 'Error: Invalid JSON';
}
};

export const StringCell = ({ value }) => {
const style = {
maxHeight: "100%",
overflow: "hidden",
fontSize: 12,
lineHeight: "16px",
};

return (
<div
style={{
maxHeight: "100%",
overflow: "hidden",
fontSize: 12,
lineHeight: "16px",
}}
>
{value ? valueToString(value) : ""}
<div style={style}>
{valueToString(value)}
</div>
);
};

0 comments on commit 6e8c048

Please sign in to comment.