Compare commits
2 Commits
f93ff6501a
...
fd113091a0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd113091a0 | ||
|
|
cbaf34d39c |
4
.github/workflows/deploy.yml
vendored
4
.github/workflows/deploy.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: azpect3120/potion.gophernest:latest
|
tags: azpect3120/potion.backend:latest
|
||||||
|
|
||||||
- name: Build and push frontend Docker image
|
- name: Build and push frontend Docker image
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
@ -36,5 +36,3 @@ jobs:
|
|||||||
tags: azpect3120/potion.frontend:latest
|
tags: azpect3120/potion.frontend:latest
|
||||||
build-args: |
|
build-args: |
|
||||||
VITE_ENVIRONMENT=prod
|
VITE_ENVIRONMENT=prod
|
||||||
VITE_DOMAIN_DEV=http://localhost:3000
|
|
||||||
VITE_DOMAIN_PROD=https://potion-backend.gophernest.net
|
|
||||||
|
|||||||
@ -7,14 +7,9 @@ RUN npm install
|
|||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build-time config: defaults are prod-safe, can be overridden if needed
|
# Build-time config: just env selector
|
||||||
ARG VITE_ENVIRONMENT=prod
|
ARG VITE_ENVIRONMENT=prod
|
||||||
ARG VITE_DOMAIN_DEV=http://localhost:3000
|
|
||||||
ARG VITE_DOMAIN_PROD=https://potion-backend.gophernest.net
|
|
||||||
|
|
||||||
ENV VITE_ENVIRONMENT=$VITE_ENVIRONMENT
|
ENV VITE_ENVIRONMENT=$VITE_ENVIRONMENT
|
||||||
ENV VITE_DOMAIN_DEV=$VITE_DOMAIN_DEV
|
|
||||||
ENV VITE_DOMAIN_PROD=$VITE_DOMAIN_PROD
|
|
||||||
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
|||||||
@ -86,7 +86,7 @@ export default function RecipeSearchBar({ redirect, searchOnLoad, favorites, set
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<form className="w-full px-4 my-8" onSubmit={(e) => void searchHandler(e)}>
|
<form className="w-full px-4 my-8" onSubmit={(e) => void searchHandler(e)}>
|
||||||
<div className="flex w-full gdisbaledap-x-2">
|
<div className="flex w-full gap-x-2">
|
||||||
<div className="relative w-full">
|
<div className="relative w-full">
|
||||||
<input type="hidden" name="redirect" value={JSON.stringify(redirect)} />
|
<input type="hidden" name="redirect" value={JSON.stringify(redirect)} />
|
||||||
<input
|
<input
|
||||||
@ -95,7 +95,7 @@ export default function RecipeSearchBar({ redirect, searchOnLoad, favorites, set
|
|||||||
placeholder="Search recipes, ingredients..."
|
placeholder="Search recipes, ingredients..."
|
||||||
value={filters ? filters.Search : ""}
|
value={filters ? filters.Search : ""}
|
||||||
onChange={queryInputHandler}
|
onChange={queryInputHandler}
|
||||||
className="w-[99%] pr-4 pl-10 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
className="w-full pr-4 pl-10 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||||
/>
|
/>
|
||||||
<button className="absolute left-3 top-1/2 -translate-y-1/2">
|
<button className="absolute left-3 top-1/2 -translate-y-1/2">
|
||||||
<svg
|
<svg
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import { CreateRecipe } from "../services/RecipeService";
|
|||||||
import type { CreateRecipeRequest } from "../types/api/recipe";
|
import type { CreateRecipeRequest } from "../types/api/recipe";
|
||||||
import { isApiError } from "../types/api/error";
|
import { isApiError } from "../types/api/error";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
import ROUTE_CONSTANTS from "../types/routes";
|
||||||
|
|
||||||
// TODO: Move these
|
// TODO: Move these
|
||||||
export interface RecipeValidationEntry {
|
export interface RecipeValidationEntry {
|
||||||
@ -158,7 +159,7 @@ export default function Create() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO: Success toast!
|
// TODO: Success toast!
|
||||||
await navigate(`/web/recipe/${response.Id}`);
|
await navigate(ROUTE_CONSTANTS.Recipe(response.Id));
|
||||||
};
|
};
|
||||||
|
|
||||||
// Import ingredients
|
// Import ingredients
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import type { GetGoogleAuthUrlResponse, LogoutResponse } from "../types/api/auth";
|
import type { GetGoogleAuthUrlResponse, LogoutResponse } from "../types/api/auth";
|
||||||
import type { ApiError } from "../types/api/error";
|
import type { ApiError } from "../types/api/error";
|
||||||
import { GetBackendUrl } from "./util";
|
import { GetBackendUrl } from "./environment";
|
||||||
|
|
||||||
const BACKEND_URL = GetBackendUrl();
|
const BACKEND_URL = GetBackendUrl();
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import axios from "axios";
|
|||||||
import type { ApiError } from "../types/api/error";
|
import type { ApiError } from "../types/api/error";
|
||||||
import type { Engagement } from "../types/engagement";
|
import type { Engagement } from "../types/engagement";
|
||||||
import type { EngagementFavoriteRecipeResponse, EngagementMakeRecipeResponse, EngagementShareRecipeResponse, EngagementViewRecipeResponse } from "../types/api/engagement";
|
import type { EngagementFavoriteRecipeResponse, EngagementMakeRecipeResponse, EngagementShareRecipeResponse, EngagementViewRecipeResponse } from "../types/api/engagement";
|
||||||
import { GetBackendUrl } from "./util";
|
import { GetBackendUrl } from "./environment";
|
||||||
|
|
||||||
const BACKEND_URL = GetBackendUrl();
|
const BACKEND_URL = GetBackendUrl();
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import type { CreateRecipeRequest, CreateRecipeResponse, GetRecipeOfTheWeekRespo
|
|||||||
import type { Recipe } from "../types/recipe";
|
import type { Recipe } from "../types/recipe";
|
||||||
import type { ApiError } from "../types/api/error";
|
import type { ApiError } from "../types/api/error";
|
||||||
import type { SearchFilters } from "../types/search";
|
import type { SearchFilters } from "../types/search";
|
||||||
import { GetBackendUrl } from "./util";
|
import { GetBackendUrl } from "./environment";
|
||||||
|
|
||||||
const BACKEND_URL = GetBackendUrl();
|
const BACKEND_URL = GetBackendUrl();
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import type { User } from "../types/user";
|
|||||||
import type { GetAuthenticateUserEngagementResponse, GetAuthenticateUserFavoritesResponse, GetAuthenticateUserMadeRecipesResponse, GetAuthenticateUserRecipesResponse, GetAuthenticateUserResponse, GetAuthenticateUserViewedRecipesResponse, GetUserResponse } from "../types/api/user";
|
import type { GetAuthenticateUserEngagementResponse, GetAuthenticateUserFavoritesResponse, GetAuthenticateUserMadeRecipesResponse, GetAuthenticateUserRecipesResponse, GetAuthenticateUserResponse, GetAuthenticateUserViewedRecipesResponse, GetUserResponse } from "../types/api/user";
|
||||||
import type { Recipe } from "../types/recipe";
|
import type { Recipe } from "../types/recipe";
|
||||||
import type { Engagement } from "../types/engagement";
|
import type { Engagement } from "../types/engagement";
|
||||||
import { GetBackendUrl } from "./util";
|
import { GetBackendUrl } from "./environment";
|
||||||
|
|
||||||
const BACKEND_URL = GetBackendUrl();
|
const BACKEND_URL = GetBackendUrl();
|
||||||
|
|
||||||
|
|||||||
@ -6,9 +6,9 @@ export function GetBackendUrl(): string {
|
|||||||
|
|
||||||
switch (env.toLowerCase()) {
|
switch (env.toLowerCase()) {
|
||||||
case "dev":
|
case "dev":
|
||||||
return ENV.VITE_DOMAIN_DEV as string;
|
return "http://localhost:3000";
|
||||||
case "prod":
|
case "prod":
|
||||||
return ENV.VITE_DOMAIN_PROD as string;
|
return "https://potion-backend.gophernest.net";
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -8,6 +8,7 @@ const ROUTE_CONSTANTS: {
|
|||||||
ShoppingList: string;
|
ShoppingList: string;
|
||||||
Login: string;
|
Login: string;
|
||||||
History: string;
|
History: string;
|
||||||
|
Recipe: (id: number) => string;
|
||||||
} = {
|
} = {
|
||||||
Home: `${VERSION_FLAG}/web/home`,
|
Home: `${VERSION_FLAG}/web/home`,
|
||||||
Favorites: `${VERSION_FLAG}/web/favorites`,
|
Favorites: `${VERSION_FLAG}/web/favorites`,
|
||||||
@ -16,6 +17,7 @@ const ROUTE_CONSTANTS: {
|
|||||||
ShoppingList: `${VERSION_FLAG}/web/list`,
|
ShoppingList: `${VERSION_FLAG}/web/list`,
|
||||||
Login: `${VERSION_FLAG}/web/login`,
|
Login: `${VERSION_FLAG}/web/login`,
|
||||||
History: `${VERSION_FLAG}/web/history`,
|
History: `${VERSION_FLAG}/web/history`,
|
||||||
|
Recipe: (id: number) => `${VERSION_FLAG}/web/recipe/${id}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ROUTE_CONSTANTS;
|
export default ROUTE_CONSTANTS;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user