mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
export image/ file with JSON
This commit is contained in:
@@ -34,6 +34,7 @@ export default function Cell({
|
||||
const tableCell = type ? getFieldProp("TableCell", type) : null;
|
||||
const { checkAndConvert } = useConverter();
|
||||
const value = checkAndConvert(value_, type);
|
||||
|
||||
return (
|
||||
<StyledTable>
|
||||
<StyledCell
|
||||
|
||||
@@ -33,6 +33,21 @@ const selectedColumnsJsonReducer =
|
||||
(doc: TableRow) =>
|
||||
(accumulator: Record<string, any>, currentColumn: ColumnConfig) => {
|
||||
const value = get(doc, currentColumn.key);
|
||||
|
||||
if (
|
||||
currentColumn.type === FieldType.file ||
|
||||
currentColumn.type === FieldType.image
|
||||
) {
|
||||
return {
|
||||
...accumulator,
|
||||
[currentColumn.key]: value
|
||||
? value
|
||||
.map((item: { downloadURL: string }) => item.downloadURL)
|
||||
.join()
|
||||
: "",
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
...accumulator,
|
||||
[currentColumn.key]: value,
|
||||
|
||||
@@ -16,8 +16,9 @@ export default function useConverter() {
|
||||
return doc(firebaseDb, value);
|
||||
};
|
||||
|
||||
const imageOrFileConverter = (urls: string): RowyFile[] => {
|
||||
const imageOrFileConverter = (urls: any): RowyFile[] => {
|
||||
if (!urls) return [];
|
||||
if (Array.isArray(urls)) return urls;
|
||||
if (typeof urls === "string") {
|
||||
return urls
|
||||
.split(",")
|
||||
|
||||
Reference in New Issue
Block a user