diff --git a/caddy/Caddyfile b/caddy/Caddyfile index c9668b5..8fdcd58 100644 --- a/caddy/Caddyfile +++ b/caddy/Caddyfile @@ -8,4 +8,16 @@ api.marvinkrausser.com { portfolio.marvinkrausser.com { reverse_proxy portfolio_website:8081 +} + +http://localhost:8080 { + reverse_proxy cnn_website:8080 +} + +http://localhost:8000 { + reverse_proxy cnn_api:8000 +} + +http://localhost:8081 { + reverse_proxy portfolio_website:8081 } \ No newline at end of file diff --git a/website/src/Bird_CNN.css b/website/src/Bird_CNN.css index b1757ea..e90be5d 100644 --- a/website/src/Bird_CNN.css +++ b/website/src/Bird_CNN.css @@ -2,34 +2,6 @@ height: 40px; } -.custom-button { - font-size: 1rem; - font-weight: bold; - height: 40px; - padding: 10px 20px; - background: var(--surface); - color: rgb(0, 0, 0); - cursor: pointer; - border-radius: 20px; - border: 2px solid var(--surface); - user-select: none; -} - -.custom-button:hover { - border-color: white; - color: white; -} - -.custom-button.inactive { - opacity: 0.3; - cursor: default; - color: black; -} - -.custom-button.inactive:hover { - border-color: var(--surface); -} - .species-item { list-style: none; position: relative; diff --git a/website/src/Bird_CNN.jsx b/website/src/Bird_CNN.jsx index 84a163c..303684d 100644 --- a/website/src/Bird_CNN.jsx +++ b/website/src/Bird_CNN.jsx @@ -3,7 +3,7 @@ import './Bird_CNN.css'; function Bird_CNN() { const apiUrl = process.env.NODE_ENV === "development" - ? "https://api.marvinkrausser.com" + ? "http://localhost:8000" : "https://api.marvinkrausser.com"; const [file, setFile] = useState(null); diff --git a/website/src/Reviews.css b/website/src/Reviews.css index 076ee38..f1df19d 100644 --- a/website/src/Reviews.css +++ b/website/src/Reviews.css @@ -1,3 +1,10 @@ +.review-description { + margin: 70px; + font-size: 1.1rem; + width: min(800px, 70vw); + height: fit-content; +} + .input-box { display: flex; gap: 80px; @@ -44,6 +51,7 @@ height: fit-content; gap: 0px; user-select: none; + --radius: 16px; } .review-select-dropdown.rating { @@ -59,12 +67,12 @@ outline: none; color: black; font-weight: bold; - border-radius: 16px; + border-radius: var(--radius); } .review-select-button.active { - border-top-right-radius: 16px; - border-top-left-radius: 16px; + border-top-right-radius: var(--radius); + border-top-left-radius: var(--radius); border-bottom-right-radius: 0; border-bottom-left-radius: 0; @@ -75,11 +83,16 @@ border-color: white; } -.review-select-menu.grid { +.review-select-menu { + width: 100%; + grid-auto-rows: 1fr; +} + +.rating .review-select-menu { width: 300%; - display: grid; grid-template-columns: 1fr 1fr 1fr; grid-auto-rows: 1fr; + transform: translateX(-33.3333%); } .review-select-item { @@ -95,9 +108,35 @@ border-radius: 0; } -.review-select-item.last { - border-bottom-left-radius: 16px; - border-bottom-right-radius: 16px; +.rating .review-select-box-0 { + grid-column: 1; + grid-row: 1; + border-bottom-left-radius: var(--radius); + border-top-left-radius: var(--radius); +} + +.rating .review-select-box-1 { + grid-column: 2; + grid-row: 1; +} + +.rating .review-select-box-2 { + grid-column: 3; + grid-row: 1; + border-bottom-right-radius: var(--radius); + border-top-right-radius: var(--radius); +} + +.rating .review-select-box-3 { + grid-column: 2; + grid-row: 2; + border-bottom-left-radius: var(--radius); + border-bottom-right-radius: var(--radius); +} + +.website .review-select-box-1 { + border-bottom-left-radius: var(--radius); + border-bottom-right-radius: var(--radius); } .review-select-item:hover { diff --git a/website/src/Reviews.jsx b/website/src/Reviews.jsx index 58ff6d3..d2feaae 100644 --- a/website/src/Reviews.jsx +++ b/website/src/Reviews.jsx @@ -3,6 +3,10 @@ import './Reviews.css'; import SelectDropdown from './components/SelectDropdown'; function Reviews() { + const apiUrl = process.env.NODE_ENV === "development" + ? "http://localhost:8000" + : "https://api.marvinkrausser.com"; + const [error, setError] = useState(null); const [selectedWebsite, setSelectedWebsite] = useState("Not Specified"); const [selectedRating, setSelectedRating] = useState(1); @@ -12,8 +16,11 @@ function Reviews() { const fetchReviews = async () => { - const response = await fetch(`api.marvinkrausser/review`, { - method: "GET", + const response = await fetch(`${apiUrl}/review`, { + method: "POST", + headers: { + "Authorization": `Bearer 1234`, + }, }); if (!response.ok) { @@ -24,12 +31,20 @@ function Reviews() { setError(false); } + console.log(response); + const result = await response.json(); } - const sendReview = async (review) => { + const sendReview = async () => { + const review = { + "website": selectedWebsite, + "rating": selectedRating, + "text": text, + "created_at": "today" + } - const response = await fetch(`api.marvinkrausser/review`, { + const response = await fetch(`${apiUrl}/review`, { method: "POST", body: JSON.stringify(review), }); @@ -47,12 +62,10 @@ function Reviews() { const changeSelectedWebsite = (website) => { setSelectedWebsite(website); - console.log(selectedWebsite); }; const changeSelectedRating = (rating) => { setSelectedRating(rating); - console.log(selectedRating); } const websites = [ @@ -75,6 +88,7 @@ function Reviews() { return (<>

Reviews

+

I would greatly appreciate receiving a review. You are welcome to write it in either English or German. All fields are optional, and all reviews are submitted anonymously.

@@ -88,7 +102,6 @@ function Reviews() { defaultValue={websites.at(-1)} classNames={"website"} changeInputParent={changeSelectedWebsite} - flex={true} />
@@ -116,9 +129,13 @@ function Reviews() { defaultValue={ratings.at(0)} classNames={"rating"} changeInputParent={changeSelectedRating} - flex={false} /> + + {selectVisibility && - } +
+ +
} ); diff --git a/website/src/index.css b/website/src/index.css index 70b70c5..69e6653 100644 --- a/website/src/index.css +++ b/website/src/index.css @@ -56,4 +56,34 @@ h4 { margin-top: 150px; width: 100%; height: fit-content; +} + +.custom-button { + font-size: 1rem; + font-weight: bold; + height: 40px; + padding: 10px 20px; + background: var(--surface); + color: rgb(0, 0, 0); + cursor: pointer; + border-radius: 20px; + border: 2px solid var(--surface); + user-select: none; + display: flex; + align-items: center; +} + +.custom-button:hover { + border-color: white; + color: white; +} + +.custom-button.inactive { + opacity: 0.3; + cursor: default; + color: black; +} + +.custom-button.inactive:hover { + border-color: var(--surface); } \ No newline at end of file