Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rc #1541

Merged
merged 17 commits into from
Nov 23, 2024
Merged

Rc #1541

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ https://user-images.githubusercontent.com/307298/157185793-f67511cd-7b7b-4229-95

Set up Rowy on your Google Cloud Platform project with this easy deploy button.
Your data and cloud functions stay on your own Firestore/GCP and is managed via
a cloud run instance that operates exclusively on your GCP project. So we do do
a cloud run instance that operates exclusively on your GCP project. So we do
not access or store any of your data on Rowy.

[<img width="200" alt="Guided quick start button" src="https://user-images.githubusercontent.com/307298/185548050-e9208fb6-fe53-4c84-bbfa-53c08e03c15f.png">](https://rowy.app/)
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"file-saver": "^2.0.5",
"firebase": "^9.12.1",
"firebaseui": "^6.0.1",
"fuse.js": "^7.0.0",
"jotai": "^1.8.4",
"json-stable-stringify-without-jsonify": "^1.0.1",
"jszip": "^3.10.0",
Expand Down
12 changes: 1 addition & 11 deletions src/atoms/tableScope/rowActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,7 @@ export const updateFieldAtom = atom(
);

if (!row) throw new Error("Could not find row");
const isLocalRow =
fieldName.startsWith("_rowy_formulaValue_") ||
Boolean(find(tableRowsLocal, ["_rowy_ref.path", path]));
const isLocalRow = Boolean(find(tableRowsLocal, ["_rowy_ref.path", path]));

const update: Partial<TableRow> = {};

Expand Down Expand Up @@ -469,14 +467,6 @@ export const updateFieldAtom = atom(
deleteFields: deleteField ? [fieldName] : [],
});

// TODO(han): Formula field persistence
// const config = find(tableColumnsOrdered, (c) => {
// const [, key] = fieldName.split("_rowy_formulaValue_");
// return c.key === key;
// });
// if(!config.persist) return;
if (fieldName.startsWith("_rowy_formulaValue")) return;

// If it has no missingRequiredFields, also write to db
// And write entire row to handle the case where it doesn’t exist in db yet
if (missingRequiredFields.length === 0) {
Expand Down
23 changes: 23 additions & 0 deletions src/components/ColumnModals/FieldsDropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import MultiSelect from "@rowy/multiselect";
import { Box, ListItemIcon, Typography } from "@mui/material";
import Fuse from 'fuse.js';

import { FIELDS } from "@src/components/fields";
import { FieldType } from "@src/constants/fields";
Expand All @@ -23,6 +24,15 @@ export interface IFieldsDropdownProps {
[key: string]: any;
}

export interface OptionsType {
label: string;
value: string;
disabled: boolean;
requireCloudFunctionSetup: boolean;
requireCollectionTable: boolean;
keywords: string[];
}

/**
* Returns dropdown component of all available types
*/
Expand Down Expand Up @@ -52,9 +62,21 @@ export default function FieldsDropdown({
disabled: requireCloudFunctionSetup || requireCollectionTable,
requireCloudFunctionSetup,
requireCollectionTable,
keywords: fieldConfig.keywords || []
};
});

const filterOptions = (options: OptionsType[], inputConfig: any) => {
const fuse = new Fuse(options, {
keys: [{name:'label', weight: 2}, 'keywords'],
includeScore: true,
threshold: 0.4,
});

const results = fuse.search(inputConfig?.inputValue);
return results.length > 0 ? results.map((result) => result.item) : options;
}

return (
<MultiSelect
multiple={false}
Expand All @@ -80,6 +102,7 @@ export default function FieldsDropdown({
},
},
},
filterOptions
},
} as any)}
itemRenderer={(option) => (
Expand Down
3 changes: 3 additions & 0 deletions src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export default function Table({
const [tablePage, setTablePage] = useAtom(tablePageAtom, tableScope);
const setReactTable = useSetAtom(reactTableAtom, tableScope);

const setSelectedCell = useSetAtom(selectedCellAtom, tableScope);
const updateColumn = useSetAtom(updateColumnAtom, tableScope);

// Get user settings and tableId for applying sort sorting
Expand Down Expand Up @@ -313,6 +314,8 @@ export default function Table({

const { scrollHeight, scrollTop, clientHeight } = containerElement;
if (scrollHeight - scrollTop - clientHeight < 300) {
// deselect cell on next page load
setSelectedCell(null);
setTablePage((p) => p + 1);
}
},
Expand Down
Loading