This repository has been archived by the owner on Aug 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from ajktown/clickable-buttons
Basic buttons
- Loading branch information
Showing
10 changed files
with
378 additions
and
13 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
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,20 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: ajktown-golf | ||
namespace: ajktown | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: ajktown-golf | ||
template: | ||
metadata: | ||
labels: | ||
app: ajktown-golf | ||
spec: | ||
containers: | ||
- name: ajktown-golf | ||
image: ajktown/golf:latest | ||
ports: | ||
- containerPort: 3200 |
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,15 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: ajktown-golf-svc | ||
namespace: ajktown | ||
labels: | ||
app: ajktown-golf | ||
spec: | ||
selector: | ||
app: ajktown-golf | ||
ports: | ||
- protocol: TCP | ||
port: 80 | ||
targetPort: 3200 | ||
type: NodePort |
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,187 @@ | ||
type IronNumber = 3 | 4 | 5 | 6 | 7 | 8 | 9; | ||
type WedgeName = "Pitching" | "52" | "56" | "60"; | ||
type Club = "Driver" | `${IronNumber} Iron` | `${WedgeName} Wedge`; | ||
|
||
type StandDistance = "Normal" | "Short"; | ||
|
||
type SwingType = "Full Swing" | "3/4 Swing" | "1/2 Swing"; | ||
|
||
type Grip = "+1" | "0" | "-1" | "-2" | "-3" | "-4"; | ||
|
||
export interface ISwing { | ||
club: Club; | ||
stanceDistance: StandDistance; | ||
swingType: SwingType; | ||
grip: Grip; | ||
carry: number; | ||
total: number; | ||
} | ||
interface GetSwingsApiResDTO { | ||
swings: ISwing[]; | ||
} | ||
|
||
const normalFullSwings: ISwing[] = [ | ||
{ | ||
club: "Driver", | ||
stanceDistance: "Normal", | ||
swingType: "Full Swing", | ||
grip: "+1", | ||
carry: 250, | ||
total: 270, | ||
}, | ||
{ | ||
club: "3 Iron", | ||
stanceDistance: "Normal", | ||
swingType: "Full Swing", | ||
grip: "+1", | ||
carry: 210, | ||
total: 220, | ||
}, | ||
{ | ||
club: "4 Iron", | ||
stanceDistance: "Normal", | ||
swingType: "Full Swing", | ||
grip: "+1", | ||
carry: 190, | ||
total: 200, | ||
}, | ||
{ | ||
club: "5 Iron", | ||
stanceDistance: "Normal", | ||
swingType: "Full Swing", | ||
grip: "+1", | ||
carry: 180, | ||
total: 190, | ||
}, | ||
{ | ||
club: "6 Iron", | ||
stanceDistance: "Normal", | ||
swingType: "Full Swing", | ||
grip: "+1", | ||
carry: 170, | ||
total: 175, | ||
}, | ||
{ | ||
club: "7 Iron", | ||
stanceDistance: "Normal", | ||
swingType: "Full Swing", | ||
grip: "+1", | ||
carry: 160, | ||
total: 160, | ||
}, | ||
{ | ||
club: "8 Iron", | ||
stanceDistance: "Normal", | ||
swingType: "Full Swing", | ||
grip: "+1", | ||
carry: 150, | ||
total: 150, | ||
}, | ||
{ | ||
club: "9 Iron", | ||
stanceDistance: "Normal", | ||
swingType: "Full Swing", | ||
grip: "+1", | ||
carry: 140, | ||
total: 140, | ||
}, | ||
{ | ||
club: "Pitching Wedge", | ||
stanceDistance: "Normal", | ||
swingType: "Full Swing", | ||
grip: "+1", | ||
carry: 130, | ||
total: 130, | ||
}, | ||
{ | ||
club: "52 Wedge", | ||
stanceDistance: "Normal", | ||
swingType: "Full Swing", | ||
grip: "+1", | ||
carry: 115, | ||
total: 115, | ||
}, | ||
{ | ||
club: "56 Wedge", | ||
stanceDistance: "Normal", | ||
swingType: "Full Swing", | ||
grip: "+1", | ||
carry: 100, | ||
total: 100, | ||
}, | ||
{ | ||
club: "60 Wedge", | ||
stanceDistance: "Normal", | ||
swingType: "Full Swing", | ||
grip: "+1", | ||
carry: 85, | ||
total: 85, | ||
}, | ||
{ | ||
club: "Pitching Wedge", | ||
stanceDistance: "Normal", | ||
swingType: "Full Swing", | ||
grip: "+1", | ||
carry: 130, | ||
total: 130, | ||
}, | ||
{ | ||
club: "52 Wedge", | ||
stanceDistance: "Normal", | ||
swingType: "Full Swing", | ||
grip: "+1", | ||
carry: 115, | ||
total: 115, | ||
}, | ||
{ | ||
club: "56 Wedge", | ||
stanceDistance: "Normal", | ||
swingType: "Full Swing", | ||
grip: "+1", | ||
carry: 100, | ||
total: 100, | ||
}, | ||
|
||
{ | ||
club: "60 Wedge", | ||
stanceDistance: "Normal", | ||
swingType: "Full Swing", | ||
grip: "+1", | ||
carry: 85, | ||
total: 85, | ||
}, | ||
]; | ||
/** | ||
* For my high apex short shots | ||
*/ | ||
const chipShotFullSwings: ISwing[] = [ | ||
{ | ||
club: "52 Wedge", | ||
stanceDistance: "Short", | ||
swingType: "Full Swing", | ||
grip: "-4", | ||
carry: 40, | ||
total: 45, | ||
}, | ||
{ | ||
club: "56 Wedge", | ||
stanceDistance: "Short", | ||
swingType: "Full Swing", | ||
grip: "-4", | ||
carry: 35, | ||
total: 40, | ||
}, | ||
{ | ||
club: "60 Wedge", | ||
stanceDistance: "Short", | ||
swingType: "Full Swing", | ||
grip: "-4", | ||
carry: 30, | ||
total: 35, | ||
}, | ||
]; | ||
|
||
export const getSwingsApi = (): GetSwingsApiResDTO => { | ||
const data = [...normalFullSwings, ...chipShotFullSwings]; | ||
return { swings: data }; | ||
}; |
Empty file.
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,61 @@ | ||
// src/NumberPad.js | ||
|
||
import { FC, useCallback } from "react"; | ||
import { Button, Grid } from "@mui/material"; | ||
|
||
interface Props { | ||
input: number; | ||
setInput: (input: number) => void; | ||
} | ||
|
||
const NumberPad: FC<Props> = ({ input, setInput }) => { | ||
const buttons = [ | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5", | ||
"6", | ||
"7", | ||
"8", | ||
"9", | ||
"*", | ||
"0", | ||
"Clear", | ||
]; | ||
|
||
const onClick = useCallback( | ||
(button: string) => { | ||
switch (button) { | ||
case "Clear": | ||
setInput(0); | ||
break; | ||
case "*": | ||
setInput(input * -1); | ||
break; | ||
default: | ||
setInput(input * 10 + parseInt(button)); | ||
} | ||
}, | ||
[input, setInput], | ||
); | ||
|
||
return ( | ||
<Grid container spacing={1} style={{ maxWidth: "200px" }}> | ||
{buttons.map((button) => ( | ||
<Grid item xs={4} key={button}> | ||
<Button | ||
variant="contained" | ||
fullWidth | ||
onClick={() => onClick(button)} | ||
disabled={button === "*"} | ||
> | ||
{button} | ||
</Button> | ||
</Grid> | ||
))} | ||
</Grid> | ||
); | ||
}; | ||
|
||
export default NumberPad; |
Oops, something went wrong.