Skip to content

Commit

Permalink
Merge branch 'master' into final-update
Browse files Browse the repository at this point in the history
  • Loading branch information
joyc7 committed Dec 7, 2023
2 parents e41744c + 26d704e commit 3662e34
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 60 deletions.
1 change: 0 additions & 1 deletion .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
pwd
cd 4-final-project-group-bill-splitting-app
git pull origin master
docker-compose down
Expand Down
9 changes: 4 additions & 5 deletions front-end/src/components/AddEvent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,11 @@ function AddEvent({ addEvent, onClose }) {
if (decodedUser && decodedUser.id) {
friendsCL(decodedUser.id);
setselectedMember((prevMembers) => {
// Check if the current user's ID is already in the selected members
if (prevMembers.some((member) => member.id === decodedUser.id)) {
return prevMembers;
// Correctly check if the user ID is already in the array
if (!prevMembers.includes(decodedUser.id)) {
return [...prevMembers, decodedUser.id];
}
// Add the current user's ID to the selected members
return [...prevMembers, decodedUser.id];
return prevMembers;
});
} else {
}
Expand Down
2 changes: 1 addition & 1 deletion front-end/src/components/AddExpense.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ const AddExpense = (props) => {
<div className="submitBtn">
<button type="submit">Done</button>
</div>
<div className="space-to-scroll"></div>
<div className="space-to-scrolls"></div>
</form>
</div>
<SplitModal
Expand Down
28 changes: 13 additions & 15 deletions front-end/src/components/Event.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,27 @@ const Event = (props) => {
const isDarkMode = props.isDarkMode;
const { eventId } = useParams();


function reformatDate(dateStr) {

const months = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
];

// Create a new Date object in local time zone
const date = new Date(dateStr);

const monthName = months[date.getMonth()];
const day = date.getDate();

// Convert it back to UTC
date.setMinutes(date.getMinutes() + date.getTimezoneOffset());

const monthName = months[date.getUTCMonth()];
const day = date.getUTCDate();

return `${monthName} ${day}`;
}


// This effect runs when the `isDarkMode` value changes
useEffect(() => {
if (isDarkMode) {
Expand Down
29 changes: 13 additions & 16 deletions front-end/src/components/Events.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,26 @@ function Events({ isDarkMode }) {
const [searchTerm, setSearchTerm] = useState("");

function reformatDate(dateStr) {

const months = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
];

// Create a new Date object in local time zone
const date = new Date(dateStr);

const monthName = months[date.getMonth()];
const day = date.getDate();
const year = date.getFullYear();

// Convert it back to UTC
date.setMinutes(date.getMinutes() + date.getTimezoneOffset());

const monthName = months[date.getUTCMonth()];
const day = date.getUTCDate();
const year = date.getUTCFullYear();

return `${monthName} ${day} ${year}`;
}


// Toggle the 'body-dark-mode' class on the body element
useEffect(() => {
if (isDarkMode) {
Expand Down
30 changes: 14 additions & 16 deletions front-end/src/components/Expense.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,28 @@ function Expense({ isDarkMode }) {
const navigate = useNavigate();
const { expenseId } = useParams();


function reformatDate(dateStr) {

const months = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
];

// Create a new Date object in local time zone
const date = new Date(dateStr);

const monthName = months[date.getMonth()];
const day = date.getDate();
const year = date.getFullYear();

// Convert it back to UTC
date.setMinutes(date.getMinutes() + date.getTimezoneOffset());

const monthName = months[date.getUTCMonth()];
const day = date.getUTCDate();
const year = date.getUTCFullYear();

return `${monthName} ${day} ${year}`;
}


const fetchData = async () => {
try {
const response = await axios.get(
Expand Down
13 changes: 7 additions & 6 deletions front-end/src/styles/AddExpense.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
background-color: #d32f2f;
}

.space-to-scroll {
height: 60px;
.space-to-scrolls {
height: 60px;
}

/* Dark Mode for Add Expense Modal */
Expand Down Expand Up @@ -100,7 +100,8 @@
@apply bg-red-600;
}

.dark-mode .space-to-scroll {
@apply bg-gray-800;
height: 40px;
}
.dark-mode .space-to-scrolls {
@apply bg-gray-700;
height: 60px;

}
8 changes: 8 additions & 0 deletions front-end/src/styles/Expense.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@
@apply bg-gray-700 border-gray-600;
}

.dark-mode .expense .expense-item .positive {
color: green;
}

.dark-mode .expense .expense-item .negative {
color: red;
}

.dark-mode .expense-item span:first-child,
.dark-mode .expense-item span:nth-child(2),
.dark-mode .expense-details {
Expand Down

0 comments on commit 3662e34

Please sign in to comment.