mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
run prettier on all .ts and .tsx files
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import App from './App';
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import App from "./App";
|
||||
|
||||
it('renders without crashing', () => {
|
||||
const div = document.createElement('div');
|
||||
it("renders without crashing", () => {
|
||||
const div = document.createElement("div");
|
||||
ReactDOM.render(<App />, div);
|
||||
ReactDOM.unmountComponentAtNode(div);
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ export const AuthProvider = ({ children }: any) => {
|
||||
return (
|
||||
<AuthContext.Provider
|
||||
value={{
|
||||
currentUser
|
||||
currentUser,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -20,7 +20,7 @@ const Image = (props: any) => {
|
||||
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
||||
onDrop,
|
||||
multiple: false,
|
||||
accept: ["image/png", "image/jpg", "image/jpeg"]
|
||||
accept: ["image/png", "image/jpg", "image/jpeg"],
|
||||
});
|
||||
return (
|
||||
<div {...getRootProps()}>
|
||||
|
||||
@@ -12,7 +12,7 @@ const Rating = (props: any) => {
|
||||
rowIndex,
|
||||
value: newValue,
|
||||
docRef: rowData.ref,
|
||||
fieldName: columnData.fieldName
|
||||
fieldName: columnData.fieldName,
|
||||
};
|
||||
cellActions.updateFirestore(cell);
|
||||
}}
|
||||
|
||||
@@ -25,7 +25,7 @@ export enum FieldType {
|
||||
url = "URL",
|
||||
rating = "RATING",
|
||||
image = "IMAGE",
|
||||
file = "FILE"
|
||||
file = "FILE",
|
||||
}
|
||||
|
||||
export const FIELDS = [
|
||||
@@ -40,7 +40,7 @@ export const FIELDS = [
|
||||
{ icon: <URLIcon />, name: "URL", type: FieldType.url },
|
||||
{ icon: <RatingIcon />, name: "Rating", type: FieldType.rating },
|
||||
{ icon: <ImageIcon />, name: "Image", type: FieldType.image },
|
||||
{ icon: <FileIcon />, name: "File", type: FieldType.file }
|
||||
{ icon: <FileIcon />, name: "File", type: FieldType.file },
|
||||
];
|
||||
|
||||
export const getFieldIcon = (type: FieldType) => {
|
||||
|
||||
@@ -5,7 +5,7 @@ interface AuthContextInterface {
|
||||
}
|
||||
|
||||
const AuthContext = React.createContext<AuthContextInterface>({
|
||||
currentUser: undefined
|
||||
currentUser: undefined,
|
||||
});
|
||||
|
||||
export default AuthContext;
|
||||
|
||||
@@ -10,7 +10,7 @@ export const stagingConfig = {
|
||||
databaseURL: `https://${STAGING_PROJECT_NAME}.firebaseio.com`,
|
||||
projectId: STAGING_PROJECT_NAME,
|
||||
storageBucket: `${STAGING_PROJECT_NAME}.appspot.com`,
|
||||
messagingSenderId: "236015562107"
|
||||
messagingSenderId: "236015562107",
|
||||
};
|
||||
|
||||
export const productionConfig = stagingConfig;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useEffect, useReducer } from "react";
|
||||
|
||||
export enum DocActions {
|
||||
update,
|
||||
delete
|
||||
delete,
|
||||
}
|
||||
const documentReducer = (prevState: any, newProps: any) => {
|
||||
switch (newProps.action) {
|
||||
@@ -22,13 +22,13 @@ const documentIntialState = {
|
||||
prevPath: null,
|
||||
doc: null,
|
||||
ref: null,
|
||||
loading: true
|
||||
loading: true,
|
||||
};
|
||||
|
||||
const useDoc = (intialOverrides: any) => {
|
||||
const [documentState, documentDispatch] = useReducer(documentReducer, {
|
||||
...documentIntialState,
|
||||
...intialOverrides
|
||||
...intialOverrides,
|
||||
});
|
||||
const setDocumentListner = () => {
|
||||
documentDispatch({ prevPath: documentState.path });
|
||||
@@ -41,7 +41,7 @@ const useDoc = (intialOverrides: any) => {
|
||||
documentDispatch({
|
||||
doc,
|
||||
ref: snapshot.ref,
|
||||
loading: false
|
||||
loading: false,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@ const useFiretable = (collectionName: string) => {
|
||||
const tab = useKeyCode(9);
|
||||
const [tableConfig, configActions] = useTableConfig(collectionName);
|
||||
const [tableState, tableActions] = useTable({
|
||||
path: collectionName
|
||||
path: collectionName,
|
||||
});
|
||||
const [cellState, cellActions] = useCell({});
|
||||
|
||||
@@ -41,7 +41,7 @@ const useFiretable = (collectionName: string) => {
|
||||
docRef: tableState.rows[nextRowIndex].ref,
|
||||
fieldName: cellState.cell.fieldName,
|
||||
rowIndex: nextRowIndex,
|
||||
value: tableState.rows[nextRowIndex].value
|
||||
value: tableState.rows[nextRowIndex].value,
|
||||
};
|
||||
cellActions.set(nextCell);
|
||||
}
|
||||
@@ -61,7 +61,7 @@ const useFiretable = (collectionName: string) => {
|
||||
docRef: tableState.rows[nextRowIndex].ref,
|
||||
fieldName: cellState.cell.fieldName,
|
||||
rowIndex: nextRowIndex,
|
||||
value: tableState.rows[nextRowIndex].value
|
||||
value: tableState.rows[nextRowIndex].value,
|
||||
};
|
||||
cellActions.set(nextCell);
|
||||
}
|
||||
@@ -76,13 +76,13 @@ const useFiretable = (collectionName: string) => {
|
||||
const state: FiretableState = {
|
||||
cell: cellState.cell,
|
||||
columns: tableConfig.columns,
|
||||
rows: tableState.rows
|
||||
rows: tableState.rows,
|
||||
};
|
||||
const actions: FiretableActions = {
|
||||
cell: { ...cellActions },
|
||||
column: { add: configActions.addColumn },
|
||||
row: { add: tableActions.addRow, delete: tableActions.deleteRow },
|
||||
table: { set: setTable }
|
||||
table: { set: setTable },
|
||||
};
|
||||
|
||||
return { tableState: state, tableActions: actions };
|
||||
|
||||
@@ -14,7 +14,7 @@ const cellReducer = (prevState: any, newProps: any) => {
|
||||
};
|
||||
const cellIntialState = {
|
||||
prevCell: null,
|
||||
cell: null
|
||||
cell: null,
|
||||
};
|
||||
|
||||
const updateCell = (cell: Cell) => {
|
||||
@@ -23,7 +23,7 @@ const updateCell = (cell: Cell) => {
|
||||
const useCell = (intialOverrides: any) => {
|
||||
const [cellState, cellDispatch] = useReducer(cellReducer, {
|
||||
...cellIntialState,
|
||||
...intialOverrides
|
||||
...intialOverrides,
|
||||
});
|
||||
useEffect(() => {
|
||||
const { prevCell, updatedValue } = cellState;
|
||||
|
||||
@@ -31,13 +31,13 @@ const tableIntialState = {
|
||||
limit: 20,
|
||||
loading: true,
|
||||
sort: { field: "createdAt", direction: "asc" },
|
||||
cap: CAP
|
||||
cap: CAP,
|
||||
};
|
||||
|
||||
const useTable = (intialOverrides: any) => {
|
||||
const [tableState, tableDispatch] = useReducer(tableReducer, {
|
||||
...tableIntialState,
|
||||
...intialOverrides
|
||||
...intialOverrides,
|
||||
});
|
||||
const getRows = (
|
||||
filters: {
|
||||
@@ -59,7 +59,7 @@ const useTable = (intialOverrides: any) => {
|
||||
prevFilters: filters,
|
||||
prevLimit: limit,
|
||||
prevPath: tableState.path,
|
||||
loading: true
|
||||
loading: true,
|
||||
});
|
||||
let query:
|
||||
| firebase.firestore.CollectionReference
|
||||
@@ -90,12 +90,12 @@ const useTable = (intialOverrides: any) => {
|
||||
.filter(doc => doc.id !== "_FIRETABLE_"); //removes schema file
|
||||
tableDispatch({
|
||||
rows,
|
||||
loading: false
|
||||
loading: false,
|
||||
});
|
||||
} else {
|
||||
tableDispatch({
|
||||
rows: [],
|
||||
loading: false
|
||||
loading: false,
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -110,7 +110,7 @@ const useTable = (intialOverrides: any) => {
|
||||
prevPath,
|
||||
path,
|
||||
sort,
|
||||
unsubscribe
|
||||
unsubscribe,
|
||||
} = tableState;
|
||||
if (
|
||||
!equals(prevFilters, filters) ||
|
||||
@@ -141,7 +141,7 @@ const useTable = (intialOverrides: any) => {
|
||||
const addRow = () => {
|
||||
db.collection(tableState.path).add({
|
||||
createdAt: firebase.firestore.FieldValue.serverTimestamp(),
|
||||
updatedAt: firebase.firestore.FieldValue.serverTimestamp()
|
||||
updatedAt: firebase.firestore.FieldValue.serverTimestamp(),
|
||||
});
|
||||
};
|
||||
const tableActions = { deleteRow, setTable, addRow };
|
||||
|
||||
@@ -3,7 +3,7 @@ import useDoc, { DocActions } from "../useDoc";
|
||||
import { FieldType } from "../../components/Fields";
|
||||
const useTableConfig = (tablePath: string) => {
|
||||
const [tableConfigState, documentDispatch] = useDoc({
|
||||
path: `${tablePath}/_FIRETABLE_`
|
||||
path: `${tablePath}/_FIRETABLE_`,
|
||||
});
|
||||
useEffect(() => {
|
||||
const { doc, columns } = tableConfigState;
|
||||
@@ -22,12 +22,12 @@ const useTableConfig = (tablePath: string) => {
|
||||
const { columns } = tableConfigState;
|
||||
documentDispatch({
|
||||
action: DocActions.update,
|
||||
data: { columns: [...columns, { columnName, fieldName, type }] }
|
||||
data: { columns: [...columns, { columnName, fieldName, type }] },
|
||||
});
|
||||
};
|
||||
const actions = {
|
||||
addColumn,
|
||||
setTable
|
||||
setTable,
|
||||
};
|
||||
return [tableConfigState, actions];
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@ const uploadReducer = (prevState: any, newProps: any) => {
|
||||
};
|
||||
const useUploader = () => {
|
||||
const [uploaderState, uploaderDispatch] = useReducer(uploadReducer, {
|
||||
...intialState
|
||||
...intialState,
|
||||
});
|
||||
|
||||
const upload = (
|
||||
@@ -64,9 +64,9 @@ const useUploader = () => {
|
||||
downloadURL,
|
||||
name: file.name,
|
||||
type: file.type,
|
||||
lastModifiedTS: file.lastModified
|
||||
}
|
||||
]
|
||||
lastModifiedTS: file.lastModified,
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { db } from "../firebase";
|
||||
|
||||
const useSettings = () => {
|
||||
const [settingsState, documentDispatch] = useDoc({
|
||||
path: "_FIRETABLE_/settings"
|
||||
path: "_FIRETABLE_/settings",
|
||||
});
|
||||
useEffect(() => {
|
||||
//updates tables data on document change
|
||||
@@ -19,7 +19,7 @@ const useSettings = () => {
|
||||
// updates the setting doc
|
||||
documentDispatch({
|
||||
action: DocActions.update,
|
||||
data: { tables: [...tables, { name, collection }] }
|
||||
data: { tables: [...tables, { name, collection }] },
|
||||
});
|
||||
//create the firetable collection doc with empty columns
|
||||
db.collection(collection)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import App from './App';
|
||||
import * as serviceWorker from './serviceWorker';
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import App from "./App";
|
||||
import * as serviceWorker from "./serviceWorker";
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('root'));
|
||||
ReactDOM.render(<App />, document.getElementById("root"));
|
||||
|
||||
// If you want your app to work offline and load faster, you can change
|
||||
// unregister() to register() below. Note this comes with some pitfalls.
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
// opt-in, read https://bit.ly/CRA-PWA
|
||||
|
||||
const isLocalhost = Boolean(
|
||||
window.location.hostname === 'localhost' ||
|
||||
window.location.hostname === "localhost" ||
|
||||
// [::1] is the IPv6 localhost address.
|
||||
window.location.hostname === '[::1]' ||
|
||||
window.location.hostname === "[::1]" ||
|
||||
// 127.0.0.1/8 is considered localhost for IPv4.
|
||||
window.location.hostname.match(
|
||||
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
|
||||
@@ -26,7 +26,7 @@ type Config = {
|
||||
};
|
||||
|
||||
export function register(config?: Config) {
|
||||
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
|
||||
if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) {
|
||||
// The URL constructor is available in all browsers that support SW.
|
||||
const publicUrl = new URL(
|
||||
(process as { env: { [key: string]: string } }).env.PUBLIC_URL,
|
||||
@@ -39,7 +39,7 @@ export function register(config?: Config) {
|
||||
return;
|
||||
}
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
window.addEventListener("load", () => {
|
||||
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
|
||||
|
||||
if (isLocalhost) {
|
||||
@@ -50,8 +50,8 @@ export function register(config?: Config) {
|
||||
// service worker/PWA documentation.
|
||||
navigator.serviceWorker.ready.then(() => {
|
||||
console.log(
|
||||
'This web app is being served cache-first by a service ' +
|
||||
'worker. To learn more, visit https://bit.ly/CRA-PWA'
|
||||
"This web app is being served cache-first by a service " +
|
||||
"worker. To learn more, visit https://bit.ly/CRA-PWA"
|
||||
);
|
||||
});
|
||||
} else {
|
||||
@@ -72,14 +72,14 @@ function registerValidSW(swUrl: string, config?: Config) {
|
||||
return;
|
||||
}
|
||||
installingWorker.onstatechange = () => {
|
||||
if (installingWorker.state === 'installed') {
|
||||
if (installingWorker.state === "installed") {
|
||||
if (navigator.serviceWorker.controller) {
|
||||
// At this point, the updated precached content has been fetched,
|
||||
// but the previous service worker will still serve the older
|
||||
// content until all client tabs are closed.
|
||||
console.log(
|
||||
'New content is available and will be used when all ' +
|
||||
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
|
||||
"New content is available and will be used when all " +
|
||||
"tabs for this page are closed. See https://bit.ly/CRA-PWA."
|
||||
);
|
||||
|
||||
// Execute callback
|
||||
@@ -90,7 +90,7 @@ function registerValidSW(swUrl: string, config?: Config) {
|
||||
// At this point, everything has been precached.
|
||||
// It's the perfect time to display a
|
||||
// "Content is cached for offline use." message.
|
||||
console.log('Content is cached for offline use.');
|
||||
console.log("Content is cached for offline use.");
|
||||
|
||||
// Execute callback
|
||||
if (config && config.onSuccess) {
|
||||
@@ -102,7 +102,7 @@ function registerValidSW(swUrl: string, config?: Config) {
|
||||
};
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error during service worker registration:', error);
|
||||
console.error("Error during service worker registration:", error);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -111,10 +111,10 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {
|
||||
fetch(swUrl)
|
||||
.then(response => {
|
||||
// Ensure service worker exists, and that we really are getting a JS file.
|
||||
const contentType = response.headers.get('content-type');
|
||||
const contentType = response.headers.get("content-type");
|
||||
if (
|
||||
response.status === 404 ||
|
||||
(contentType != null && contentType.indexOf('javascript') === -1)
|
||||
(contentType != null && contentType.indexOf("javascript") === -1)
|
||||
) {
|
||||
// No service worker found. Probably a different app. Reload the page.
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
@@ -129,13 +129,13 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {
|
||||
})
|
||||
.catch(() => {
|
||||
console.log(
|
||||
'No internet connection found. App is running in offline mode.'
|
||||
"No internet connection found. App is running in offline mode."
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
export function unregister() {
|
||||
if ('serviceWorker' in navigator) {
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
registration.unregister();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user