Skip to content

Commit

Permalink
Merge branch 'main' into dataframe-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkircos authored Feb 23, 2023
2 parents 52325e6 + 358bd14 commit 6dc4f67
Show file tree
Hide file tree
Showing 20 changed files with 26 additions and 13,008 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: push

jobs:
test_unit:
runs-on: ubuntu-latest-8-cores
runs-on: ubuntu-latest-4-cores

steps:
- uses: actions/checkout@v2
Expand Down
1 change: 0 additions & 1 deletion docs/examples/airports_distance.grid

This file was deleted.

1 change: 0 additions & 1 deletion docs/examples/airports_large.grid

This file was deleted.

1 change: 0 additions & 1 deletion docs/examples/expenses.grid

This file was deleted.

1 change: 0 additions & 1 deletion docs/examples/monte_carlo_simulation.grid

This file was deleted.

1 change: 0 additions & 1 deletion docs/examples/python.grid

This file was deleted.

1 change: 0 additions & 1 deletion docs/examples/startup_portfolio.grid

This file was deleted.

2 changes: 1 addition & 1 deletion public/examples/airports_distance.grid

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/examples/airports_large.grid

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/examples/default.grid

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/examples/expenses.grid

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/examples/monte_carlo_simulation.grid

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/examples/open_ai.grid

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/examples/python.grid

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/examples/startup_portfolio.grid

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/gridGL/UI/cells/CellsMarkers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export class CellsMarkers extends Container {
}

if (type === 'CodeIcon') {
child.position.set(x + 1.5, y + 1.5);
child.position.set(x + 1.25, y + 1.25);
child.texture = Texture.from('images/python-icon.png');
child.tint = colors.cellColorUserPython;
child.width = child.height = 4;
} else if (type === 'FormulaIcon') {
child.position.set(x + 1.5, y + 1.5);
child.position.set(x + 1.25, y + 1.25);
child.texture = Texture.from('images/formula-fx-icon.png');
child.tint = colors.cellColorUserFormula;
child.width = child.height = 4;
Expand Down
26 changes: 8 additions & 18 deletions src/quadratic/FileLoadingComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,34 @@
import { useEffect } from 'react';
import useLocalStorage from '../hooks/useLocalStorage';
import { Sheet } from '../grid/sheet/Sheet';
import { example_grid } from './example_grid';
import { getURLParameter } from '../helpers/getURL';
import { debugShowFileIO } from '../debugFlags';
import { localFiles } from '../grid/sheet/localFiles';
import { openExampleGridFile } from '../grid/actions/gridFile/OpenGridFile';
import { SheetController } from '../grid/controller/sheetController';

const EXAMPLE_FILE_FILENAME = 'example.grid';
const EXAMPLE_FILE_FILENAME = 'default.grid';

interface Props {
sheet: Sheet;
sheetController: SheetController;
}

export const FileLoadingComponent = (props: Props): JSX.Element | null => {
const [firstTime, setFirstTime] = useLocalStorage('firstTime', true);

useEffect(() => {
if (getURLParameter('example')) {
if (debugShowFileIO) {
console.log(`[WelcomeComponent] Loading example file b/c ?example=1`);
}
props.sheet.load_file(example_grid);
localFiles.saveLocal(EXAMPLE_FILE_FILENAME, props.sheet.export_file());
return;
}

localFiles.loadLocalLastFile().then((data) => {
if (data) {
props.sheet.load_file(data);
props.sheetController.sheet.load_file(data);
} else if (firstTime) {
if (debugShowFileIO) {
console.log(`[WelcomeComponent] Loading example file b/c this is the first time`);
}
props.sheet.load_file(example_grid);
localFiles.loadedExternalFile(EXAMPLE_FILE_FILENAME, props.sheet.export_file());
openExampleGridFile(EXAMPLE_FILE_FILENAME, props.sheetController);
setFirstTime(false);
} else {
localFiles.newFile();
}
});
}, [firstTime, setFirstTime, props.sheet]);
}, [firstTime, setFirstTime, props.sheetController]);

return null;
};
2 changes: 1 addition & 1 deletion src/quadratic/QuadraticApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const QuadraticApp = () => {
{/* Provider for Analytics. Only used when running in Quadratic Cloud. */}
<AnalyticsProvider></AnalyticsProvider>
{/* Welcome Component loads appropriate sheet */}
{!loading && <FileLoadingComponent sheet={sheet} />}
{!loading && <FileLoadingComponent sheetController={sheet_controller} />}
{/* Provider of All React UI Components */}
{!loading && <QuadraticUI sheetController={sheet_controller} />}
{/* Loading screen */}
Expand Down
Loading

0 comments on commit 6dc4f67

Please sign in to comment.