Skip to content

Commit

Permalink
refactor: ✨ Adiciona novas entidades e atualiza a configuração do Typ…
Browse files Browse the repository at this point in the history
…eOrm
  • Loading branch information
Wellington Braga committed Nov 27, 2024
1 parent 904aec4 commit e403916
Show file tree
Hide file tree
Showing 38 changed files with 371 additions and 207 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

.fleet
.vscode
.vscode/*

# testing
/coverage
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "services",
"version": "0.1.19",
"version": "0.2.0",
"private": true,
"repository": {
"type": "git",
Expand Down
32 changes: 16 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/sw.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/sw.js.map

Large diffs are not rendered by default.

Binary file removed services.sqlite
Binary file not shown.
10 changes: 6 additions & 4 deletions src/app/ global-error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import * as Sentry from "@sentry/nextjs";
import NextError from "next/error";
import { useEffect } from "react";

export default function GlobalError({
const GlobalError = ({
error,
}: Readonly<{
error: Error & { digest?: string };
}>) {
}>) => {
useEffect(() => {
Sentry.captureException(error);
}, [error]);

return (
// eslint-disable-next-line jsx-a11y/html-has-lang
<html>
<html lang="pt-BR">
<body>
{/* `NextError` is the default Next.js error page component. Its type
definition requires a `statusCode` prop. However, since the App Router
Expand All @@ -27,4 +27,6 @@ export default function GlobalError({
</body>
</html>
);
}
};

export default GlobalError;
4 changes: 0 additions & 4 deletions src/app/(protected)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ const Template = ({ children }: Readonly<{ children: ReactNode }>) => {
[pagesWithoutHeader, pathName],
);

// if (!isAuthenticated) {
// redirect("/login");
// }

return (
<FlexContainer
$backgroundColor={isRequestsPage ? "#E2F3D5" : "#F5F5F5"}
Expand Down
5 changes: 2 additions & 3 deletions src/app/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ const Login = async ({
searchParams,
}: {
searchParams: {
code: string;
redirectTo: string;
};
}) => {
const cookiesStore = cookies();
const accessToken = cookiesStore.get(CS_KEY_ACCESS_TOKEN)?.value;
const signError = searchParams?.code;

if (accessToken) {
redirect("/");
}

return <LoginPage error={signError} />;
return <LoginPage redirectTo={searchParams?.redirectTo} />;
};

export default Login;
2 changes: 1 addition & 1 deletion src/components/Headers/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const Header = () => {
</TitleComponent>
</UserName>
<IconButton
onClick={signOut}
onClick={() => signOut(false)}
icon={<SignOutIcon size={24} />}
/>
</Row>
Expand Down
13 changes: 10 additions & 3 deletions src/components/NavBar/OptionMenu/index.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
import { OptionMenuProps } from "@/types";
import { CustomLink } from "@/components";
import { OptionMenuProps } from "@/types";
import { IconArea, TextMenu } from "../styles";

const OptionMenu = ({
name,
icon,
path,
$isSelected,
$isPreselected,
color,
onClick,
$highlightTextColor,
}: OptionMenuProps) => (
<CustomLink
$flexDirection="column"
href={path}>
href={path}
onClick={() => {
if (onClick) onClick(name);
}}>
<IconArea
$isPreselected={$isPreselected}
$backgroundColor={color}
$isSelected={$isSelected}>
{icon}
</IconArea>
<TextMenu
$isPreselected={$isPreselected}
$highlightTextColor={$highlightTextColor}
$isSelected={$isSelected}>
{name}
</TextMenu>
</CustomLink>
);
);

export default OptionMenu;
4 changes: 4 additions & 0 deletions src/components/NavBar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { OptionMenuProps } from "@/types";
import { usePathname } from "next/navigation";
import { useState } from "react";
import OptionMenu from "./OptionMenu";
import { ContainerMenu, MenuList } from "./styles";

Expand All @@ -17,20 +18,23 @@ export const NavigationBar = ({
// isLoading = false,
}: NavigationBarProps) => {
const actualRoute = usePathname();
const [optionClicked, setOptionClicked] = useState("");
return (
<ContainerMenu color={color}>
<MenuList>
{options
.filter((option) => option.$isVisibled)
?.map((option) => (
<OptionMenu
$isPreselected={option.name === optionClicked}
$highlightTextColor={$highlightTextColor}
color={color}
key={option.name}
name={option.name}
path={option.path}
alt={option.alt}
icon={option.icon}
onClick={(optionName) => setOptionClicked(optionName)}
$isSelected={option.path === actualRoute}
/>
))}
Expand Down
19 changes: 15 additions & 4 deletions src/components/NavBar/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled from "styled-components";
import { OptionMenuStyleProps } from "@/types";
import Link from "next/link";
import styled from "styled-components";

export const ContainerMenu = styled.div<{ color?: string }>`
position: absolute;
Expand All @@ -23,7 +23,10 @@ export const OptionMenuStyle = styled(Link)<OptionMenuStyleProps>`
justify-content: center;
align-items: center;
text-decoration: none;
background-color: ${({ $isSelected }) => ($isSelected === true ? "#7AC143" : "#F5F5F5")};
background-color: ${({ $isSelected }) =>
($isSelected === true ? "#7AC143" : "#F5F5F5")};
${({ $isPreselected, $isSelected }) =>
$isPreselected && !$isSelected && "background-color: #c1f599;"};
/* F8F5F5 */
`;

Expand All @@ -34,7 +37,11 @@ export const IconArea = styled.div<OptionMenuStyleProps>`
border-radius: 16px;
align-items: center;
justify-content: center;
background-color: ${({ $isSelected, $backgroundColor }) => ($isSelected ? "#7AC143" : $backgroundColor || "#F5F5F5")};
background-color: ${({ $isSelected, $backgroundColor }) =>
($isSelected ? "#7AC143" : $backgroundColor || "#F5F5F5")};
${({ $isPreselected, $isSelected }) =>
$isPreselected && !$isSelected && "background-color: #c1f599;"};
&:active {
background-color: #c1f599;
Expand All @@ -52,6 +59,10 @@ export const TextMenu = styled.p<OptionMenuStyleProps>`
font-size: 12px;
font-weight: 600;
line-height: 16px;
color: ${({ $isSelected, $highlightTextColor }) => ($isSelected ? $highlightTextColor || "#7AC143" : "#252728")};
color: ${({ $isSelected, $highlightTextColor }) =>
($isSelected ? $highlightTextColor || "#7AC143" : "#252728")};
list-style: none;
${({ $isPreselected, $isSelected }) =>
$isPreselected && !$isSelected && "color: #51782f;"};
`;
5 changes: 1 addition & 4 deletions src/components/common/Buttons/IconButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const IconButton = ({
icon,
path,
onClick,
onHover,
color = "#000000",
width = "16",
height = "16",
Expand All @@ -16,16 +15,14 @@ const IconButton = ({
color={color}
href={path}
width={width}
height={height}
onHover={onHover}>
height={height}>
{icon}
</CustomButtonAsLink>
) : (
<CustomButton
color={color}
width={width}
height={height}
onHover={onHover}
onClick={onClick}>
{icon}
</CustomButton>
Expand Down
12 changes: 6 additions & 6 deletions src/components/common/Buttons/IconButton/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import styled from "styled-components";
import Link from "next/link";
import { MouseEventHandler } from "react";
import styled from "styled-components";

interface CustomButtonProps {
path?: string;
alt?: string;
color?: string;
width?: string;
height?: string;
onHover?: MouseEventHandler<HTMLButtonElement>;
hoverColor?: string;
}

const IconButtonWrapper = styled.div``;
Expand All @@ -21,9 +20,10 @@ const CustomButtonAsLink = styled(Link)<CustomButtonProps>`
border: none;
cursor: pointer;
transition: all 0.2s ease-in-out;
&:hover {
transform: scale(1.1);
color: ${(props) => (props.onHover ? "#fff" : "#fff")};
color: ${(props) => props?.hoverColor ?? "#fff"};
}
`;

Expand All @@ -37,8 +37,8 @@ const CustomButton = styled.button<CustomButtonProps>`
transition: all 0.2s ease-in-out;
&:hover {
transform: scale(1.1);
color: ${(props) => (props.onHover ? "#fff" : "#fff")};
color: ${(props) => props.hoverColor ?? "#fff"};
}
`;

export { IconButtonWrapper, CustomButton, CustomButtonAsLink };
export { CustomButton, CustomButtonAsLink, IconButtonWrapper };
Loading

0 comments on commit e403916

Please sign in to comment.