Skip to content

Commit

Permalink
fix: lint and added github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammed committed Sep 25, 2023
1 parent 71e6cfe commit aaee223
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 17 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/bective-ci-cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Bective

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

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: build
run: yarn build

- name: lint
run: yarn lint
32 changes: 20 additions & 12 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import {FormEvent, useEffect, useState} from 'react'
import {
FormEvent,
useEffect,
useState
} from 'react'
import './styles/App.css'
import pauseSound from "/assets/pause-music.mp3";
import TimerForm from "./components/TimerForm.tsx";
Expand All @@ -20,6 +24,18 @@ function App() {
setIsPauseTimerRunning(false);
}

const handlePauseTimer = (): void => {
setIsWorkTimerRunning(false);
setIsPauseTimerRunning(false);
setStartSongWork(false);
};

const handleResetTimer = (): void => {
setIsWorkTimerRunning(false);
setWorkTime(["00", "00", "00"]);
setPauseTime(["00", "00", "00"]);
};

useEffect(() => {
const hoursInSeconds: number = parseInt(isWorkTimerRunning ? workTime[0] : pauseTime[0]) * 3600;
const minutesInSeconds: number = parseInt(isWorkTimerRunning ? workTime[1] : pauseTime[1]) * 60;
Expand All @@ -45,23 +61,15 @@ function App() {
const hours: number = Math.floor(totalSeconds / 3600);
const minutes: number = Math.floor((totalSeconds % 3600) / 60);
const seconds: number = totalSeconds % 60;
const workedTime: string[] = [hours.toString().padStart(2, "0"), minutes.toString().padStart(2, "0"), seconds.toString().padStart(2, "0") ];
const workedTime: string[] = [hours.toString().padStart(2, "0"), minutes.toString().padStart(2, "0"), seconds.toString().padStart(2, "0")];
isWorkTimerRunning ? setWorkTime(workedTime) : setPauseTime(workedTime);
}
}, 1000);

return () => clearInterval(timeInterval);

}, [isPauseTimerRunning, isWorkTimerRunning, pauseTime, storePauseTime, storeWorkTime, workTime]);
const handlePauseTimer = () => {
setIsWorkTimerRunning(false);
setIsPauseTimerRunning(false);
setStartSongWork(false);
};

const handleResetTimer = () => {
setIsWorkTimerRunning(false);
setWorkTime(["00", "00", "00"]);
setPauseTime(["00", "00", "00"]);
};
return (
<main>
<TimerForm
Expand Down
9 changes: 4 additions & 5 deletions src/styles/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ body {
border-radius: 5px;
}



.button-time-form {
margin-top: 20rem;
width: 80px;
Expand All @@ -57,11 +55,12 @@ body {
margin-left: 1rem;
}

input {
text-align: center;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
input {
text-align: center;
}

0 comments on commit aaee223

Please sign in to comment.