Skip to content

Commit d22b1dc

Browse files
committed
finish homepage, added docs
1 parent 1aa2e8b commit d22b1dc

31 files changed

+73
-187
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919
![GitHubActions](https://img.shields.io/badge/GitHub_Actions-2088FF?style=for-the-badge&logo=github-actions&logoColor=white)
2020
![Jest](https://img.shields.io/badge/-jest-C21325?style=for-the-badge&logo=jest&logoColor=white)
2121
![Canva](https://img.shields.io/badge/Canva-%2300C4CC.svg?&style=for-the-badge&logo=Canva&logoColor=white)
22+
![Jira](https://img.shields.io/badge/Jira-0052CC?style=for-the-badge&logo=Jira&logoColor=white)
23+
![Zoom](https://img.shields.io/badge/Zoom-2D8CFF?style=for-the-badge&logo=zoom&logoColor=white)
24+
![VSCode](https://img.shields.io/badge/VSCode-0078D4?style=for-the-badge&logo=visual%20studio%20code&logoColor=white)
25+
![JSON](https://img.shields.io/badge/json-5E5C5C?style=for-the-badge&logo=json&logoColor=white)
26+
![Prettier](https://img.shields.io/badge/prettier-1A2C34?style=for-the-badge&logo=prettier&logoColor=F7BA3E)
27+
![MacOS](https://img.shields.io/badge/mac%20os-000000?style=for-the-badge&logo=apple&logoColor=white)
28+
![Windows11](https://img.shields.io/badge/Windows_11-0078d4?style=for-the-badge&logo=windows-11&logoColor=white)
29+
![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)
30+
![StackOverflow](https://img.shields.io/badge/Stack_Overflow-FE7A16?style=for-the-badge&logo=stack-overflow&logoColor=white)
31+
![Powershell](https://img.shields.io/badge/powershell-5391FE?style=for-the-badge&logo=powershell&logoColor=white)
32+
![Fiverr](https://img.shields.io/badge/fiverr-1DBF73?style=for-the-badge&logo=fiverr&logoColor=white)
2233

2334
</div>
2435

@@ -157,6 +168,7 @@ Here’s a list of features being considered by our team:
157168
- Enhanced security through change password and email functionality/profile page
158169
- A dark mode and light mode feature to reduce eye strain.
159170
- A completed forgot password and remember me functionality. /additional customizations via a settings page
171+
- Fix CLS gauge so that the marker is at the correct position.
160172

161173
## Contributors
162174

nextlevelpackage/cli.js

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ const { sendToApi } = require('./sendToApi');
55
const { spawn } = require('child_process');
66

77
const bundleBuildAnalyzer = () => {
8-
// const buildURL = `http://localhost:3000/dashboard/api/build`;
9-
// const bundleURL = `http://localhost:3000/dashboard/api/bundle`;
8+
109
const buildURL = `https://www.nextlevel-dash.com/dashboard/api/build`;
1110
const bundleURL = `https://www.nextlevel-dash.com/dashboard/api/bundle`;
1211

@@ -45,32 +44,4 @@ const bundleBuildAnalyzer = () => {
4544
});
4645
}
4746

48-
bundleBuildAnalyzer();
49-
50-
// const { exec } = require('child_process');
51-
// // function that will run next build and collect data, sending to api
52-
// const bundleBuildAnalyzer = () => {
53-
// const buildURL = `http://localhost:3000/dashboard/api/build`;
54-
// const bundleURL = `http://localhost:3000/dashboard/api/bundle`;
55-
56-
// // use exec to run next build and get next bundle analyzer terminal output
57-
// const command = 'ANALYZE=true next build';
58-
// const startTime = Date.now(); // start time before execution
59-
// exec(command, (error, stdout) => {
60-
// if (error) {
61-
// console.error(`error in exec: ${error}`);
62-
// return;
63-
// }
64-
// // compute and send the build time to build time endpoint
65-
// const endTime = Date.now(); // end time after execution has finished
66-
// const buildTime = endTime - startTime;
67-
// console.log('Build time:', buildTime);
68-
// sendToApi({buildTime}, buildURL);
69-
70-
// //bundle analyzer data is console logged in stdout
71-
// const bundleLog = stdout;
72-
// sendToApi({bundleLog}, bundleURL);
73-
// });
74-
// }
75-
76-
// bundleBuildAnalyzer();
47+
bundleBuildAnalyzer();

nextlevelpackage/index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ export default function NextWebVitals() {
1919
const body = JSON.stringify(data);
2020
const url = 'https://www.nextlevel-dash.com/dashboard/api/webvitals';
2121

22-
23-
// if(navigator.sendBeacon) {
24-
// navigator.sendBeacon(url, body);
25-
// } else {
2622
fetch(url, {
2723
method: 'POST',
2824
headers: {
@@ -39,6 +35,5 @@ export default function NextWebVitals() {
3935
}).catch((error) => {
4036
console.error('index.js .catch error Error sending web vitals data:', error);
4137
})
42-
// }
4338
})
4439
}

nextlevelpackage/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nextlevelpackage",
3-
"version": "1.0.6",
3+
"version": "1.0.7",
44
"description": "this package will connect you to the nextlevel dashboard",
55
"main": "index.js",
66
"scripts": {

nextlevelpackage/sendToApi.js

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//const fetch = require('node-fetch');
2-
//this is for importing commonjs, we need to do es6
3-
// got this line from https://stackoverflow.com/questions/69041454/error-require-of-es-modules-is-not-supported-when-importing-node-fetch
41
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
52
require('dotenv').config({ path: '.env.local' });
63

@@ -28,40 +25,4 @@ const sendToApi = (data, url) => {
2825
});
2926
}
3027

31-
module.exports = { sendToApi };
32-
33-
// TRY THIS LATER!!!
34-
// import fetch from 'node-fetch';
35-
// import dotenv from 'dotenv';
36-
// dotenv.config({ path: '.env.local' });
37-
38-
39-
// creating a sendToApi function that will send data to different endpoints
40-
// endpoint for bundle analyzer data, endpoint for build time data
41-
// const sendToApi = async (data, url) => {
42-
// // check if api key is in the environment variables
43-
// if (!process.env.NEXT_PUBLIC_API_KEY) {
44-
// console.log('API key not found in environment variables');
45-
// return;
46-
// }
47-
// const apiKey = process.env.NEXT_PUBLIC_API_KEY;
48-
// const body = JSON.stringify(data);
49-
// try {
50-
// const response = await fetch(url, {
51-
// method: 'POST',
52-
// body,
53-
// headers: {
54-
// 'Content-Type': 'application/json',
55-
// 'API-Key': apiKey
56-
// },
57-
// keepalive: true
58-
// });
59-
// if (!response.ok) {
60-
// throw new Error(`HTTP error, status: ${response.status}`);
61-
// }
62-
// } catch (err) {
63-
// console.log('Error sending data to server:', err);
64-
// };
65-
// }
66-
67-
// module.exports = { sendToApi };
28+
module.exports = { sendToApi };

public/NEXTLEVELANI.mp4

1.38 MB
Binary file not shown.

public/NextLevelGifHomepage.gif

1.1 MB
Loading

public/TransparentGifLogo.gif

1.1 MB
Loading

public/transparent gif v2 (1).gif

-2.01 MB
Binary file not shown.

src/app/about/page.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/app/components/topnav.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function TopNav() {
2424
</div>
2525
<div className={styles.links}>
2626
<Link href="/">Home</Link>
27+
<Link href="https://github.com/oslabs-beta/NextLevel" target="_blank" rel="noopener noreferrer">Docs</Link>
2728
{status === 'authenticated' ? (
2829
<>
2930
<Link href={`/dashboard?username=${session?.user?.email}`}>Dashboard</Link>

src/app/dashboard/components/buildtimemetrics.js renamed to src/app/dashboard/components/BundleLog.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import useBundleData from '../hooks/useBundleData';
44
import { set } from 'mongoose';
55

66

7-
function BuildTimeMetrics({username}) {
7+
function BundleLog({username}) {
88
console.log('entering build time metrics for username:', username);
99

1010
const [bundleLogs, setBundleLogs] = useState([]);
@@ -35,9 +35,9 @@ function BuildTimeMetrics({username}) {
3535
useEffect(() => {
3636
const logsLength = bundleLogs.length;
3737
setCurrentIndex(logsLength - 1);
38-
console.log('Current Index:', currentIndex);
38+
// console.log('Current Index:', currentIndex);
3939
setCurrentLog(bundleLogs[currentIndex]);
40-
console.log('Current Log:', currentLog);
40+
// console.log('Current Log:', currentLog);
4141
}, [bundleLogs]);
4242

4343
const toggleBack = () => {
@@ -83,4 +83,4 @@ function BuildTimeMetrics({username}) {
8383
);
8484
}
8585

86-
export default BuildTimeMetrics;
86+
export default BundleLog;

src/app/dashboard/components/CLSChart.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
} from 'chart.js';
1717
import 'chartjs-adapter-date-fns';
1818
import useWebVitalsData from '../hooks/useWebVitalsData';
19-
import WebVitalsFilter from './webvitalsfilter';
19+
import WebVitalsFilter from './WebVitalsFilter';
2020

2121
ChartJS.register(
2222
CategoryScale,

src/app/dashboard/components/WebVitalRatings.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ const WebVitalRatings = ({ data }) => {
7373
poorRange={[ranges[metric][2],ranges[metric][3]]}
7474
currentValue={val}
7575
metricType={metric}
76-
// className={styles.ratingGauge}
7776
/>
7877
);
7978
});

src/app/dashboard/components/WebVitalsContainer.js

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,11 @@
22

33
import React, { useEffect, useState, useRef } from 'react';
44
import styles from '../dashboard.module.css';
5-
// import { Line } from 'react-chartjs-2';
6-
// import {
7-
// Chart as ChartJS,
8-
// CategoryScale,
9-
// LinearScale,
10-
// PointElement,
11-
// LineElement,
12-
// Title,
13-
// Tooltip,
14-
// Legend,
15-
// TimeScale
16-
// } from 'chart.js';
17-
// import 'chartjs-adapter-date-fns';
185
import useWebVitalsData from '../hooks/useWebVitalsData';
19-
import WebVitalsFilter from './webvitalsfilter';
6+
import WebVitalsFilter from './WebVitalsFilter';
207
import CLSChart from './CLSChart';
218
import WebVitalRatings from './WebVitalRatings';
22-
import WebVitalsChart from './webvitalschart';
23-
24-
// ChartJS.register(
25-
// CategoryScale,
26-
// LinearScale,
27-
// PointElement,
28-
// LineElement,
29-
// Title,
30-
// Tooltip,
31-
// Legend,
32-
// TimeScale
33-
// );
9+
import WebVitalsChart from './WebVitalsChart';
3410

3511
function WebVitalsContainer({ username}) {
3612
const [webVitalsData, setWebVitalsData] = useState([]);
@@ -43,8 +19,8 @@ function WebVitalsContainer({ username}) {
4319
const oneDayAgo = new Date(now.getTime() - (24 * 60 * 60 * 1000));
4420
const defaultStart = oneDayAgo.toISOString().slice(0, 16); // format to 'YYYY-MM-DDTHH:MM'
4521

46-
const [startDate, setStartDate] = useState(defaultStart); // July 18, 2024, at 14:35:50 '2024-07-18T14:35:50'
47-
const [endDate, setEndDate] = useState(defaultEnd); // July 19, 2024, at 11:45:00 '2024-07-19T12:45:00'
22+
const [startDate, setStartDate] = useState(defaultStart);
23+
const [endDate, setEndDate] = useState(defaultEnd);
4824

4925
const onSubmit = (startDate, endDate) => {
5026
setStartDate(startDate);

src/app/dashboard/components/buildtimecontainer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import React from 'react';
22
import styles from '../dashboard.module.css';
3-
import BuildTimeChart from './buildtimechart';
4-
import BuildTimeMetrics from './buildtimemetrics';
3+
import BuildTimeChart from './BuildTimeChart';
4+
import BundleLog from './BundleLog';
55

66
function BuildTimeContainer({ username }) {
77
return (
88
<div className={styles.chartContainer}>
99
<h2 className={styles.chartTitle}>Build Time</h2>
1010
<div className={styles.buildCharts}>
1111
<BuildTimeChart className={styles.buildTimeDiv} username={username}/>
12-
<BuildTimeMetrics username={username}/>
12+
<BundleLog username={username}/>
1313
</div>
1414
</div>
1515
);

src/app/dashboard/components/sidebar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { IoSettingsOutline } from "react-icons/io5";
33
import Link from 'next/link';
44

55
function SideBar(props) {
6-
console.log('Props sidebar:', props);
6+
// console.log('Props sidebar:', props);
77
const username = props.username;
8-
console.log('Username sidebar:', username);
8+
// console.log('Username sidebar:', username);
99
return (
1010
<div className={styles.sidebar}>
1111
<div className={styles.sidebarTop}>

src/app/dashboard/components/webvitalschart.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@ function WebVitalsChart({ webVitalsData }) {
116116
display: true,
117117
text: 'Date/Time',
118118
},
119-
// ticks: {
120-
// source: 'data', // Ensures only data points are used for ticks
121-
// },
122119
},
123120
y: {
124121
title: {

src/app/dashboard/hooks/useBuildTimeData.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
import React, { useEffect, useState } from 'react';
44

55
const useBuildTimeData = async (username) => {
6-
console.log('entering use effect useBuildTimeData for:', username);
6+
// console.log('entering use effect useBuildTimeData for:', username);
77
try {
88
// const res = await fetch(`https://nextlevel-dash.com/dashboard/api/build?username=${username}`);
99
const res = await fetch(`http://localhost:3000/dashboard/api/build?username=${username}`);
1010
if (res.ok) {
11-
console.log('Res from useBuildTimeData:', res);
11+
// console.log('Res from useBuildTimeData:', res);
1212
const data = await res.json();
13-
console.log('Data from useBuildTimeData:', data);
13+
// console.log('Data from useBuildTimeData:', data);
1414
return data;
1515
} else {
1616
console.error('Response not ok');

src/app/dashboard/hooks/useBundleData.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
import React, { useEffect, useState } from 'react';
44

55
const useBundleData = async (username) => {
6-
console.log('entering use effect usebundledata for:', username);
6+
// console.log('entering use effect usebundledata for:', username);
77
try {
88
// const res = await fetch(`https://nextlevel-dash.com/dashboard/api/bundle?username=${username}`);
99
const res = await fetch(`http://localhost:3000/dashboard/api/bundle?username=${username}`);
1010
if (res.ok) {
11-
console.log('res from useBundleData:', res);
11+
// console.log('res from useBundleData:', res);
1212
const data = await res.json();
13-
console.log('Data from useBundleData:', data);
13+
// console.log('Data from useBundleData:', data);
1414
return data;
1515
} else {
1616
console.error('Response not ok');

src/app/dashboard/hooks/useWebVitalsData.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ async function fetchWebVitals (username, metricType, startDate, endDate) {
55
// const res = await fetch(`https://nextlevel-dash.com/dashboard/api/webvitals?username=${username}&metricType=${metricType}`);
66
const res = await fetch(`http://localhost:3000/dashboard/api/webvitals?username=${username}&metricType=${metricType}&start=${startDate}&end=${endDate}`);
77
if (res.ok) {
8-
console.log('Res from useWebVitalsData:', res);
8+
// console.log('Res from useWebVitalsData:', res);
99
const resData = await res.json();
10-
console.log('Data from useWebVitalsData:', resData);
10+
// console.log('Data from useWebVitalsData:', resData);
1111
return resData; //array of obj with all metric types
1212
} else {
1313
console.error('Response not ok');
@@ -20,11 +20,11 @@ async function fetchWebVitals (username, metricType, startDate, endDate) {
2020
}
2121

2222
const useWebVitalsData = async (username, startDate, endDate) => {
23-
console.log('entering use effect useWebVitalsData for:', username);
23+
// console.log('entering use effect useWebVitalsData for:', username);
2424
const metricTypes = ['FCP', 'LCP', 'TTFB', 'FID', 'INP', 'CLS'];
2525
try {
2626
const metricsCombined = await Promise.all(metricTypes.map(metricType => fetchWebVitals(username, metricType, startDate, endDate)));
27-
console.log('Metrics Combined:', metricsCombined.flat());
27+
// console.log('Metrics Combined:', metricsCombined.flat());
2828
return metricsCombined.flat(); // Flatten the array of arrays into a single array
2929
} catch (error) {
3030
console.error('Error in useWebVitals:', error);

src/app/dashboard/page.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import React, { useEffect, useState } from 'react';
44
import styles from './dashboard.module.css';
55
import WebVitalsContainer from './components/WebVitalsContainer';
66
import APIKey from './components/APIkey';
7-
import BuildTimeContainer from './components/buildtimecontainer';
7+
import BuildTimeContainer from './components/BuildTimeContainer';
88
import withAuth from '../components/withAuth';
9-
import SideBar from './components/sidebar';
9+
import SideBar from './components/Sidebar';
1010

1111
function Dashboard(props) {
12-
console.log('Props:', props);
12+
// console.log('Props:', props);
1313
const username = props.searchParams.username;
14-
console.log('Username:', username);
14+
// console.log('Username:', username);
1515

1616
return (
1717
<div className={styles.dashboardContainer}>

src/app/dashboard/settings/page.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//not currently in use
2+
13
import React from 'react'
24

35
const Settings = () => {

src/app/globals.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ body, html {
44
padding: 0;
55
font-family: 'Poppins', sans-serif;
66
height: 100%;
7-
background-color: hsl(240, 7%, 8%);
7+
background-color: #1b212c;
88
/* display: flex;
99
justify-content: center;
1010
align-items: center; */

0 commit comments

Comments
 (0)