-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chrome extension #1
Open
vashnavichauhan1825
wants to merge
6
commits into
dev
Choose a base branch
from
chrome-extension
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8ed6e0e
added time ,date and greetings
vashnavichauhan1825 0bdd0dd
added countdown
vashnavichauhan1825 09d8c55
add condition
vashnavichauhan1825 d008aa2
add weather and todo
vashnavichauhan1825 f3e6680
added feat and media query
vashnavichauhan1825 dc8d107
Update Elements.js
vashnavichauhan1825 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,79 @@ | ||
import React, { useRef, useState, useEffect } from "react"; | ||
import { ColumnWrap, CountDownWrapper } from "./style/Elements"; | ||
|
||
const SpecialCountdown = (props) => { | ||
const [timerDays, setTimerDays] = useState("00"); | ||
const [timerHours, setTimerHours] = useState("00"); | ||
const [timerMinutes, setTimerMinutes] = useState("00"); | ||
const [timerSeconds, setTimerSrconds] = useState("00"); | ||
const { date, year, month } = JSON.parse(localStorage.getItem("date")); | ||
let interval = useRef(); | ||
|
||
const startTimer = () => { | ||
const countdownDate = new Date( | ||
`${month} ${date} ${year} 00:00:00` | ||
).getTime(); | ||
|
||
interval = setInterval(() => { | ||
const now = new Date().getTime(); | ||
const distance = countdownDate - now; | ||
|
||
const days = Math.floor(distance / (1000 * 60 * 60 * 24)); | ||
const hours = Math.floor( | ||
(distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60) | ||
); | ||
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); | ||
const seconds = Math.floor((distance % (1000 * 60)) / 1000); | ||
|
||
if (distance < 0) { | ||
clearInterval(interval.current); | ||
} else { | ||
setTimerDays(days); | ||
setTimerHours(hours); | ||
setTimerMinutes(minutes); | ||
setTimerSrconds(seconds); | ||
} | ||
}, 1000); | ||
}; | ||
|
||
useEffect(() => { | ||
startTimer(); | ||
return () => { | ||
clearInterval(interval.current); | ||
}; | ||
}); | ||
|
||
return ( | ||
<CountDownWrapper> | ||
<ColumnWrap> | ||
<span>{timerDays}</span> | ||
<span> | ||
<p>Days</p> | ||
</span> | ||
</ColumnWrap> | ||
<small>:</small> | ||
<ColumnWrap> | ||
<span>{timerHours}</span> | ||
<span> | ||
<p>Hours</p> | ||
</span> | ||
</ColumnWrap> | ||
<small>:</small> | ||
<ColumnWrap> | ||
<span>{timerMinutes}</span> | ||
<span> | ||
<p>Min</p> | ||
</span> | ||
</ColumnWrap> | ||
<small>:</small> | ||
<ColumnWrap> | ||
<span>{timerSeconds}</span> | ||
<span> | ||
<p>Sec</p> | ||
</span> | ||
</ColumnWrap> | ||
</CountDownWrapper> | ||
); | ||
}; | ||
|
||
export default SpecialCountdown; |
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,25 @@ | ||
import { useEffect } from "react"; | ||
import { useDispatch, useSelector } from "react-redux"; | ||
import { getDataActions } from "../store/extData"; | ||
|
||
const Greetings = () => { | ||
const dispatch = useDispatch(); | ||
const greeting = useSelector((state) => state.extData.greetings); | ||
const name = localStorage.getItem("name"); | ||
|
||
useEffect(() => { | ||
const hour = new Date().getHours(); | ||
if (hour < 4) dispatch(getDataActions.setGreetings("Good Night")); | ||
else if (hour < 11) dispatch(getDataActions.setGreetings("Good Morning")); | ||
else if (hour < 16) dispatch(getDataActions.setGreetings("Good Afternoon")); | ||
else if (hour < 19) dispatch(getDataActions.setGreetings("Good Evening")); | ||
else dispatch(getDataActions.setGreetings("Good Night")); | ||
}, []); | ||
|
||
return ( | ||
<h1> | ||
{greeting},{name} | ||
</h1> | ||
); | ||
}; | ||
export default Greetings; |
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,18 @@ | ||
import { TimeWrapper } from "./style/Elements"; | ||
|
||
const Time = () => { | ||
const getime = () => { | ||
return ( | ||
new Date() | ||
.getHours() | ||
.toLocaleString("en-US", { minimumIntegerDigits: 2 }) + | ||
":" + | ||
new Date() | ||
.getMinutes() | ||
.toLocaleString("en-US", { minimumIntegerDigits: 2 }) | ||
); | ||
}; | ||
return <TimeWrapper>{getime()}</TimeWrapper>; | ||
}; | ||
|
||
export default Time; |
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,9 @@ | ||
import { useEffect } from "react"; | ||
|
||
const Title = (title) => { | ||
useEffect(() => { | ||
document.title = `Vaspacx Chrome | ${title}`; | ||
}, [title]); | ||
}; | ||
|
||
export default Title; |
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,26 @@ | ||
import React from "react"; | ||
import { useDispatch } from "react-redux"; | ||
import { getDataActions } from "../../store/extData"; | ||
import { SecBtn } from "../style/Button"; | ||
import { BottomWrapper } from "../style/Elements"; | ||
|
||
const Edit = () => { | ||
const dispatch = useDispatch(); | ||
const name = localStorage.getItem("name"); | ||
const editDeadlineHandler = () => { | ||
dispatch(getDataActions.setFlag()); | ||
}; | ||
|
||
const editNameHandler = () => { | ||
dispatch(getDataActions.updateName("")); | ||
localStorage.setItem("name", ""); | ||
}; | ||
return ( | ||
<BottomWrapper> | ||
<SecBtn onClick={editDeadlineHandler}>Edit Deadline</SecBtn> | ||
{name !== "" && <SecBtn onClick={editNameHandler}>Edit Name</SecBtn>} | ||
</BottomWrapper> | ||
); | ||
}; | ||
|
||
export default Edit; |
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,24 @@ | ||
export { | ||
BgWrapper, | ||
GlobalStyle, | ||
CenterWrapper, | ||
InputName, | ||
DateContainer, | ||
TimeWrapper, | ||
CountDownWrapper, | ||
DetailContainer, | ||
ColumnWrap, | ||
BottomWrapper, | ||
TempWrapper, | ||
TodoWrapper, | ||
WeatherWrapper, | ||
UpperBox, | ||
InputCitySearch, | ||
} from "./style/Elements"; | ||
|
||
export { | ||
EffectButton, | ||
TransparentBtn, | ||
WeatherBtn, | ||
SecBtn, | ||
} from "./style/Button"; |
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,17 @@ | ||
import { quotesDB } from "../../database/quotes"; | ||
import { QuotesWrapper } from "../style/Elements"; | ||
|
||
const randomQuotes = () => { | ||
const randomNum = Math.floor(Math.random() * quotesDB.length); | ||
return quotesDB[randomNum]; | ||
}; | ||
const Quotes = () => { | ||
const quote = randomQuotes(); | ||
return ( | ||
<QuotesWrapper> | ||
<h1>{quote.quoteText}</h1> | ||
<p>-{quote.quoteAuthor}</p> | ||
</QuotesWrapper> | ||
); | ||
}; | ||
export default Quotes; |
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,57 @@ | ||
import styled from "styled-components"; | ||
|
||
export const EffectButton = styled.button` | ||
width: 70px; | ||
background: linear-gradient(138deg, var(--sec-color) 65%, white 36%); | ||
cursor: pointer; | ||
transition: all 0.5s ease-in-out; | ||
height: 40px; | ||
display: flex; | ||
font-weight: bold; | ||
padding: 9px 10px; | ||
margin: 1px; | ||
border: none; | ||
letter-spacing: 1px; | ||
border-radius: 6px; | ||
color: var(--primary-color); | ||
justify-content: space-between; | ||
|
||
&:hover { | ||
justify-content: center; | ||
background: linear-gradient(189deg, var(--sec-color) 75%, white 36%); | ||
color: #ffffff; | ||
} | ||
i { | ||
color: #ffffff; | ||
} | ||
`; | ||
|
||
export const SecBtn = styled.div` | ||
border: none; | ||
color: var(--grey-color); | ||
font-size: 15px; | ||
background: transparent; | ||
cursor: pointer; | ||
`; | ||
|
||
export const WeatherBtn = styled.div` | ||
background-color: transparent; | ||
border: none; | ||
color: var(--grey-color); | ||
text-align: end; | ||
margin-top: 5px; | ||
|
||
&:hover { | ||
cursor: pointer; | ||
color: var(--primary-color); | ||
} | ||
`; | ||
|
||
export const TransparentBtn = styled.button` | ||
background: transparent; | ||
border: 2px solid var(--primary-color); | ||
color: white; | ||
cursor: pointer; | ||
width: auto; | ||
padding: 0.5rem; | ||
`; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use barrel exports here too.