-
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.
- Loading branch information
0 parents
commit ac0743e
Showing
41 changed files
with
16,240 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,134 @@ | ||
/** @type {import('eslint').Linter.Config} */ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
es2021: true, | ||
}, | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"airbnb", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:prettier/recommended", | ||
"@remix-run/eslint-config", | ||
"@remix-run/eslint-config/node", | ||
], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
ecmaVersion: "latest", | ||
sourceType: "module", | ||
project: ["./tsconfig.json"], | ||
}, | ||
plugins: ["react", "react-hooks", "@typescript-eslint", "prettier"], | ||
rules: { | ||
"max-len": [ | ||
0, | ||
80, | ||
2, | ||
{ | ||
ignoreUrls: true, | ||
}, | ||
], | ||
"react/jsx-filename-extension": [ | ||
1, | ||
{ | ||
extensions: [".tsx"], | ||
}, | ||
], | ||
"react/function-component-definition": [ | ||
2, | ||
{ | ||
namedComponents: "arrow-function", | ||
}, | ||
], | ||
"import/extensions": [ | ||
"error", | ||
"ignorePackages", | ||
{ | ||
js: "never", | ||
jsx: "never", | ||
ts: "never", | ||
tsx: "never", | ||
}, | ||
], | ||
"default-param-last": 0, | ||
"@typescript-eslint/no-explicit-any": 0, | ||
"no-shadow": 0, | ||
"react/jsx-props-no-spreading": 0, | ||
"react/require-default-props": 0, | ||
"class-methods-use-this": 0, | ||
"import/no-extraneous-dependencies": [ | ||
0, | ||
{ | ||
devDependencies: [ | ||
"**/*.test.ts", | ||
"**/*.test.tsx", | ||
"**/*.spec.ts", | ||
"**/*.spec.tsx", | ||
], | ||
}, | ||
], | ||
"import/prefer-default-export": 0, | ||
"sort-imports": [ | ||
"error", | ||
{ ignoreCase: true, ignoreDeclarationSort: true }, | ||
], | ||
"import/order": [ | ||
1, | ||
{ | ||
groups: [ | ||
["external", "builtin"], | ||
"internal", | ||
["sibling", "parent"], | ||
"index", | ||
], | ||
pathGroups: [ | ||
{ pattern: "components", group: "internal" }, | ||
{ pattern: "components/**", group: "internal" }, | ||
{ pattern: "constants/**", group: "internal" }, | ||
{ pattern: "common", group: "internal" }, | ||
{ pattern: "error/**", group: "internal" }, | ||
{ pattern: "hooks/**", group: "internal" }, | ||
{ pattern: "locale/**", group: "internal" }, | ||
{ pattern: "routes/**", group: "internal" }, | ||
{ pattern: "selectors", group: "internal" }, | ||
{ pattern: "store", group: "internal" }, | ||
{ pattern: "assets/**", group: "internal", position: "after" }, | ||
], | ||
pathGroupsExcludedImportTypes: ["internal"], | ||
alphabetize: { | ||
order: "asc", | ||
caseInsensitive: true, | ||
}, | ||
}, | ||
], | ||
}, | ||
settings: { | ||
"import/resolver": { | ||
typescript: { | ||
extensions: [".ts", ".tsx"], | ||
}, | ||
}, | ||
}, | ||
ignorePatterns: [ | ||
"serviceWorker.ts", | ||
"**/assets/*", | ||
"**/build/*", | ||
"example.tsx", | ||
"remix.env.d.ts", | ||
"remix.config.js", | ||
], | ||
overrides: [ | ||
{ | ||
files: ["**/*.ts", "**/*.tsx"], | ||
plugins: ["@typescript-eslint"], | ||
rules: { | ||
"no-use-before-define": "off", | ||
"@typescript-eslint/no-use-before-define": "off", | ||
}, | ||
}, | ||
], | ||
}; |
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,6 @@ | ||
node_modules | ||
|
||
/.cache | ||
/public/build | ||
/.netlify | ||
.env |
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,62 @@ | ||
# Welcome to Remix! | ||
|
||
- [Remix Docs](https://remix.run/docs) | ||
- [Netlify Functions](https://www.netlify.com/products/functions/) | ||
|
||
## Netlify Setup | ||
|
||
1. Install the [Netlify CLI](https://www.netlify.com/products/dev/): | ||
|
||
```sh | ||
npm i -g netlify-cli | ||
``` | ||
|
||
If you have previously installed the Netlify CLI, you should update it to the latest version: | ||
|
||
```sh | ||
npm i -g netlify-cli@latest | ||
``` | ||
|
||
2. Sign up and log in to Netlify: | ||
|
||
```sh | ||
netlify login | ||
``` | ||
|
||
3. Create a new site: | ||
|
||
```sh | ||
netlify init | ||
``` | ||
|
||
## Development | ||
|
||
The Remix dev server starts your app in development mode, rebuilding assets on file changes. To start the Remix dev server: | ||
|
||
```sh | ||
npm run dev | ||
``` | ||
|
||
Open up [http://localhost:3000](http://localhost:3000), and you should be ready to go! | ||
|
||
The Netlify CLI builds a production version of your Remix App Server and splits it into Netlify Functions that run locally. This includes any custom Netlify functions you've developed. The Netlify CLI runs all of this in its development mode. | ||
|
||
```sh | ||
netlify dev | ||
``` | ||
|
||
Open up [http://localhost:3000](http://localhost:3000), and you should be ready to go! | ||
|
||
Note: When running the Netlify CLI, file changes will rebuild assets, but you will not see the changes to the page you are on unless you do a browser refresh of the page. Due to how the Netlify CLI builds the Remix App Server, it does not support hot module reloading. | ||
|
||
## Deployment | ||
|
||
There are two ways to deploy your app to Netlify, you can either link your app to your git repo and have it auto deploy changes to Netlify, or you can deploy your app manually. If you've followed the setup instructions already, all you need to do is run this: | ||
|
||
```sh | ||
# preview deployment | ||
netlify deploy --build | ||
|
||
# production deployment | ||
netlify deploy --build --prod | ||
``` |
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,46 @@ | ||
import getJson from "../config/sheetFromCSV"; | ||
|
||
let errorStrike = 0; | ||
|
||
const showError = () => { | ||
window.alert("Ops!", "Ocorreu um erro ao atualizar os dados da lista."); | ||
errorStrike = 0; | ||
}; | ||
|
||
export const getData = async () => { | ||
// Função responsável por buscar os dados da planilha | ||
|
||
// Caso ocorra qualquer erro ao buscar, a função tenta por si só por mais 2 vezes | ||
// até que finalmente retorna um erro para ser exibido para o usuário | ||
try { | ||
return getJson(); | ||
} catch (e) { | ||
if (errorStrike === 2) { | ||
showError(); | ||
return new Error(e); | ||
} | ||
errorStrike += 1; | ||
getData(); | ||
} | ||
|
||
return null; | ||
}; | ||
|
||
export const getProductsCategory = (productList) => { | ||
const categories = []; | ||
let actualCategory = ""; | ||
|
||
productList.map((item) => { | ||
if ( | ||
actualCategory !== item.categoria && | ||
(item.inativo === "FALSE" || !item.inativo) && | ||
item.categoria && | ||
item.categoria.length > 1 | ||
) { | ||
categories.push(item.categoria); | ||
actualCategory = item.categoria; | ||
} | ||
return true; | ||
}); | ||
return categories; | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,92 @@ | ||
import type { CSSProperties, ImgHTMLAttributes } from "react"; | ||
|
||
export interface IIconProps { | ||
/** | ||
* The icon id, according to [Unicons](https://iconscout.com/unicons/explore/line), without "uil uil-" section. | ||
* | ||
* @Example | ||
* "cog" | ||
*/ | ||
name?: string; | ||
/** | ||
* The icon size. | ||
* | ||
* @Default | ||
* `regular` | ||
* */ | ||
size?: "small" | "regular" | "medium" | "large"; | ||
/** The icon type: linear or solid | ||
* | ||
* @Default | ||
* `line` | ||
*/ | ||
type?: "line" | "solid"; | ||
/** | ||
* Icon inline styling properties. | ||
*/ | ||
style?: CSSProperties; | ||
|
||
/** | ||
* Custom <img /> props to use custom SVG source as icon. | ||
*/ | ||
customSvg?: ImgHTMLAttributes<HTMLOrSVGImageElement>; | ||
} | ||
|
||
const Icon = ({ | ||
size = "regular", | ||
type = "line", | ||
name, | ||
style = {}, | ||
customSvg, | ||
}: IIconProps) => { | ||
const getFontSize = () => { | ||
switch (size) { | ||
case "small": | ||
return "1rem"; | ||
case "medium": | ||
return "1.5rem"; | ||
case "large": | ||
return "2rem"; | ||
case "regular": | ||
default: | ||
return "1.25rem"; | ||
} | ||
}; | ||
|
||
const getIconType = () => { | ||
switch (type) { | ||
case "solid": | ||
return "uis uis"; | ||
case "line": | ||
default: | ||
return "uil uil"; | ||
} | ||
}; | ||
|
||
if (customSvg) | ||
return ( | ||
<img | ||
{...customSvg} | ||
draggable={false} | ||
alt="" | ||
style={{ | ||
fontSize: getFontSize(), | ||
lineHeight: "1rem", | ||
...style, | ||
}} | ||
/> | ||
); | ||
|
||
return ( | ||
<i | ||
style={{ | ||
fontSize: getFontSize(), | ||
lineHeight: "1rem", | ||
...style, | ||
}} | ||
className={`${getIconType()}-${name}`} | ||
/> | ||
); | ||
}; | ||
|
||
export default Icon; |
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,40 @@ | ||
import { Button, Grid, Typography } from "@mui/material"; | ||
import { Link } from "@remix-run/react"; | ||
import Icon from "./Icon"; | ||
|
||
interface PageTitleProps { | ||
title: string; | ||
backLink?: string; | ||
} | ||
|
||
const PageTitle = ({ backLink, title }: PageTitleProps) => { | ||
return ( | ||
<Grid | ||
container | ||
justifyContent="center" | ||
alignItems="center" | ||
sx={{ borderBottom: "1px solid white" }} | ||
mb={3} | ||
> | ||
{backLink && ( | ||
<div | ||
style={{ | ||
position: "absolute", | ||
left: "20px", | ||
}} | ||
> | ||
<Link to={backLink}> | ||
<Button variant="secondaryIcon" sx={{ color: "white" }}> | ||
<Icon name="angle-left" size="large" /> | ||
</Button> | ||
</Link> | ||
</div> | ||
)} | ||
<Typography variant="h2" color="white"> | ||
{title} | ||
</Typography> | ||
</Grid> | ||
); | ||
}; | ||
|
||
export default PageTitle; |
Oops, something went wrong.