generated from chingu-voyages/voyage-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from chingu-voyages/sort-algo
Sort algo
- Loading branch information
Showing
19 changed files
with
271 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
name: Build and Deploy Server | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
workflow_dispatch: | ||
push: | ||
branches: ["main"] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
SSH_USER: ec2-user | ||
SSH_HOST: ec2-52-53-202-98.us-west-1.compute.amazonaws.com | ||
WEB_ROOT: /home/www | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
SSH_USER: ec2-user | ||
SSH_HOST: ec2-52-53-202-98.us-west-1.compute.amazonaws.com | ||
WEB_ROOT: /home/www | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
- run: npm ci --prefix server | ||
- name: Copy server files to EC2 server | ||
uses: burnett01/[email protected] | ||
with: | ||
switches: --verbose --human-readable --archive --delete --exclude "addresses.db" | ||
path: server/ | ||
remote_user: ${{ env.SSH_USER }} | ||
remote_host: ${{ env.SSH_HOST }} | ||
remote_path: ${{ env.WEB_ROOT}} | ||
remote_key: ${{ secrets.SERVER_DEPLOYMENT_KEY }} | ||
- name: Execute commands on server | ||
uses: appleboy/[email protected] | ||
with: | ||
username: ${{ env.SSH_USER }} | ||
host: ${{ env.SSH_HOST }} | ||
key: ${{ secrets.SERVER_DEPLOYMENT_KEY }} | ||
script: | | ||
echo "Checking if pm2 installed" | ||
if [ ! "$(which pm2 2>/dev/null)" ]; then | ||
echo "Not found. Installing pm2" | ||
sudo npm i -g pm2 | ||
fi | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
- run: npm ci --prefix server | ||
- name: Copy server files to EC2 server | ||
uses: burnett01/[email protected] | ||
with: | ||
switches: --verbose --human-readable --archive --delete --exclude "addresses.db" | ||
path: server/ | ||
remote_user: ${{ env.SSH_USER }} | ||
remote_host: ${{ env.SSH_HOST }} | ||
remote_path: ${{ env.WEB_ROOT}} | ||
remote_key: ${{ secrets.SERVER_DEPLOYMENT_KEY }} | ||
- name: Execute commands on server | ||
uses: appleboy/[email protected] | ||
with: | ||
username: ${{ env.SSH_USER }} | ||
host: ${{ env.SSH_HOST }} | ||
key: ${{ secrets.SERVER_DEPLOYMENT_KEY }} | ||
script: | | ||
echo "Checking if pm2 installed" | ||
if [ ! "$(which pm2 2>/dev/null)" ]; then | ||
echo "Not found. Installing pm2" | ||
sudo npm i -g pm2 | ||
fi | ||
echo "Deleting node server if exists" | ||
pm2 delete ${{ env.WEB_ROOT}}/src/app.js 2> /dev/null | ||
echo "Deleting node server if exists" | ||
pm2 delete ${{ env.WEB_ROOT}}/src/app.js 2> /dev/null | ||
echo "Starting node server" | ||
cd ${{ env.WEB_ROOT}} | ||
PORT=4000 DATABASE_CONNECTION_STRING='${{ secrets.DATABASE_CONNECTION_STRING }}' MOCK_EMAIL_USER='${{secrets.MOCK_EMAIL_USER}}' MOCK_EMAIL_PASS='${{secrets.MOCK_EMAIL_PASS}}' MY_TEST_DB=test pm2 start src/app.js | ||
echo "Starting node server" | ||
cd ${{ env.WEB_ROOT}} | ||
PORT=4000 DATABASE_CONNECTION_STRING='${{ secrets.DATABASE_CONNECTION_STRING }}' MOCK_EMAIL_USER='${{secrets.MOCK_EMAIL_USER}}' MOCK_EMAIL_PASS='${{secrets.MOCK_EMAIL_PASS}}' MY_TEST_DB=test pm2 start src/app.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 19 additions & 36 deletions
55
client/components/admin_dashboard/Grid.jsx → client/components/admin-dashboard/Grid.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"use client"; | ||
|
||
import Box from "@mui/material/Box"; | ||
import Grid from "./Grid"; | ||
|
||
export default function ReservationTable({ appointments = [] }) { | ||
return ( | ||
<Box sx={{ height: "100%", width: "100%" }}> | ||
<Grid rows={appointments} /> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { useState } from "react"; | ||
import { TextField, Box, InputAdornment } from "@mui/material"; | ||
import SearchIcon from "@mui/icons-material/Search"; | ||
|
||
const SearchBar = ({ onSearchChange, searchText }) => { | ||
const handleSearch = (e) => { | ||
const value = e.target.value; | ||
onSearchChange(value); | ||
}; | ||
|
||
return ( | ||
<Box sx={{ display: "flex", justifyContent: "center", width: "100%" }}> | ||
<TextField | ||
label="" | ||
variant="outlined" | ||
margin="normal" | ||
value={searchText} | ||
onChange={handleSearch} | ||
sx={{ | ||
flex: 0.55, | ||
}} | ||
InputProps={{ | ||
startAdornment: ( | ||
<InputAdornment position="start"> | ||
<SearchIcon /> | ||
</InputAdornment> | ||
), | ||
}} | ||
/> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default SearchBar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
client/components/admin-dashboard/grid-components/VisitedChip.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Button } from "@mui/material"; | ||
import { updateStatusOnServer } from "@/actions/form"; | ||
|
||
const VisitedChip = ({ id, status }) => { | ||
const visited = status === "Visited" || status === "Completed"; | ||
|
||
const toggleVisited = async (id, newStatus) => { | ||
try { | ||
await updateStatusOnServer(id, newStatus); | ||
} catch (error) { | ||
console.error("Failed to update status:", error); | ||
} | ||
}; | ||
|
||
return ( | ||
<Button | ||
variant={visited ? "contained" : "outlined"} | ||
color="primary" | ||
onClick={(e) => toggleVisited(id, visited ? "Scheduled" : "Completed")} | ||
> | ||
{visited ? "Visited" : "Not Visited"} | ||
</Button> | ||
); | ||
}; | ||
|
||
export default VisitedChip; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
7 changes: 7 additions & 0 deletions
7
client/components/admin-dashboard/grid-components/toolbar.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { GridToolbarExport, GridToolbarContainer } from "@mui/x-data-grid"; | ||
|
||
const Toolbar = () => ( | ||
<GridToolbarContainer sx={{ justifyContent: "flex-end" }}> | ||
<GridToolbarExport /> | ||
</GridToolbarContainer> | ||
); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.