Skip to content

Commit de93e35

Browse files
committed
chore: update
1 parent 45da459 commit de93e35

14 files changed

+3003
-2980
lines changed

frontend/Settings.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function Divider() {
3636
function getNewSummaries(
3737
summaries: Summary[],
3838
updatedSummary: Summary,
39-
field: Field | null
39+
field: Field | null,
4040
) {
4141
const isNew = !updatedSummary.fieldId;
4242

@@ -79,7 +79,7 @@ export default function Settings() {
7979
};
8080

8181
const canEdit = globalConfig.checkPermissionsForSet(
82-
GlobalConfigKeys.Summaries
82+
GlobalConfigKeys.Summaries,
8383
).hasPermission;
8484

8585
const onChangeAggregator = (summary: Summary, aggregatorKey: string) => {
@@ -119,7 +119,7 @@ export default function Settings() {
119119
summary.fieldId,
120120
table?.getFieldByIdIfExists(summary.fieldId || ""),
121121
];
122-
})
122+
}),
123123
);
124124

125125
const allSummaries = canEdit
@@ -241,7 +241,7 @@ function getSummaryDisplayName(summary: Summary, field: Field | null) {
241241

242242
if (field) {
243243
const aggregator = field.availableAggregators.find(
244-
(x) => x.key === summary.summary
244+
(x) => x.key === summary.summary,
245245
);
246246
if (!aggregator) return field.name;
247247
return `${field.name} (${aggregator.displayName})`;
@@ -276,7 +276,7 @@ function SummaryEditorWithoutRef(
276276
dragHandleProps,
277277
...divProps
278278
}: SummmaryEditorProps,
279-
ref: React.Ref<HTMLDivElement>
279+
ref: React.Ref<HTMLDivElement>,
280280
) {
281281
const [isExpanded, setIsExpanded] = React.useState(false);
282282

frontend/airtable.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ declare module "@airtable/blocks/ui" {
88
*/
99
export function useRecords(
1010
tableOrViewOrQueryResult: View | null,
11-
opts?: { fields: string[] }
11+
opts?: { fields: string[] },
1212
): Array<Record> | null;
1313
}

frontend/components/Canvas/SummaryTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default function SummaryTable({
9191
>
9292
{value}
9393
</Cell>
94-
) : null
94+
) : null,
9595
)}
9696
</Row>
9797
);

frontend/components/Canvas/utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function transposeTable<T>(table: T[][]): T[][] {
1212

1313
export function convertGroupedDataToTable(
1414
groupedData: GroupedData,
15-
{ transpose = false }: { transpose?: boolean } = {}
15+
{ transpose = false }: { transpose?: boolean } = {},
1616
): {
1717
value: string | number | undefined;
1818
id: string;

frontend/constants.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ export const dateTypes = [
1414
FieldType.LAST_MODIFIED_TIME,
1515
];
1616

17-
export const discreteTypes = [FieldType.SINGLE_LINE_TEXT, FieldType.FORMULA];
17+
export const discreteTypes = [
18+
FieldType.SINGLE_LINE_TEXT,
19+
FieldType.FORMULA,
20+
FieldType.SINGLE_SELECT,
21+
];
1822

1923
export const allowedTypes = [
2024
...dateTypes,

frontend/hooks/useAdaptiveSettingsButton.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function useAdaptiveSettingsButton() {
1010
const viewport = useViewport();
1111

1212
const [isShowingSettings, setIsShowingSettings] = React.useState(
13-
viewport.isFullscreen
13+
viewport.isFullscreen,
1414
);
1515
React.useEffect(() => {
1616
const onViewportChange = (viewport: Viewport) => {

frontend/hooks/useSummaryTableConfig.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ export function useSummaryTableConfig() {
1717
const source = table?.getViewByIdIfExists(viewId);
1818

1919
const groupFieldId = globalConfig.get(
20-
GlobalConfigKeys.GroupFieldID
20+
GlobalConfigKeys.GroupFieldID,
2121
) as string;
2222
const groupField = table?.getFieldByIdIfExists(groupFieldId);
2323

2424
const summaries = (globalConfig.get(GlobalConfigKeys.Summaries) ||
2525
[]) as Summary[];
2626

2727
const validSummaries = summaries.filter((x) =>
28-
Boolean(x.fieldId)
28+
Boolean(x.fieldId),
2929
) as (Summary & {
3030
fieldId: string;
3131
})[];

frontend/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function SummaryTableApp() {
2222
const data = getGroupedData(
2323
records,
2424
config.groupField,
25-
config.summariesWithFields
25+
config.summariesWithFields,
2626
);
2727

2828
const isEmpty = data.columns.length === 0 || data.rows.length === 0;

frontend/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Field } from "@airtable/blocks/models";
2+
23
export type Summary = {
34
id: string | null;
45
fieldId: string | null;

frontend/utils.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export type GrouperConfig = {
3434
};
3535

3636
function getFieldGrouper(
37-
groupBy: GrouperConfig
37+
groupBy: GrouperConfig,
3838
):
3939
| ((fieldValue: string) => string | number)
4040
| ((fieldValue: { value: string }[]) => string | number) {
@@ -52,10 +52,15 @@ function getFieldGrouper(
5252
throw new Error(`Unsupported field type: ${groupBy.field.type}`);
5353
}
5454

55-
type RecordValue = string | { value: string } | { value: { name: string } };
55+
type RecordValue =
56+
| string
57+
| { name: string }
58+
| { value: string }
59+
| { value: { name: string } };
5660

5761
function normalizeValue(value: RecordValue): string {
5862
if (typeof value === "string") return value;
63+
if ("name" in value) return value.name;
5964
if (value?.value) {
6065
if (typeof value.value === "string") return value.value;
6166
if (value.value.name) return value.value.name;
@@ -66,17 +71,18 @@ function normalizeValue(value: RecordValue): string {
6671

6772
export function groupRecords(
6873
records: AirtableRecord[],
69-
groupByConfig: GrouperConfig
70-
): Record<string, any[]> {
74+
groupByConfig: GrouperConfig,
75+
): Record<string, unknown[]> {
7176
const fieldGrouper = getFieldGrouper(groupByConfig);
7277

7378
console.log(
7479
groupByConfig.field.name,
75-
records[0].getCellValue(groupByConfig.field.name)
80+
records[0].getCellValue(groupByConfig.field.name),
7681
);
7782

7883
return groupBy(records, (record) => {
7984
const value = record.getCellValue(groupByConfig.field.name) as RecordValue;
85+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
8086
return fieldGrouper(normalizeValue(value) as any);
8187
});
8288
}
@@ -105,7 +111,7 @@ function normalizeDisplayValue(value: string | number) {
105111
export function getGroupedData(
106112
records: AirtableRecord[] | null,
107113
groupField: Field | null | undefined,
108-
summariesWithFields: SummaryWithField[]
114+
summariesWithFields: SummaryWithField[],
109115
): {
110116
columns: string[];
111117
rows: {

package.json

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -23,48 +23,47 @@
2323
]
2424
},
2525
"dependencies": {
26-
"@airtable/blocks": "1.16.0",
27-
"react": "^16.9.0",
26+
"@airtable/blocks": "1.18.0",
27+
"react": "^16.14.0",
2828
"react-beautiful-dnd": "^13.1.1",
29-
"react-dom": "^16.9.0",
30-
"uuid": "^9.0.0"
29+
"react-dom": "^16.14.0",
30+
"uuid": "^9.0.1"
3131
},
3232
"devDependencies": {
3333
"@airtable/blocks-testing": "^0.0.5",
34-
"@commitlint/cli": "^17.3.0",
35-
"@commitlint/config-conventional": "^17.3.0",
36-
"@semantic-release/changelog": "^6.0.1",
34+
"@commitlint/cli": "^18.4.3",
35+
"@commitlint/config-conventional": "^18.4.3",
36+
"@semantic-release/changelog": "^6.0.3",
3737
"@semantic-release/git": "^10.0.1",
38-
"@testing-library/dom": "^7.21.4",
39-
"@testing-library/jest-dom": "^5.16.5",
40-
"@testing-library/react": "^12.0.0",
41-
"@testing-library/user-event": "^12.0.0",
38+
"@testing-library/dom": "^9.3.3",
39+
"@testing-library/jest-dom": "^6.1.4",
40+
"@testing-library/react": "^14.1.2",
41+
"@testing-library/user-event": "^14.5.1",
4242
"@tsconfig/create-react-app": "^1.0.3",
43-
"@types/react": "^18.0.28",
44-
"@types/react-beautiful-dnd": "^13.1.2",
45-
"@types/testing-library__jest-dom": "^5.14.5",
46-
"@types/uuid": "^9.0.1",
47-
"@typescript-eslint/eslint-plugin": "^5.43.0",
48-
"@typescript-eslint/parser": "^5.43.0",
49-
"@vitejs/plugin-react": "^3.1.0",
50-
"eslint": "^8.28.0",
51-
"eslint-config-prettier": "^8.5.0",
52-
"eslint-import-resolver-typescript": "^3.5.2",
53-
"eslint-plugin-import": "^2.26.0",
54-
"eslint-plugin-jest-dom": "^4.0.3",
55-
"eslint-plugin-jsx-a11y": "^6.6.1",
56-
"eslint-plugin-react": "^7.31.11",
43+
"@types/react": "^18.2.38",
44+
"@types/react-beautiful-dnd": "^13.1.7",
45+
"@types/uuid": "^9.0.7",
46+
"@typescript-eslint/eslint-plugin": "^6.13.0",
47+
"@typescript-eslint/parser": "^6.13.0",
48+
"@vitejs/plugin-react": "^4.2.0",
49+
"eslint": "^8.54.0",
50+
"eslint-config-prettier": "^9.0.0",
51+
"eslint-import-resolver-typescript": "^3.6.1",
52+
"eslint-plugin-import": "^2.29.0",
53+
"eslint-plugin-jest-dom": "^5.1.0",
54+
"eslint-plugin-jsx-a11y": "^6.8.0",
55+
"eslint-plugin-react": "^7.33.2",
5756
"eslint-plugin-react-hooks": "^4.6.0",
5857
"eslint-plugin-simple-import-sort": "^10.0.0",
59-
"eslint-plugin-testing-library": "^5.9.1",
60-
"husky": "^8.0.2",
61-
"jsdom": "^21.1.0",
62-
"lint-staged": "^13.0.3",
63-
"prettier": "^2.8.0",
64-
"semantic-release": "^20.1.1",
65-
"sort-package-json": "^2.1.0",
66-
"typescript": "^4.8.4",
67-
"vite": "^4.1.4",
68-
"vitest": "^0.29.2"
58+
"eslint-plugin-testing-library": "^6.2.0",
59+
"husky": "^8.0.3",
60+
"jsdom": "^23.0.0",
61+
"lint-staged": "^15.1.0",
62+
"prettier": "^3.1.0",
63+
"semantic-release": "^22.0.8",
64+
"sort-package-json": "^2.6.0",
65+
"typescript": "^5.3.2",
66+
"vite": "^5.0.2",
67+
"vitest": "^0.34.6"
6968
}
7069
}

0 commit comments

Comments
 (0)