Skip to content

Commit f26c37c

Browse files
committed
added mail support and timeline
1 parent 523ab82 commit f26c37c

15 files changed

+425
-27
lines changed

package-lock.json

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

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
"@testing-library/user-event": "^12.8.3",
1414
"autoprefixer": "^9.8.6",
1515
"gh-pages": "^3.2.0",
16+
"gsap": "^3.6.1",
1617
"next": "^10.2.0",
1718
"next-seo": "^4.24.0",
1819
"next-sitemap": "^1.6.57",
1920
"next-themes": "0.0.14",
2021
"postcss": "^7.0.35",
2122
"react": "^17.0.2",
2223
"react-dom": "^17.0.2",
23-
"react-ga": "^3.3.0",
2424
"react-motion": "^0.5.2",
2525
"react-pdf": "^5.3.0",
2626
"react-scripts": "4.0.3",

public/index.html

+8
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,13 @@
2020
<div id="root"></div>
2121
</body>
2222
<script src="https://unpkg.com/[email protected]/dist/ionicons.js"></script>
23+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-7NQQVYC6KN"></script>
24+
<script>
25+
window.dataLayer = window.dataLayer || [];
26+
function gtag(){dataLayer.push(arguments);}
27+
gtag('js', new Date());
28+
29+
gtag('config', 'G-7NQQVYC6KN');
30+
</script>
2331

2432
</html>

src/App.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,14 @@ import DefaultContextMenu from "./Components/DefaultContextMenu";
1010
import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
1111
import Profile from "./Components/Profile";
1212
import 'react-pdf/dist/esm/Page/AnnotationLayer.css';
13-
import ReactGA from 'react-ga';
1413
import Terminal from "./Components/Terminal";
1514
import ChangeBackground from "./Components/ChangeBackground";
1615
import Dock from "./Components/Dock";
1716
import HDD from "./Assets/hdd.png";
1817
import SpotLight from "./Components/Spotlight";
1918
import Folder from "./Assets/folder.png";
20-
2119
import Head from 'next/head';
22-
ReactGA.initialize('G-7NQQVYC6KN');
23-
ReactGA.pageview(window.location.pathname + window.location.search);
24-
25-
26-
20+
import Mail from "./Components/Mail";
2721

2822

2923

@@ -58,6 +52,8 @@ const Component = () => {
5852
return <Terminal/>
5953
case 'CHANGE_BACKGROUND':
6054
return <ChangeBackground/>
55+
case 'MAIL':
56+
return <Mail />
6157
default:
6258
return <div>Some Content</div>
6359
}
@@ -124,9 +120,6 @@ const Stacks = () => {
124120

125121
const App = () => {
126122

127-
128-
129-
130123
return (
131124
<Store>
132125
<ThemeProvider attribute="class">

src/Assets/clock.png

14.5 KB
Loading

src/Assets/send.png

7.43 KB
Loading

src/Components/DefaultContextMenu.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import React from 'react';
22
import { Context } from "../store";
3-
const DefaultContextMenu = () => {
3+
import { useTheme } from 'next-themes';
44

5+
const DefaultContextMenu = () => {
6+
const { theme, setTheme } = useTheme();
57
const [ store, dispatch ] = React.useContext(Context);
68
return (
79
<div className="relative h-auto w-auto flex flex-col rounded-lg p-2 ring-1 ring-gray-600 ring-inset" style={{minWidth :"13rem", zIndex : 10 , backgroundColor : "rgb(34, 35, 54, 0.3)"}}>
@@ -13,6 +15,9 @@ const DefaultContextMenu = () => {
1315
<div
1416
onClick={() => dispatch({ type: "NEW_WINDOW", payload: { id: 'CHANGE_BACKGROUND', header: true, title : "change background image" } })}
1517
className="text-xs text-white pl-5 pt-1 pb-0.5 rounded-sm hover:bg-blue-500 mb-1 cursor-pointer">Change Desktop Background</div>
18+
<div
19+
onClick={() => setTheme( theme === 'dark' ? 'light' : 'dark') }
20+
className="text-xs text-white pl-5 pt-1 pb-0.5 rounded-sm hover:bg-blue-500 mb-1 cursor-pointer">Change Theme</div>
1621
<hr className="border border-gray-300 ml-2 mr-2 opacity-50" />
1722
<div className="text-xs text-gray-300 pl-5 pt-1 mt-1 rounded-sm hover:bg-blue-500 mb-1 cursor-not-allowed">✓ Use Stacks</div>
1823
</div>

src/Components/Dock.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,23 @@ const Dock = () => {
1212
const [ store, dispatch] = React.useContext(Context);
1313
const [name, setName] = React.useState('');
1414

15+
const getName = () => {
16+
if ( window === 'TERMINAL' ) {
17+
return 'Terminal';
18+
}
19+
if ( window === 'MAIL') {
20+
return 'Mail';
21+
}
22+
return 'Hello';
23+
}
24+
1525
React.useEffect(() => {
1626
var timeo;
1727
if ( clicked ){
1828
timeo = setTimeout(() => {
1929
setClick(false);
2030
if ( window){
21-
dispatch({ type: "NEW_WINDOW", payload: { id: window, header: true, title: (window === 'TERMINAL' ? 'Terminal' : 'Hello') } })
31+
dispatch({ type: "NEW_WINDOW", payload: { id: window, header: true, title: getName() } })
2232
}
2333
}, 1500);
2434

@@ -37,7 +47,7 @@ const Dock = () => {
3747
}}
3848
className={"h-16 w-16 " + (clicked && name === 'launchpad' ? "animate-bounce" : "")}></img>
3949
<img src={Mail} onClick={() => {
40-
setClick(true); setWindow(null); setName('mail');
50+
setClick(true); setWindow('MAIL'); setName('mail');
4151
}}
4252
className={"h-14 w-14 mt-1 " + (clicked && name === 'mail' ? "animate-bounce" : "")}></img>
4353
<img src={Terminal} onClick={() => {

src/Components/Mail.js

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import React from "react";
2+
import Send from "../Assets/send.png";
3+
4+
5+
const Mail = (props) => {
6+
var context = props.context;
7+
8+
if (window.screen.width < 600) {
9+
context = {
10+
height: "30rem",
11+
width: window.screen.width - 100
12+
}
13+
}
14+
15+
const [ cc, setCc ] = React.useState('');
16+
const [ subject , setSubject ] = React.useState('');
17+
const [ from , setFrom ] = React.useState('');
18+
const [ body , setBody ] = React.useState('');
19+
20+
return (
21+
<div className="flex relative bg-white dark:bg-gray-900 rounded-b-xl" style={{ height: context.height, width: context.width, minHeight: "30rem" }}>
22+
<div className="flex flex-col mx-1 h-full w-full">
23+
<div className="h-10 w-full p-1" style={{backgroundColor :"rgb(56,59,65)"}}>
24+
<a href={`mailto:[email protected]?subject=${encodeURI(subject)}&cc=${cc}&body=${encodeURI(body)}`}>
25+
<img
26+
className="ml-3 cursor-pointer" src={Send}></img></a>
27+
</div>
28+
<div className="flex flex-row w-full mt-3 ml-3">
29+
<div className="text-xs mr-5 dark:text-gray-400 text-gray-800">To:</div>
30+
<div className="text-xs mr-5 dark:text-white text-gray-900">[email protected]</div>
31+
</div>
32+
<div className="border dark:border-gray-800 border-gray-800 border-b-1 my-3"></div>
33+
<div className="flex flex-row w-full mt-1 ml-3">
34+
<div className="text-xs mr-5 dark:text-gray-400 text-gray-800">Cc:</div>
35+
<input value={cc} onChange={(e) => setCc(e.target.value)}
36+
className="text-xs mr-5 dark:text-white w-full text-gray-900 bg-transparent outline-none"></input>
37+
</div>
38+
<div className="border dark:border-gray-800 border-gray-800 border-b-1 my-3"></div>
39+
<div className="flex flex-row w-full mt-1 ml-3">
40+
<div className="text-xs mr-5 dark:text-gray-400 text-gray-800">Subject:</div>
41+
<input value={subject} onChange={(e) => setSubject(e.target.value)}
42+
className="text-xs mr-5 dark:text-white w-full text-gray-900 bg-transparent outline-none"></input>
43+
</div>
44+
<div className="border dark:border-gray-800 border-gray-800 border-b-1 my-3"></div>
45+
<div className="flex flex-row w-full mt-1 ml-3">
46+
<div className="text-xs mr-5 dark:text-gray-400 text-gray-800">From:</div>
47+
<input value={from} onChange={(e) => setFrom(e.target.value)}
48+
className="text-xs mr-5 w-full dark:text-white text-gray-900 bg-transparent outline-none"></input>
49+
</div>
50+
<div className="border dark:border-gray-800 border-gray-800 border-b-1 my-3"></div>
51+
<textarea value={body} onChange={e => setBody(e.target.value)}
52+
className="px-2 mt-3 h-full w-full dark:text-white text-black text-md outline-none bg-transparent"></textarea>
53+
</div>
54+
</div>
55+
);
56+
57+
}
58+
59+
export default Mail;

src/Components/Profile.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ import { act } from 'react-dom/test-utils';
33
import About from './Screens/About';
44
import Projects from './Screens/Projects';
55
import Research from './Screens/Research';
6+
import Timeline from "./Timeline";
67

78
import AboutSVG from "../Assets/profile.svg"
89
import ProjectSVG from "../Assets/project.svg"
910
import ResearchSVG from "../Assets/research.svg"
11+
import Clock from "../Assets/clock.png";
12+
1013
const Profile = (props) => {
1114

1215
const [ activeScreen , setScreen ] = React.useState("about");
@@ -16,7 +19,8 @@ const Profile = (props) => {
1619
const screens = {
1720
'about' : <About/>,
1821
'projects' : <Projects/>,
19-
'research' : <Research/>
22+
'research' : <Research/>,
23+
'timeline' : <Timeline/>
2024
}
2125

2226
const changeScreen = (e) => {
@@ -50,6 +54,10 @@ const Profile = (props) => {
5054
<img className=" w-2 md:w-4 " alt="Research" src={ ResearchSVG }/>
5155
<span className=" ml-1 md:ml-2 text-black text-xs dark:text-white">Research</span>
5256
</div>
57+
<div tabIndex="0" onFocus={() => changeScreen('timeline')} className={(activeScreen === "timeline" ? " bg-gray-300 bg-opacity-100 hover:bg-opacity-95" : " hover:bg-gray-50 hover:bg-opacity-5 ") + " w-28 md:w-full rounded-lg cursor-default outline-none py-1.5 focus:outline-none duration-100 my-0.5 flex items-center pl-2 md:pl-2.5"}>
58+
<img className=" w-2 md:w-4 " alt="Timeline" src={ Clock }/>
59+
<span className=" ml-1 md:ml-2 text-black text-xs dark:text-white">Timeline</span>
60+
</div>
5361

5462
</div>
5563
);

src/Components/Terminal.js

+16-6
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ const Terminal = (props) => {
8383
if ( tokens.length === 1 ){
8484
if ( currDir === 'shuvayan') {
8585
contents = Object.keys(dirStr['folders']);
86-
return contents.join(' ');
86+
return contents.map(e => e.split('/').slice(-1)[0]).join(' ');
8787
}
8888

89-
return dirStr[currDir].join(' ');
89+
return dirStr[currDir].map( e => e.split('/').slice(-1)[0]).join(' ');
9090
}
9191
var dirs = tokens.slice(1);
9292
const ret = {};
@@ -153,11 +153,21 @@ const Terminal = (props) => {
153153
continue;
154154
}
155155
filest[sysfile] = "";
156-
var filesinDir = dirStr[currDir];
157-
filesinDir.push(file);
158-
dirStr[currDir] = filesinDir;
159-
localStorage.setItem('localstructure', JSON.stringify(dirStr));
156+
157+
var filesinDir;
158+
if (currDir === 'shuvayan') {
159+
var fils = dirStr['folders'];
160+
console.log(dirStr , fils);
161+
fils[sysfile] = "";
162+
dirStr['folders'] = fils;
163+
} else {
164+
filesinDir = dirStr[currDir];
165+
filesinDir.push(file);
166+
dirStr[currDir] = filesinDir;
167+
}
160168
}
169+
localStorage.setItem('files' , JSON.stringify(filest));
170+
localStorage.setItem('localstructure', JSON.stringify(dirStr));
161171
return ret;
162172
}
163173

src/Components/Timeline.js

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import React, { useEffect } from "react";
2+
3+
import { gsap } from "gsap";
4+
import { ScrollTrigger } from "gsap/ScrollTrigger";
5+
import data from "./timelineData.json";
6+
import "./timeline.css";
7+
8+
const Timeline = (props) => {
9+
const items = data;
10+
11+
const animateFromTo = (elem, direction) => {
12+
const offset = 1000;
13+
let x = 0;
14+
let y = direction * offset;
15+
16+
direction = direction | 1;
17+
18+
if (elem.classList.contains("slide_from_left")) {
19+
x = -offset;
20+
y = 0;
21+
} else if (elem.classList.contains("slide_from_right")) {
22+
x = offset;
23+
y = 0;
24+
}
25+
26+
gsap.fromTo(
27+
elem,
28+
{ x: x, y: y, autoAlpha: 0 },
29+
{
30+
duration: 1.25,
31+
x: 0,
32+
y: 0,
33+
autoAlpha: 1,
34+
ease: "expo",
35+
overwrite: "auto",
36+
}
37+
);
38+
};
39+
40+
const hide = (elem) => {
41+
gsap.set(elem, { autoAlpha: 0 });
42+
};
43+
44+
// useEffect(() => {
45+
// // gsap.registerPlugin(ScrollTrigger);
46+
47+
// gsap.utils.toArray(".animate").forEach(function (elem) {
48+
// hide(elem);
49+
50+
// ScrollTrigger.create({
51+
// trigger: elem,
52+
// onEnter: function () {
53+
// animateFromTo(elem);
54+
// },
55+
// onEnterBack: function () {
56+
// animateFromTo(elem, -1);
57+
// },
58+
// onLeave: function () {
59+
// hide(elem);
60+
// },
61+
// });
62+
// });
63+
// }, []);
64+
65+
return (
66+
<div className="flex flex-col">
67+
<div className="dark:text-white text-black font-black text-2xl mt-4 w-full text-center">Timeline</div>
68+
<div className="timeline">
69+
<ul>
70+
{items.map((te, idx) => {
71+
return (
72+
<li key={`${te.title}_${te.date}`}>
73+
<div className="content">
74+
<h3
75+
className={`animate ${idx % 2 === 0 ? "slide_from_left" : "slide_from_right"
76+
}`}
77+
>
78+
{te.title}
79+
</h3>
80+
<p
81+
className={`animate ${idx % 2 === 0 ? "slide_from_left" : "slide_from_right"
82+
}`}
83+
>
84+
{te.description}
85+
</p>
86+
</div>
87+
<div
88+
className={`time animate ${idx % 2 === 0 ? "slide_from_right" : "slide_from_left"
89+
}`}
90+
>
91+
<h4>{te.date}</h4>
92+
</div>
93+
</li>
94+
);
95+
})}
96+
<div style={{ clear: "both" }}></div>
97+
</ul>
98+
</div>
99+
</div>
100+
);
101+
};
102+
103+
export default Timeline;

0 commit comments

Comments
 (0)