-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: clean up structure of components to make contributions easier
- Loading branch information
Showing
29 changed files
with
252 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,12 @@ | ||
import { EnvelopeIcon } from "@heroicons/react/20/solid"; | ||
import { useContext } from "react"; | ||
import { Authentication } from "./Authentication"; | ||
import { AveragesScatterPlot } from "./AveragesScatterPlot"; | ||
import { AveragesTable } from "./AveragesTable"; | ||
import { DataTable } from "./DataTable"; | ||
import { SessionPicker } from "./SessionPicker"; | ||
import { UserMenu } from "./UserMenu"; | ||
import { UserContext } from "./UserProvider"; | ||
import { UserContext } from "./provider/UserContext"; | ||
import { Authentication } from "./views/Authentication"; | ||
import { DataView } from "./views/DataView"; | ||
import { Layout } from "./views/Layout"; | ||
|
||
export const App = () => { | ||
const { user } = useContext(UserContext); | ||
const isLoggedIn = user?.uid; | ||
|
||
return ( | ||
<div className="flex flex-col min-h-screen"> | ||
<header className="flex flex-row items-center justify-between h-32 bg-sky-50 px-6 py-4"> | ||
<div> | ||
<h1 className="text-2xl font-bold">r10progress</h1> | ||
{!isLoggedIn && ( | ||
<p className="text-md"> | ||
A tool to track golf shot progress when using the Garmin Approach | ||
R10. | ||
</p> | ||
)} | ||
</div> | ||
{isLoggedIn && <SessionPicker />} | ||
<UserMenu /> | ||
</header> | ||
{isLoggedIn ? ( | ||
<div className="flex flex-grow flex-col gap-8 bg-gray-200 py-8"> | ||
<div className="flex mx-8 flex-col items-center justify-center"> | ||
<div className="w-full p-4 bg-gray-100 rounded-md shadow-md flex flex-col gap-4"> | ||
<h2 className="text-2xl font-bold">Sessions</h2> | ||
<DataTable /> | ||
<AveragesTable /> | ||
<AveragesScatterPlot /> | ||
</div> | ||
</div> | ||
</div> | ||
) : ( | ||
<Authentication /> | ||
)} | ||
<footer className="flex flex-row items-center justify-center h-16 bg-sky-50 px-6 py-4 gap-2"> | ||
<p className="text-md"> | ||
Created by{" "} | ||
<a className="underline" href="https://aronschueler.de/"> | ||
Aron Schüler | ||
</a> | ||
</p> | ||
<a href="mailto:r10progress@lakur.tech" className="ml-2 flex underline"> | ||
<EnvelopeIcon className="w-5 h-5" /> | ||
</a> | ||
</footer> | ||
</div> | ||
); | ||
return <Layout>{isLoggedIn ? <DataView /> : <Authentication />}</Layout>; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/DemoModeButton.tsx → ...ponents/authentication/DemoModeButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Disclosure } from "@headlessui/react"; | ||
import { ChevronUpIcon } from "@heroicons/react/20/solid"; | ||
|
||
type BaseDisclosureProps = { | ||
title: string; | ||
children: React.ReactNode; | ||
}; | ||
|
||
export const BaseDisclosure = ({ title, children }: BaseDisclosureProps) => { | ||
return ( | ||
<Disclosure defaultOpen={true} as="div" className="mt-2"> | ||
{({ open }) => ( | ||
<> | ||
<Disclosure.Button className="flex w-full justify-between rounded-lg bg-sky-100 px-4 py-2 text-left text-sm font-medium text-sky-900 hover:bg-sky-200 focus:outline-none focus-visible:ring focus-visible:ring-sky-500/75"> | ||
<h3 className="text-xl font-bold">{title}</h3> | ||
<ChevronUpIcon | ||
className={`${ | ||
open ? "rotate-180 transform" : "" | ||
} h-5 w-5 text-sky-500 self-center`} | ||
/> | ||
</Disclosure.Button> | ||
<Disclosure.Panel className="pt-4 text-sm text-gray-500 mb-6"> | ||
{children} | ||
</Disclosure.Panel> | ||
</> | ||
)} | ||
</Disclosure> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/LoadingSpinner.tsx → src/components/base/BaseLoadingSpinner.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.