Skip to content

Commit

Permalink
Merge pull request #86 from e20178dulanga/main
Browse files Browse the repository at this point in the history
Updated Downloads page
  • Loading branch information
e20178dulanga authored Sep 14, 2024
2 parents 8dbd5bf + c0662d4 commit 99c23fc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 60 deletions.
32 changes: 9 additions & 23 deletions front-end/src/Pages/Downloads.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import fileDownload from '../assets/download.png';
import fileDownload1 from '../assets/download2.png';
import { loggedInUser } from '../Pages/Login';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faDownload ,faTrash } from '@fortawesome/free-solid-svg-icons';
import { faDownload ,faTrash, faEye } from '@fortawesome/free-solid-svg-icons';


const FileUploadDownload = () => {
Expand Down Expand Up @@ -47,7 +46,7 @@ const FileUploadDownload = () => {

const handleUpload = async () => {
if (!selectedFile && !youtubeLink) {
alert('Please select a file or enter a YouTube link!');
alert('Please select a file or enter a URL for the file!');
return;
}

Expand Down Expand Up @@ -149,19 +148,6 @@ const FileUploadDownload = () => {
</nav>
</div>

<div className="downloadLinks">
<nav>
<h4>Downloads For Students and PGIS Staff</h4>
<img src={fileDownload1} alt="fileDownload1" />
<a className="openlink" href="http://www.pgis.pdn.ac.lk/downloads/students.php">
<p>PGIS Downloads page for Students</p>
</a>
<a className="openlink" href="http://www.pgis.pdn.ac.lk/downloads/staff.php">
<p>PGIS Downloads page for Staff</p>
</a>
</nav>
</div>

{loggedInUser.isLoggedIn && (
<div className="upload-section">
<button className="addcancelbutton" onClick={() => setShowUploadForm(!showUploadForm)}>
Expand All @@ -179,7 +165,7 @@ const FileUploadDownload = () => {
/>
<input
type="url"
placeholder="Enter the YouTube link (optional)"
placeholder="Enter the URL"
value={youtubeLink}
onChange={handleYoutubeLinkChange}
/>
Expand All @@ -188,7 +174,7 @@ const FileUploadDownload = () => {
type="checkbox"
checked={visibleToAll}
onChange={handleVisibilityChange}
/> Set Visible to All
/> Set Visible to Public
</label>
<button onClick={handleUpload}>Upload Content</button>
</div>
Expand All @@ -199,7 +185,7 @@ const FileUploadDownload = () => {
{errorMessage && <p className="error">{errorMessage}</p>}

<div className="downloadSection">
<h4>Download Files here</h4>
{/* <h4>Download Files here</h4> */}
{visibleToAllFiles.length > 0 ? (
visibleToAllFiles.map(file => (
<div key={file.fileId} className="fileItem">
Expand All @@ -208,7 +194,7 @@ const FileUploadDownload = () => {
<p>{file.displayName}</p>
<div className="fileActions">
<a href={file.youtubeLink} target="_blank" rel="noopener noreferrer">
Watch Video
<FontAwesomeIcon icon={faEye}/>
</a>
{loggedInUser.isLoggedIn && (
<button onClick={() => handleDelete(file.fileId)}>
Expand Down Expand Up @@ -236,12 +222,12 @@ const FileUploadDownload = () => {
</div>
))
) : (
<p>No files visible to all</p>
<p>No files visible to Public</p>
)}

{loggedInUser.isLoggedIn && (
<>
<h4>Files for the CYCLE Team</h4>
<h4>Files Only for the CYCLE Team</h4>
{visibleToLoggedInFiles.length > 0 ? (
visibleToLoggedInFiles.map(file => (
<div key={file.fileId} className="fileItem">
Expand All @@ -250,7 +236,7 @@ const FileUploadDownload = () => {
<p>{file.displayName}</p>
<div className="fileActions">
<a href={file.youtubeLink} target="_blank" rel="noopener noreferrer">
Watch Video
<FontAwesomeIcon icon={faEye}/>
</a>
<button onClick={() => handleDelete(file.fileId)}>
<FontAwesomeIcon icon={faTrash} />
Expand Down
Binary file removed front-end/src/assets/download2.png
Binary file not shown.
38 changes: 1 addition & 37 deletions front-end/src/components/Download.css
Original file line number Diff line number Diff line change
Expand Up @@ -190,42 +190,6 @@
color: #000000;
}


.downloadLinks {
border: 2px solid rgba(10, 48, 128);
border-radius: 20px;
background-color: #e1edf9;
padding: 10px;
display: center;
margin-left: 5%;
margin-right: 5%;
margin-bottom: 2%;
text-align: center;
width: auto;
font-family: 'Caudex';

}

.downloadLinks img {
height: 200px;
width: auto;
}

.downloadLinks p {
font-size: 16px;
color: rgb(30, 85, 148);
}

.downloadLinks h4 {
font-size: 20px;
color: rgba(10, 48, 128);
}

.downloadLinks p:hover {
font-size: 16px;
color: hsl(211, 63%, 69%);
}

.addcancelbutton {
width: 110px;
height: 40px;
Expand Down Expand Up @@ -262,6 +226,6 @@

.fileActions {
justify-content: flex-start; /* Align buttons to the left */
width: 50%; /* Allow the buttons to take full width */
width: 15%; /* Allow the buttons to take full width */
}
}

0 comments on commit 99c23fc

Please sign in to comment.