Skip to content

Commit

Permalink
Final Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanyam-2026 committed Jan 6, 2024
1 parent 17e0f95 commit 80440d5
Show file tree
Hide file tree
Showing 14 changed files with 181 additions and 110 deletions.
8 changes: 7 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"react-toastify": "^9.1.3",
"redux": "^4.2.1",
"redux-devtools-extension": "^2.13.9",
"redux-thunk": "^2.4.2"
"redux-thunk": "^2.4.2",
"reselect": "^5.0.1"
},
"devDependencies": {
"@types/react": "^18.2.15",
Expand Down
32 changes: 25 additions & 7 deletions src/components/DashboardComponents/FileComponent/FileComponent.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@

.center-div{
margin: 0 auto;
width: 50%;
padding: 10px;
text-align: center;

border-radius: 10px;

text-align: center;
}

.center-div>h4{
padding-bottom: 20px;
color: whitesmoke;

}
.phone-msg{
display: none;
}
.glow-on-hover {

Expand Down Expand Up @@ -66,4 +69,19 @@
0% { background-position: 0 0; }
50% { background-position: 400% 0; }
100% { background-position: 0 0; }
}
.bottom-space{
margin-bottom: 30px;
}

@media screen and (max-width: 768px) {
.center-div>h4{
display: none;

}
.phone-msg{
display: block !important;
padding-bottom: 20px;
color: whitesmoke;
}
}
43 changes: 15 additions & 28 deletions src/components/DashboardComponents/FileComponent/FileComponent.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { useEffect, useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { useSelector, shallowEqual } from 'react-redux';
import Header from './Header';
import CodeEditor from './CodeEditor';

import './FileComponent.css';

const FileComponent = () => {
Expand Down Expand Up @@ -34,10 +33,12 @@ const FileComponent = () => {
const link = document.createElement('a');
link.href = currentFile?.data.url;
link.target = '_blank';
link.rel = 'noopener noreferrer'; // Added for security reasons
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};


useEffect(() => {
// Trigger the downloadFile function when the component mounts
Expand All @@ -46,35 +47,21 @@ const FileComponent = () => {

if (isAuthenticated) {
return (
<div>
{isAuthenticated && fileData !== null ? (
<>
<Header fileName={currentFile?.data.name} fileId={fileId} />
<CodeEditor fileName={currentFile?.data.name} data={fileData} setData={setFileData} />
</>
) : (
<div >
{/* Sub Menu Bar */}
<div className=' '>
<p
title={currentFile?.data.name}
className='my-0'
style={{ cursor: 'pointer' }}
>
{currentFile?.data.name.length > 40
? currentFile?.data.name.slice(0, 40) + '... .' + currentFile?.data.extention
: currentFile?.data.name}
</p>

<div className='center-div'>
<button className='glow-on-hover' onClick={() => navigate(-3)}>
Go Back

<h4 >File Opened in New Tab</h4>
<h4 className='phone-msg'>File is Downloaded</h4>

<button className='glow-on-hover bottom-space' onClick={() => navigate("/dashboard")}>
Go Back ! 😎
</button>
{/* The download button is automatically triggered by the useEffect hook */}
</div>


</div>
</div>
)}
</div>



);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const FolderComponent = () => {
</>
) :
(
<p className="text-center my-5"> Empty Folder</p>
<p className="text-center my-5 color-white"> Notes will be updated Soon...</p>
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const HomeComponent = () => {

{
isLoading ? (
<h1 className="display-1 my-5 text-center text-info">Loading...</h1>
<h1 className="display-1 my-5 text-center text-info"> Please wait Loading...</h1>

):(

Expand Down
30 changes: 30 additions & 0 deletions src/components/DashboardComponents/HomeComponent/selectors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// selectors.js

import { createSelector } from 'reselect';

const selectFileFoldersState = (state) => state.filefolders;

export const selectUserFolders = createSelector(
[selectFileFoldersState],
(filefolders) => filefolders.userFolders.filter((folder) => folder.data.parent === "root")
);

export const selectUserFiles = createSelector(
[selectFileFoldersState],
(filefolders) => filefolders.userFiles.filter((file) => file.data.parent === "root")
);

export const selectCurrentFolder = createSelector(
[selectFileFoldersState],
(filefolders) => filefolders.currentFolder
);

export const selectHomeComponentData = createSelector(
[selectFileFoldersState, selectUserFolders, selectUserFiles, selectCurrentFolder],
(filefolders, userFolders, userFiles, currentFolder) => ({
isLoading: filefolders.isLoading,
userFolders,
userFiles,
currentFolder,
})
);
5 changes: 2 additions & 3 deletions src/components/DashboardComponents/ShowItems/ShowItems.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const ShowItems = ({ title, items, type }) => {

return (
<div className='show-items'>
{/* <h1 className='text-center'>{title}</h1> */}

<div className="items-container">
{items.map((item, index) => (
<div
Expand All @@ -32,8 +32,7 @@ const ShowItems = ({ title, items, type }) => {


<img src={type === 'file' ? "../../../../public/assets/file-icon.png" : "../../../../public/assets/folder-icon.png"} alt={type === 'file' ? "File Icon" : "Folder Icon"} />



<span>{item.data?.name}</span>
</div>
))}
Expand Down
78 changes: 45 additions & 33 deletions src/components/DashboardComponents/SubBar/SubBar.css
Original file line number Diff line number Diff line change
@@ -1,63 +1,75 @@
/* SubBar.css */

.navbar {
background-color: #d44040;
/* Default styles */
.breadcrumb-container {
margin-left: 3em;
}

.breadcrumb {
background-color: #fff;
font-size: 16px;
margin-bottom: 0;
.breadcrumb-nav {
background: linear-gradient(to right, #373b44, #2f3031);
border: none;
outline: none;
box-shadow: none;
color: rgb(131, 255, 253);
font-size: large;
padding-left: 10px;
}

.breadcrumb-item {
color: #333;
.breadcrumb-nav:hover {
color: #ffc107;
}

.breadcrumb-item:hover {
color: #ffc107;
}
.navbar-nav{
.navbar-nav {
display: flex;

justify-content: center;
/* margin-left: 300px !important; */
}

.navbar-nav .btn {
background-color: transparent;
border: none;
color: rgb(131, 255, 253);
font-size: 24px;
margin-right: 5px;
transition: all 0.3s ease-in-out;

background-color: transparent;
border: none;
color: rgb(131, 255, 253);
font-size: 24px;
margin-right: 5px;
transition: all 0.3s ease-in-out;
}

.navbar-nav .btn:hover {
color: #ffc107;
transform: scale(1.2);
box-shadow: 0 0 10px rgba(255, 193, 7, 0.7);
color: #ffc107;
transform: scale(1.2);
box-shadow: 0 0 10px rgba(255, 193, 7, 0.7);
}

.btn-outline-dark {
border-color: #333;
color: #333;
border-color: #333;
color: #333;
}

.btn-outline-dark:hover {
border-color: #ffc107;
color: #ffc107;
border-color: #ffc107;
color: #ffc107;
}

.btn-primary {
background-color: #007bff;
border-color: #007bff;
background-color: #007bff;
border-color: #007bff;
}

.btn-primary:hover {
background-color: #0056b3;
border-color: #0056b3;
background-color: #0056b3;
border-color: #0056b3;
}

/* Responsive styles */
@media screen and (max-width: 768px) {
.breadcrumb-container {
margin-left: 1em;
}

/* Additional style for contribute button */
.breadcrumb-nav {
font-size: medium;
}

.navbar-nav .btn {
font-size: 18px;
}
}
27 changes: 11 additions & 16 deletions src/components/DashboardComponents/SubBar/SubBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,44 +28,44 @@ const Subbar = ({
};

return (
<nav className="">
<nav className="ms-5" aria-label="breadcrumb">
<nav >
<nav className="breadcrumb-container" aria-label="breadcrumb">
<ol className="breadcrumb d-flex align-items-center">
{currentFolder !== "root" ? (
<>
<button
className="breadcrumb-item btn btn-link text-decoration-none"
className="breadcrumb-nav"
onClick={() => handleNavigate("/dashboard", "root")}
>
Root
Root /
</button>
{currentFolderData?.data.path.map((folder, index) => (
<button
key={index}
className="breadcrumb-item btn btn-link text-decoration-none"
className="breadcrumb-nav"
onClick={() =>
handleNavigate(
`/dashboard/folder/${userFolders.find((fldr) => folder === fldr.docId).docId}`,
userFolders.find((fldr) => folder === fldr.docId).docId)}
>
{userFolders.find((fldr) => folder === fldr.docId).data.name}
{userFolders.find((fldr) => folder === fldr.docId).data.name} /
</button>
))}
<li className="breadcrumb-item active">
{currentFolderData?.data.name}
<li className="breadcrumb-nav">
{currentFolderData?.data.name}
</li>
</>
) : (
<>
<li className="breadcrumb-item active">
<li className="breadcrumb-nav">

</li>
</>
)}
</ol>
</nav>

{user.uid === "T3XBsF3xtDMgTRQIi7xVQYqffpe2" ? (
{user.uid === "T3XBsF3xtDMgTRQIi7xVQYqffpe2" ||user.uid === "mpAHtp6Xooci6muNldHwOx1I8K53" ? (
<>
<ul className="navbar-nav">
<li className="nav-item mx-2">
Expand All @@ -85,12 +85,7 @@ const Subbar = ({
</>
) : (
<ul className="navbar-nav ms-auto">
<li className="nav-item mx-2">





<li className="nav-item mx-2">
</li>
</ul>
)}
Expand Down
Loading

0 comments on commit 80440d5

Please sign in to comment.