Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: changes landing page to home route #1

Merged
merged 3 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 0.2

phases:
install:
runtime-versions:
nodejs: 18

pre_build:
commands:
- npm pkg delete scripts.prepare
- yarn install --lock-file

build:
commands:
- yarn build

post_build:
commands:
- aws s3 sync --delete ./dist s3://godiet-client-prod
- aws cloudfront create-invalidation --distribution-id EG9I86T3KBN17 --paths /index.html
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"preview": "vite preview",
"prepare": "husky",
"test": "vitest --coverage",
"test:ci": "vitest --no-watch",
"test:ci": "vitest --no-watch --passWithNoTests",
"test:ui": "vitest --ui",
"typecheck": "tsc --noEmit"
},
Expand Down
1 change: 1 addition & 0 deletions src/app/config/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export const ROUTES = {
LOGIN: '/login',
REGISTER: '/register',
HOME: '/',
DASHBOARD: '/app',
PATIENTS: '/pacientes',
PATIENTS_BY_ID: '/pacientes/:id',
PLANNING_MEAL_BY_PATIENT: '/pacientes/:id/plano',
Expand Down
4 changes: 3 additions & 1 deletion src/view/pages/LandingPage/Hero.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ROUTES } from '@godiet-config';

export function Hero() {
return (
<>
Expand Down Expand Up @@ -51,7 +53,7 @@ export function Hero() {
<div className="mb-8 mt-12 flex justify-center gap-3">
<a
className="inline-flex items-center justify-center gap-x-3 rounded-md border border-transparent bg-gradient-to-tl from-green-600 to-teal-600 px-4 py-3 text-center text-sm font-medium text-white transition-all duration-200 hover:from-teal-600 hover:to-green-600 focus:outline-none focus:ring-1 focus:ring-gray-600 dark:focus:ring-offset-gray-800"
href="#"
href={ROUTES.LOGIN}
>
Comece agora
<svg
Expand Down
7 changes: 3 additions & 4 deletions src/view/ui/Router/AuthGuard.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { ROUTES } from '@godiet-config';
import { useAuth } from '@godiet-hooks/auth';

import { Navigate, Outlet } from 'react-router-dom';

// import { useAuth } from '@app/hooks/useAuth';

interface AuthGuardProps {
isPrivate: boolean;
}
Expand All @@ -12,11 +11,11 @@ export function AuthGuard({ isPrivate }: AuthGuardProps) {
const { signedIn } = useAuth();

if (!signedIn && isPrivate) {
return <Navigate to="/login" replace />;
return <Navigate to={ROUTES.LOGIN} replace />;
}

if (signedIn && !isPrivate) {
return <Navigate to="/" replace />;
return <Navigate to={ROUTES.DASHBOARD} replace />;
}

return <Outlet />;
Expand Down
6 changes: 3 additions & 3 deletions src/view/ui/Router/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Suspense } from 'react';
import { Logo } from '@godiet-components/Logo';
import { Spinner } from '@godiet-components/Spinner';
import { ROUTES } from '@godiet-config';
import { LandingPage } from '@godiet-pages/LandingPage';
import { NotFound } from '@godiet-pages/NotFound';
import { lazyLoad } from '@godiet-utils/lazyLoad';

Expand All @@ -22,6 +21,7 @@ const { DashboardLayout } = lazyLoad(
);

const { Login } = lazyLoad(() => import('@godiet-pages/Login'));
const { LandingPage } = lazyLoad(() => import('@godiet-pages/LandingPage'));
const { Register } = lazyLoad(() => import('@godiet-pages/Register'));
const { Settings } = lazyLoad(() => import('@godiet-pages/Settings'));
const { SettingsLayout } = lazyLoad(
Expand Down Expand Up @@ -56,11 +56,11 @@ export function Router() {
<Route element={<AuthGuard isPrivate={false} />}>
<Route path={ROUTES.LOGIN} element={<Login />} />
<Route path={ROUTES.REGISTER} element={<Register />} />
<Route path="/landing" element={<LandingPage />} />
<Route path={ROUTES.HOME} element={<LandingPage />} />
</Route>
<Route element={<AuthGuard isPrivate={true} />}>
<Route element={<DashboardLayout />}>
<Route path={ROUTES.HOME} element={<Dashboard />} />
<Route path={ROUTES.DASHBOARD} element={<Dashboard />} />
<Route element={<SettingsLayout />}>
<Route path={ROUTES.SETTINGS} element={<Settings />} />
<Route
Expand Down
Loading