Skip to content
This repository has been archived by the owner on Aug 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from ajktown/clickable-buttons
Browse files Browse the repository at this point in the history
Basic buttons
  • Loading branch information
mlajkim authored Jul 21, 2024
2 parents 0cf9047 + 98b8d78 commit c18c3ae
Show file tree
Hide file tree
Showing 10 changed files with 378 additions and 13 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ name: Docker Image CI

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]

jobs:

build:

runs-on: ubuntu-latest
runs-on: arm64v8/ubuntu # Use ARM64 runner

steps:
- uses: actions/checkout@v4
Expand All @@ -26,15 +24,15 @@ jobs:

- name: Build the Docker image for PR
if: github.event_name == 'pull_request'
run: docker build . --file Dockerfile --tag ajktown/golf:pr${{ github.event.pull_request.number }}
run: docker build --file Dockerfile --tag ajktown/golf:pr${{ github.event.pull_request.number }} .

- name: Push the Docker image for PR
if: github.event_name == 'pull_request'
run: docker push ajktown/golf:pr${{ github.event.pull_request.number }}

- name: Build the Docker image as latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: docker build . --file Dockerfile --tag ajktown/golf:latest
run: docker build --file Dockerfile --tag ajktown/golf:latest .

- name: Push the Docker image as latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
Expand Down
11 changes: 10 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,14 @@
"titleBar.inactiveBackground": "#458dd199",
"titleBar.inactiveForeground": "#e7e7e799"
},
"peacock.color": "#458dd1"
"peacock.color": "#458dd1",
"cSpell.words": [
"Ajktown",
"Appbar",
"msal",
"Naver",
"signin",
"unclickable",
"Wordnote"
]
}
20 changes: 20 additions & 0 deletions k8s/deployment.yaml
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
15 changes: 15 additions & 0 deletions k8s/service.yaml
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
187 changes: 187 additions & 0 deletions src/api/swings/get-swings.api.ts
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 added src/atoms/StyledNumberField.tsx
Empty file.
61 changes: 61 additions & 0 deletions src/components/number-pad.tsx
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;
Loading

0 comments on commit c18c3ae

Please sign in to comment.