-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from dolthub/taylor/fixes-2
Misc fixes
- Loading branch information
Showing
12 changed files
with
141 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import Button from "@components/Button"; | ||
import { serializeCellValue } from "@components/pageComponents/FileUploadPage/Steps/Upload/EditableTable/TableGrid/utils"; | ||
import { | ||
ColumnForDataTableFragment, | ||
RowForDataTableFragment, | ||
} from "@gen/graphql-types"; | ||
import useDelay from "@hooks/useDelay"; | ||
import { getBitDisplayValue } from "@lib/dataTable"; | ||
import CopyToClipboard from "react-copy-to-clipboard"; | ||
import css from "./index.module.css"; | ||
|
||
type Props = { | ||
row: RowForDataTableFragment; | ||
columns: ColumnForDataTableFragment[]; | ||
disabled?: boolean; | ||
}; | ||
|
||
export default function CopyRowButton({ | ||
row, | ||
columns, | ||
disabled, | ||
}: Props): JSX.Element { | ||
const success = useDelay(); | ||
const copyVal = getCopyVal(row, columns); | ||
return ( | ||
<CopyToClipboard onCopy={success.start} text={copyVal}> | ||
<Button.Link | ||
className={css.button} | ||
data-cy="copy-row-button" | ||
disabled={disabled} | ||
> | ||
{success.active ? "Copied" : "Copy row"} | ||
</Button.Link> | ||
</CopyToClipboard> | ||
); | ||
} | ||
|
||
function getCopyVal( | ||
row: RowForDataTableFragment, | ||
columns: ColumnForDataTableFragment[], | ||
): string { | ||
return row.columnValues | ||
.map((c, cidx) => { | ||
const colType = columns[cidx].type; | ||
const value = c.displayValue; | ||
return colType === "bit(1)" | ||
? getBitDisplayValue(value) | ||
: serializeCellValue(value); | ||
}) | ||
.join(","); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,3 +45,7 @@ | |
.noChanges { | ||
@apply mx-3 mt-4 mb-8 lg:mb-16; | ||
} | ||
|
||
.tableButton { | ||
@apply leading-5; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
web/components/pageComponents/DatabasePage/ForReleases/ReleaseList/useTagList.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters