Skip to content

Commit

Permalink
Resolved comments up until the transcription endpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
naheyansheikh committed Dec 5, 2024
1 parent 545c5f2 commit 6aa6859
Show file tree
Hide file tree
Showing 15 changed files with 404 additions and 250 deletions.
113 changes: 47 additions & 66 deletions frontend/src/components/ContentHeader/ContentHeader.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
align-items: center;
}

.actions-wrapper {
position: relative;
}

.actions-button {
background: white;
color: #000000; /* SECONDARY_COLOR */
Expand All @@ -41,8 +45,47 @@
font-weight: 600;
}

.actions-button:hover {
background: #f0f5ff;
.actions-button-active {
background-color: #333A3F;
color: white;
border-color: #000000;
}

.actions-dropdown {
position: absolute;
top: calc(100% + 0.5rem);
right: 0;
background-color: white;
border-radius: 0.5rem;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
min-width: 10rem;
z-index: 50;
border: 1px solid #E5E7EB;
}

.action-item {
display: flex;
align-items: center;
width: 100%;
gap: 0.75rem;
padding: 0.75rem 2rem;
color: #374151;
font-size: 0.875rem;
cursor: pointer;
transition: background-color 0.2s;
border: none;
background: none;
text-align: left;
}

.action-item:hover {
background-color: #F3F4F6;
}

.action-item svg {
width: 1.25rem;
height: 1.25rem;
color: #244B94;
}

.add-button {
Expand Down Expand Up @@ -72,71 +115,9 @@
.down-icon {
width: 18px;
height: 18px;
}

.back-button {
background: none;
border: none;
padding: 0.5rem;
cursor: pointer;
color: #2B4B96;
}

.preview-button {
background: none;
border: none;
padding: 0.5rem;
cursor: pointer;
color: #333333;
font-weight: 400;
font-size: 1.3rem;
display: flex;
align-items: center;
gap: 10px;
flex-direction: row-reverse;
}

.preview-icon {
width: 30px;
height: 30px;
stroke-width: 2;
color: #244B94;
}

.upload-back-icon {
width: 30px;
height: 30px;
stroke-width: 3;
color: #2B4B96;
transition: transform 0.2s ease;
}

.upload-back-icon:hover {
transform: translateX(-5px);
}

.title-wrapper {
display: flex;
justify-content: center;
}

.upload-photo-title {
color: #1E1E1E;
font-size: 1.8rem;
font-weight: 600;
margin: 0;
padding-bottom: 0.5rem;
width: fit-content;
border-bottom: 2px solid #ECEBED;
}

.upload-photo-header {
position: absolute;
left: 230px;
top: 18%;
display: flex;
width: 80%;
justify-content: space-between;
align-items: center;
padding-bottom: 4px;
.down-icon-active {
transform: rotate(180deg);
}
95 changes: 52 additions & 43 deletions frontend/src/components/ContentHeader/ContentHeader.jsx
Original file line number Diff line number Diff line change
@@ -1,63 +1,72 @@
import { useLocation, useNavigate } from "react-router-dom";
import {
PlusIcon,
ChevronDownIcon,
ChevronDoubleLeftIcon,
ChevronLeftIcon,
} from "@heroicons/react/24/outline";
import { PlusIcon, ChevronDownIcon } from "@heroicons/react/24/outline";
import "./ContentHeader.css";
import { useState, useRef, useEffect } from "react";

export default function ContentHeader({ onPreviewClick }) {
const location = useLocation();
const navigate = useNavigate();
const isHistory = location.pathname === "/history";
const isUploadPhoto = location.pathname === "/upload-photo";

if (isUploadPhoto) {
return (
<div className="upload-photo-header">
<button className="back-button" onClick={() => navigate("/home")}>
<ChevronLeftIcon className="upload-back-icon" />
</button>
<div className="title-wrapper">
<h2 className="upload-photo-title">Upload Photos</h2>
</div>
<button className="preview-button" onClick={onPreviewClick}>
Preview
<ChevronDoubleLeftIcon className="preview-icon" />
</button>
</div>
);
}

export default function ContentHeader({ header, primaryButtonText, actions }) {
return (
<div className="content-header">
<h2>{isHistory ? "Log History" : "Logbooks"}</h2>
<h2>{header}</h2>
<div className="button-group">
<AddButton
variant={isHistory ? "history" : "logbook"}
onClick={() => {}}
/>
<ActionsButton onClick={() => {}} />
<AddButton text={primaryButtonText} onClick={() => {}} />
<ActionsButton actions={actions} onClick={() => {}} />
</div>
</div>
);
}

function AddButton({ variant = "logbook", onClick = () => {} }) {
function AddButton({ text, onClick = () => {} }) {
return (
<button onClick={onClick} className="add-button">
{variant === "history" ? "Add Logs" : "Add Book"}
{text}
<PlusIcon className="plus-icon" />
</button>
);
}

function ActionsButton({ onClick = () => {} }) {
function ActionsButton({ actions, onClick = () => {} }) {

Check failure on line 26 in frontend/src/components/ContentHeader/ContentHeader.jsx

View workflow job for this annotation

GitHub Actions / build (18.x)

'onClick' is assigned a value but never used

Check failure on line 26 in frontend/src/components/ContentHeader/ContentHeader.jsx

View workflow job for this annotation

GitHub Actions / build (20.x)

'onClick' is assigned a value but never used

Check failure on line 26 in frontend/src/components/ContentHeader/ContentHeader.jsx

View workflow job for this annotation

GitHub Actions / build (18.x)

'onClick' is assigned a value but never used

Check failure on line 26 in frontend/src/components/ContentHeader/ContentHeader.jsx

View workflow job for this annotation

GitHub Actions / build (20.x)

'onClick' is assigned a value but never used
const [isOpen, setIsOpen] = useState(false);
const dropdownRef = useRef(null);

useEffect(() => {
function handleClickOutside(event) {
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
setIsOpen(false);
}
}

document.addEventListener("mousedown", handleClickOutside);
return () => document.removeEventListener("mousedown", handleClickOutside);
}, []);

return (
<button onClick={onClick} className="actions-button">
<span>Actions</span>
<ChevronDownIcon className="down-icon" />
</button>
<div className="actions-wrapper" ref={dropdownRef}>
<button
onClick={() => setIsOpen(!isOpen)}
className={`actions-button ${isOpen ? "actions-button-active" : ""}`}
>
<span>Actions</span>
<ChevronDownIcon
className={`down-icon ${isOpen ? "down-icon-active" : ""}`}
/>
</button>

{isOpen && (
<div className="actions-dropdown">
{actions.map((action, index) => (
<button
key={index}
className="action-item"
onClick={() => {
action.onClick();
setIsOpen(false);
}}
>
{action.icon && <action.icon />}
{action.label}
</button>
))}
</div>
)}
</div>
);
}
19 changes: 0 additions & 19 deletions frontend/src/components/Home/Header/WelcomeSection.css

This file was deleted.

12 changes: 0 additions & 12 deletions frontend/src/components/Home/Header/WelcomeSection.jsx

This file was deleted.

12 changes: 0 additions & 12 deletions frontend/src/components/Home/LeftSection/BottomSection.jsx

This file was deleted.

13 changes: 0 additions & 13 deletions frontend/src/components/Home/LeftSection/MainContent.css

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
.content-grid {
display: grid;
grid-template-columns: 1fr 1.2fr;
gap: 24px;
height: auto;
}

.bottom-section {
display: grid;
grid-template-columns: 1fr 1fr;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { useState } from "react";
import { useNavigate } from "react-router-dom";
import { useAuth } from "../../../contexts/AuthContext";
import WelcomeSection from "../Header/WelcomeSection";
import GetStartedCard from "./GetStartedCard";
import BottomSection from "./BottomSection";
import LogbooksCard from "../RightSection/LogbooksCard";
import GetStartedCard from "./LeftSection/GetStartedCard";
import LogbooksCard from "./RightSection/LogbooksCard";
import ShopBooksCard from "./LeftSection/ShopBooksCard";
import RecentActivityCard from "./LeftSection/RecentActivityCard";
import "./MainContent.css";

export default function MainContent() {
const navigate = useNavigate();
const [setSelectedLog] = useState(null);
const { session } = useAuth();

const handleAddLogbook = () => {
navigate("/newLog");
Expand Down Expand Up @@ -62,26 +60,29 @@ export default function MainContent() {
];

return (
<div className="dashboard-container">
<WelcomeSection
firstName={session?.user?.user_metadata?.first_name || "User"}
/>
<div className="content-grid">
<div>
<GetStartedCard
handleAddLogbook={handleAddLogbook}
handleViewHistory={handleViewHistory}
/>

<div className="content-grid">
<div>
<GetStartedCard
handleAddLogbook={handleAddLogbook}
handleViewHistory={handleViewHistory}
/>
<BottomSection recentActivities={recentActivities} />
</div>

<BottomSection recentActivities={recentActivities} />
</div>
<LogbooksCard
progressItems={progressItems}
setSelectedLog={setSelectedLog}
/>
</div>
);
}

<LogbooksCard
progressItems={progressItems}
setSelectedLog={setSelectedLog}
/>
</div>
function BottomSection({ recentActivities }) {
return (
<div className="bottom-section">
<ShopBooksCard />
<RecentActivityCard recentActivities={recentActivities} />
</div>
);
}
Loading

0 comments on commit 6aa6859

Please sign in to comment.