Skip to content

Commit

Permalink
Get basic template working so I can begin developing
Browse files Browse the repository at this point in the history
  • Loading branch information
aelishRollo committed Jun 6, 2024
1 parent bc5af78 commit c9ed140
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 271 deletions.
201 changes: 0 additions & 201 deletions src/App.test.tsx

This file was deleted.

63 changes: 4 additions & 59 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,68 +1,13 @@
import {useState} from 'react';

import './App.css';
import './css_reset.css'
import './index.css'
import './section_view.css';
import * as types from './types';
import {GlobalStoreProvider} from './hooks/useGlobalStore';
import SectionPage from './SectionPage';
import {IClient} from './client/IClient';
import {ClientProvider} from './hooks/useClient';
import {useMount} from './hooks/useMount';

type AppProps = {
projectId: string;
sectionId: string;
import Foo from './Foo'

client: IClient;
}

const App: React.FC<AppProps> = ({projectId, sectionId, client}) => {
const [initialProjectData, setInitialProjectData] = useState<types.FullProjectData | null>(null);
const [error, setError] = useState('');

useMount(async () => {
const projectDataOrError = await client.fetchFullDataForProject(projectId);

if (projectDataOrError instanceof Error) {
alert(projectDataOrError.message);
setError(projectDataOrError.message);
return;
}

setInitialProjectData(projectDataOrError);
});

if (error) {
return (
<p>
{error}
</p>
);
}

if (!initialProjectData) {
return (
<p>
Loading
</p>
);
}

const pageContent = (
<SectionPage
projectId={projectId}
sectionId={sectionId}
/>
);
const App = () => {


return (
<ClientProvider client={client}>
<GlobalStoreProvider initialProjectData={initialProjectData}>
{pageContent}
</GlobalStoreProvider>
</ClientProvider>
<Foo />
);
}

Expand Down
8 changes: 8 additions & 0 deletions src/Foo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@



let ChordProgression = () => {
return (<h1> Hello, Universe!</h1>);
};

export default ChordProgression
12 changes: 1 addition & 11 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,9 @@ window.addEventListener('load', async () => {
document.getElementById('root') as HTMLElement
);

const localStore = new LocalStorageStore(localStorage);
const localClient = new LocalStorageClient(localStore);

const projectId = 'project-1';
const sectionId = 'section-1';

root.render(
<React.StrictMode>
<App
projectId={projectId}
sectionId={sectionId}
client={localClient}
/>
<App />
</React.StrictMode>
);
});
Expand Down

0 comments on commit c9ed140

Please sign in to comment.