Skip to content

Commit

Permalink
Merge pull request #63 from wethmiranasinghe/main
Browse files Browse the repository at this point in the history
Action buttons for news added
  • Loading branch information
wethmiranasinghe authored Jul 16, 2024
2 parents 7e3c846 + eb3ec73 commit 8bbbe7b
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class AppUser implements UserDetails {
)
@Id
@GeneratedValue(

strategy = GenerationType.SEQUENCE,
generator = "member_sequence"
)
Expand Down
2 changes: 1 addition & 1 deletion back-end/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ server:
spring:
datasource:
url: jdbc:mysql://localhost:3306/cycle
password: "&*531cW9/?"
password:
username: root
driver-class-name: com.mysql.cj.jdbc.Driver
jpa:
Expand Down
2 changes: 1 addition & 1 deletion front-end/src/Pages/Contact.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function Contact() {
<ul>
<li><FontAwesomeIcon className = "contactIcons" icon={faUser} /> <a href="https://people.ce.pdn.ac.lk/staff/academic/upul/">Dr. Upul Jayasinghe</a></li>
<li><FontAwesomeIcon className = "contactIcons" icon={faPhone} /> <a href="tel:+94760416590">+94 76 0416 590</a></li>
<li><FontAwesomeIcon className = "contactIcons" icon={faEnvelope} /> <a href="mailto:eftu@eng.pdn.ac.lk">eftu@eng.pdn.ac.lk</a></li>
<li><FontAwesomeIcon className = "contactIcons" icon={faEnvelope} /> <a href="mailto:upuljm@eng.pdn.ac.lk">upuljm@eng.pdn.ac.lk</a></li>
</ul>
</nav>
</div>
Expand Down
6 changes: 3 additions & 3 deletions front-end/src/Pages/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import { faGraduationCap, faShield, faUsers, faBuilding} from '@fortawesome/free
const fadeImages = [
{
url: 'https://lh3.googleusercontent.com/pw/AP1GczM5KKxhVpddOvmafamm46DH9DtSlJKvRTUcoibtfAmrs0ySHY0-KIND3m8kO8xNC5v0aRCSn0z4T3C9ub8iBIyI6vgq9XCWexwDvEt24miVwBLABA=w2400',
caption: 'Third Slide'
caption: ''
},
{
url: 'https://lh3.googleusercontent.com/pw/AP1GczOf4JkUYn4FXbDiHPPs5iy-EU_cS3YeO7X650OK1bGajP9ApyK5V4PKmQpnoIroDJb4QSRSZR_bG8KNpfY4PRJrAqA3wKZhUZRaGy4DaO5Nhvte8w=w2400',
caption: 'Third Slide'
caption: ''
},
{
url: 'https://lh3.googleusercontent.com/pw/AP1GczNKdk1z2rkWNBQ2zNRCdqWn_9KensUFqQ_AcjYPxVQV79vqJMnFImwFCYWh3ETzNxdTe9YDkbatKXq_eRgy2jas2ZrMmJbLjYjzKk5RIbWW8s2Org=w2400',
caption: 'Third Slide'
caption: ''
},
];

Expand Down
20 changes: 20 additions & 0 deletions front-end/src/Pages/News.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React, { useEffect, useState } from "react";
import axios from "axios";
import { loggedInUser } from '../Pages/Login';
import '../components/News.css'; // Import your CSS file
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faPen, faEye, faTrash } from '@fortawesome/free-solid-svg-icons';

const fetchNews = async () => {
try {
Expand Down Expand Up @@ -53,6 +55,17 @@ const News = () => {
});
};

const onDeleteClick = async (newsID) => {
console.log("Delete button clicked");
console.log(newsID);
try {
await axios.delete(`http://localhost:8080/api/v1/news/${newsID}`);
fetchNews();
} catch (error) {
console.error("Error deleting deliverable:", error);
}
}

return (
<>
<div className="News">
Expand Down Expand Up @@ -109,6 +122,13 @@ const News = () => {
<b><p>Date: {item.newsDate}</p></b>
<b><p>Author: {item.newsAuthor}</p></b>
<a href={item.newsUrl} target="_blank" rel="noopener noreferrer">Read more</a>
{loggedInUser.isLoggedIn && <td>
<div>
<button className="actionButton" onClick={() => onEditClick(newsData)}><FontAwesomeIcon icon={faPen}/></button>
<button className="actionButton" onClick={() => onViewClick(newsData)}><FontAwesomeIcon icon={faEye}/></button>
<button className="actionButton" onClick={() => onDeleteClick(item.newsID)}><FontAwesomeIcon icon={faTrash} /></button>
</div>
</td>}
</div>
))}
</div>
Expand Down
2 changes: 1 addition & 1 deletion front-end/src/Pages/Team.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Team() {
<li className = "TeamMemberName">Dr. Upul Jayasinghe</li>
<li>Manager</li>
<li><a href="tel:+94760416590">+94 76 041 6590</a></li>
<li><a href="mailto:[email protected]">eftu@eng.pdn.ac.lk</a></li>
<li><a href="mailto:[email protected]">upuljm@eng.pdn.ac.lk</a></li>
</ul>
</div>

Expand Down
2 changes: 1 addition & 1 deletion front-end/src/components/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function Footer() {
<ul>
<li>Manager: <a href="https://people.ce.pdn.ac.lk/staff/academic/upul/">Dr. Upul Jayasinghe</a></li>
<li>Tel: <a href="tel:+94760416590">+94 76 0416 590</a></li>
<li>Email: <a href="mailto:eftu@eng.pdn.ac.lk">eftu@eng.pdn.ac.lk</a></li>
<li>Email: <a href="mailto:upuljm@eng.pdn.ac.lk">upuljm@eng.pdn.ac.lk</a></li>

<li> Coordinator: <a href="https://sci.pdn.ac.lk/scs/staff/Erunika-Dayaratna">Dr. Erunika Dayaratna</a></li>
<li>Tel: <a href="tel:+94766986500">+94 76 698 6500</a></li>
Expand Down
1 change: 0 additions & 1 deletion front-end/src/components/Header.css
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@
.headerNavBar .menu{
display: none;
position: absolute;
top: 1rem;
right: 3rem;
flex-direction: column;
justify-content: space-between;
Expand Down
17 changes: 12 additions & 5 deletions front-end/src/components/News.css
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,15 @@
text-decoration: underline;
}

/* @media screen and (max-width: 1220px) {
.News{
display: none;
}
} */

.actionButton{
margin-right: 5px;
padding:0;
background-color:#ffffff;
border: none;
cursor: pointer;
transition: background-color 0.2s ease;
color: #000;
align-items: right;
}

2 changes: 1 addition & 1 deletion front-end/src/components/Overview.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@

/* CYCLE overview and goals titles */
.overview-para h3, .Goals h3 {
color:hsl(211, 57%, 59%);
color: #000;
}
4 changes: 2 additions & 2 deletions front-end/src/components/Team.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
text-align: left;
margin-bottom: 1%;
font-size: 18px;
color: hsl(211, 57%, 59%);
color: #004494;
}

.TeamCards {
Expand Down Expand Up @@ -58,7 +58,7 @@
}

.TeamCard a{
color: hsl(211, 57%, 59%); /* Default link color */
color: #004494; /* Default link color */
text-decoration: none;
font-size: 16px;
}
Expand Down

0 comments on commit 8bbbe7b

Please sign in to comment.