Skip to content

Commit 950a07e

Browse files
committedDec 2, 2023
month time table
1 parent 7318144 commit 950a07e

File tree

9 files changed

+390
-14
lines changed

9 files changed

+390
-14
lines changed
 

‎.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ dist-ssr
2222
*.njsproj
2323
*.sln
2424
*.sw?
25+
26+
27+
# Contentlayer
28+
.contentlayer

‎index.html

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
<!doctype html>
22
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8" />
5-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>Vite + React</title>
8-
</head>
9-
<body>
10-
<div id="root"></div>
11-
<script type="module" src="/src/main.jsx"></script>
12-
</body>
13-
</html>
3+
4+
<head>
5+
<meta charset="UTF-8" />
6+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8+
<title>Muslim Pro</title>
9+
</head>
10+
11+
<body>
12+
<div id="root"></div>
13+
<script type="module" src="/src/main.jsx"></script>
14+
</body>
15+
16+
</html>

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"moment": "^2.29.4",
1616
"moment-timezone": "^0.5.43",
1717
"react": "^18.2.0",
18+
"react-datepicker": "^4.24.0",
1819
"react-dom": "^18.2.0",
1920
"react-router-dom": "^6.20.0",
2021
"use-sound": "^4.0.1"

‎pnpm-lock.yaml

+75
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/component/Hero.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const Hero = () => {
9595
<div className="h-screen md:mx-10">
9696
<div className="h-fit bg-white mt-10 md:p-10 p-3 md:rounded-md">
9797
<div className="flex flex-col md:flex-row justify-between ">
98-
<h1 className="text-center md:text-2xl">Prayer Times in {location}</h1>
98+
<h1 className="text-center md:text-2xl">Salat Times in {location}</h1>
9999
{/* <p>{`${hours}:${minutes}:${sec}${ampm}`}</p> */}
100100
<DigitalClock />
101101

‎src/component/Home.jsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
// import React from 'react';
22

33
import Hero from "./Hero";
4-
import NextDateComponent from "./NextDateComponent";
4+
// import NextDateComponent from "./NextDateComponent";
5+
import Calendermain from "./calender/Calendermain";
56

67
const Home = () => {
78
return (
89
<div>
9-
{/* <NextDateComponent /> */}
1010
<Hero></Hero>
11+
<Calendermain></Calendermain>
1112
</div>
1213
);
1314
};
+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
import React from 'react';
2+
import { ButtonGroup } from '@material-tailwind/react';
3+
import { Select, Option } from "@material-tailwind/react";
4+
import { Button } from '@material-tailwind/react';
5+
6+
// import fack from '../../fack.json';
7+
import year from '../../year.json';
8+
import months from '../../months.json';
9+
import { useState } from 'react';
10+
11+
const Calendermain = () => {
12+
const [vlu, setVlu] = useState(2);
13+
const [bool, setBool] = useState(true);
14+
const [bool2, setBool2] = useState(false);
15+
16+
const [yer, setYer] = useState(new Date().getFullYear());
17+
const [mont, setMont] = useState(new Date().getMonth() + 1);
18+
19+
const month = () => {
20+
setVlu(2);
21+
22+
// --------------------month
23+
24+
if (bool == true) {
25+
setBool(true);
26+
} else {
27+
setBool(true);
28+
}
29+
30+
// ------------yeaar
31+
if (bool2 == false) {
32+
setBool2(false);
33+
} else {
34+
setBool2(false);
35+
}
36+
37+
38+
}
39+
const years = () => {
40+
setVlu(1);
41+
// --------------------month
42+
if (bool == true) {
43+
setBool(false);
44+
} else {
45+
setBool(false);
46+
}
47+
// ------------yeaar
48+
49+
if (bool2 == false) {
50+
setBool2(true);
51+
} else {
52+
setBool2(true);
53+
}
54+
55+
56+
}
57+
58+
const selectYear = (e) => {
59+
setYer(e);
60+
}
61+
const selectMonth = (e) => {
62+
setMont(e);
63+
}
64+
const ganarate = () => {
65+
if (vlu == 2) {
66+
// console.log(yer, mont);
67+
fetch(`https://api.aladhan.com/v1/calendarByAddress/${yer}/${mont}?address=${localStorage.getItem('sTime')}`)
68+
.then(res => res.json())
69+
.then(data => console.log(data.data))
70+
71+
} else {
72+
console.log(yer);
73+
74+
}
75+
}
76+
77+
78+
return (
79+
<div className="h-screen md:mx-10">
80+
<div className="h-fit bg-white mt-10 md:p-10 p-3 md:rounded-md">
81+
82+
<h1 className='text-2xl font-semibold'>Salat Timetable</h1>
83+
<div className="flex flex-col justify-center mt-4 items-center">
84+
85+
<div>
86+
<ButtonGroup variant="outlined">
87+
<Button onClick={month}>Monthly</Button>
88+
<Button onClick={years} disabled>Yearly</Button>
89+
</ButtonGroup>
90+
</div>
91+
<div>
92+
{
93+
bool && <div className='flex justify-center items-center mt-4 gap-4'>
94+
<Select label="Select Year" onChange={selectYear} required>
95+
{
96+
year.map((e) => <Option value={e.id} key={e.id}>{e.id} </Option>)
97+
}
98+
99+
</Select>
100+
<Select label="Select Month" onChange={selectMonth} required>
101+
{
102+
months.map((e) => <Option value={e.id} key={e.name}>{e.name} </Option>)
103+
}
104+
105+
</Select>
106+
107+
</div>
108+
}
109+
{
110+
bool2 && <div className='flex justify-center items-center mt-4 gap-4'>
111+
<Select label="Select Year" onChange={selectYear} required>
112+
{
113+
year.map((e) => <Option value={e.id} key={e.id}>{e.id} </Option>)
114+
}
115+
116+
</Select>
117+
118+
</div>
119+
}
120+
<div className='flex items-center justify-center mt-5'>
121+
<Button variant='gradient' onClick={ganarate}>Ganarate</Button>
122+
</div>
123+
</div>
124+
125+
</div>
126+
127+
</div>
128+
</div >
129+
);
130+
};
131+
132+
export default Calendermain;

‎src/months.json

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[
2+
{
3+
"id": 1,
4+
"name": "January"
5+
},
6+
{
7+
"id": 2,
8+
"name": "February"
9+
},
10+
{
11+
"id": 3,
12+
"name": "March"
13+
},
14+
{
15+
"id": 4,
16+
"name": "April"
17+
},
18+
{
19+
"id": 5,
20+
"name": "May"
21+
},
22+
{
23+
"id": 6,
24+
"name": "June"
25+
},
26+
{
27+
"id": 7,
28+
"name": "July"
29+
},
30+
{
31+
"id": 8,
32+
"name": "August"
33+
},
34+
{
35+
"id": 9,
36+
"name": "September"
37+
},
38+
{
39+
"id": 10,
40+
"name": "October"
41+
},
42+
{
43+
"id": 11,
44+
"name": "November"
45+
},
46+
{
47+
"id": 12,
48+
"name": "December"
49+
}
50+
]

0 commit comments

Comments
 (0)
Please sign in to comment.