Skip to content

Commit

Permalink
Merge pull request #815 from basedosdados/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
AldemirLucas authored Apr 25, 2024
2 parents 0c8cce4 + e2cae09 commit 0f57849
Show file tree
Hide file tree
Showing 82 changed files with 1,088 additions and 1,638 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/release-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
environment:
name: development
env:
NEXT_PORT: ${{ vars.NEXT_PORT }}
NEXT_PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }}
NEXT_PUBLIC_SITE_NAME: ${{ vars.NEXT_PUBLIC_SITE_NAME }}
NEXT_PUBLIC_KEY_STRIPE: ${{ secrets.NEXT_PUBLIC_KEY_STRIPE }}
NEXT_PUBLIC_BASE_URL_FRONTEND: ${{ vars.NEXT_PUBLIC_BASE_URL_FRONTEND }}
NODE_ENV: ${{ vars.NODE_ENV }}
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:development

Expand All @@ -44,4 +44,6 @@ jobs:
tags: ${{ env.IMAGE_NAME }}
build-args: |
NEXT_PUBLIC_API_URL=${{ env.NEXT_PUBLIC_API_URL }}
NEXT_PUBLIC_SITE_NAME=${{ env.NEXT_PUBLIC_SITE_NAME }}
NEXT_PUBLIC_KEY_STRIPE=${{ env.NEXT_PUBLIC_KEY_STRIPE }}
NEXT_PUBLIC_BASE_URL_FRONTEND=${{ env.NEXT_PUBLIC_BASE_URL_FRONTEND }}
4 changes: 3 additions & 1 deletion .github/workflows/release-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
environment:
name: staging
env:
NEXT_PORT: ${{ vars.NEXT_PORT }}
NEXT_PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }}
NEXT_PUBLIC_SITE_NAME: ${{ vars.NEXT_PUBLIC_SITE_NAME }}
NEXT_PUBLIC_KEY_STRIPE: ${{ secrets.NEXT_PUBLIC_KEY_STRIPE }}
NEXT_PUBLIC_BASE_URL_FRONTEND: ${{ vars.NEXT_PUBLIC_BASE_URL_FRONTEND }}
NODE_ENV: ${{ vars.NODE_ENV }}
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:staging

Expand All @@ -44,4 +44,6 @@ jobs:
tags: ${{ env.IMAGE_NAME }}
build-args: |
NEXT_PUBLIC_API_URL=${{ env.NEXT_PUBLIC_API_URL }}
NEXT_PUBLIC_SITE_NAME=${{ env.NEXT_PUBLIC_SITE_NAME }}
NEXT_PUBLIC_KEY_STRIPE=${{ env.NEXT_PUBLIC_KEY_STRIPE }}
NEXT_PUBLIC_BASE_URL_FRONTEND=${{ env.NEXT_PUBLIC_BASE_URL_FRONTEND }}
4 changes: 3 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
environment:
name: production
env:
NEXT_PORT: ${{ vars.NEXT_PORT }}
NEXT_PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }}
NEXT_PUBLIC_SITE_NAME: ${{ vars.NEXT_PUBLIC_SITE_NAME }}
NEXT_PUBLIC_KEY_STRIPE: ${{ secrets.NEXT_PUBLIC_KEY_STRIPE }}
NEXT_PUBLIC_BASE_URL_FRONTEND: ${{ vars.NEXT_PUBLIC_BASE_URL_FRONTEND }}
NODE_ENV: ${{ vars.NODE_ENV }}
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:production

Expand All @@ -44,4 +44,6 @@ jobs:
tags: ${{ env.IMAGE_NAME }}
build-args: |
NEXT_PUBLIC_API_URL=${{ env.NEXT_PUBLIC_API_URL }}
NEXT_PUBLIC_SITE_NAME=${{ env.NEXT_PUBLIC_SITE_NAME }}
NEXT_PUBLIC_KEY_STRIPE=${{ env.NEXT_PUBLIC_KEY_STRIPE }}
NEXT_PUBLIC_BASE_URL_FRONTEND=${{ env.NEXT_PUBLIC_BASE_URL_FRONTEND }}
2 changes: 2 additions & 0 deletions next/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ RUN \
FROM node:18.17.0-alpine AS builder
ARG NEXT_PUBLIC_API_URL
ARG NEXT_PUBLIC_KEY_STRIPE
ARG NEXT_PUBLIC_BASE_URL_FRONTEND
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
ENV NEXT_PUBLIC_KEY_STRIPE=$NEXT_PUBLIC_KEY_STRIPE
ENV NEXT_PUBLIC_BASE_URL_FRONTEND=$NEXT_PUBLIC_BASE_URL_FRONTEND
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
Expand Down
2 changes: 1 addition & 1 deletion next/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ export const setAccessToken = (token) => {
if (!token || token === "null")
return (axiosInstance.defaults.headers.common["Authorization"] = null);
axiosInstance.defaults.headers.common["Authorization"] = `Token ${token}`;
};
};
2 changes: 1 addition & 1 deletion next/components/atoms/Dot.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box } from "@chakra-ui/layout";
import { Box } from "@chakra-ui/react";

export function Dot({ radius = 1 }) {
return (
Expand Down
2 changes: 1 addition & 1 deletion next/components/atoms/GreenTab.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { Tab } from "@chakra-ui/tabs";
import { Tab } from "@chakra-ui/react";

export default function GreenTab({ children, ...style }) {
return (
Expand Down
4 changes: 2 additions & 2 deletions next/components/atoms/TemporalCoverageDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export function TemporalCoverageBar ({ value }) {
display="flex"
alignItems="center"
gap="4px"
>PRO
>PAGO
<RedirectIcon
display={bool ? "flex" : "none"}
position="relative"
Expand Down Expand Up @@ -372,7 +372,7 @@ export function TemporalCoverageBar ({ value }) {
display="flex"
>
<TooltipContent
text={dateEnd?.type === "open" ? "Acesso liberado entre" : "Assine a BD Pro para liberar entre"}
text={dateEnd?.type === "open" ? "Acesso liberado entre" : "Assine a BD PAGO para liberar entre"}
firstValue={dateEnd?.type === "open" ? dateStart : dateEnd?.type === "closed" ? dateStart : dateMid}
lastValue={dateEnd}
isOpen={flag}
Expand Down
10 changes: 4 additions & 6 deletions next/components/molecules/BaseResourcePage.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import {
HStack,
VStack,
Flex,
Button,
AlertDialog,
AlertDialogBody,
AlertDialogContent,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogOverlay,
} from "@chakra-ui/modal";
import {
HStack,
VStack,
Flex,
Button
} from "@chakra-ui/react";
import { useDisclosure } from "@chakra-ui/hooks";
import Head from "next/head";
Expand Down
2 changes: 1 addition & 1 deletion next/components/molecules/DisclaimerBox.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Stack } from "@chakra-ui/layout";
import { Stack } from "@chakra-ui/react";
import SectionText from "../atoms/SectionText";

export default function DisclaimerBox({ title, text, children, ...style }) {
Expand Down
22 changes: 14 additions & 8 deletions next/components/molecules/ImgCrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
ModalHeader,
ModalBody,
ModalFooter,
ModalCloseButton
ModalCloseButton,
Spinner
} from '@chakra-ui/react';
import { useState, useEffect, useRef } from 'react';
import ReactCrop, {
Expand All @@ -16,10 +17,7 @@ import ReactCrop, {
import cookies from 'js-cookie';
import { isMobileMod } from '../../hooks/useCheckMobile.hook';

import {
getUser,
updatePictureProfile
} from '../../pages/api/user'
import updatePictureProfile from '../../pages/api/user/updatePictureProfile'

import SectionTitle from '../atoms/SectionTitle';
import RoundedButton from '../atoms/RoundedButton';
Expand All @@ -32,11 +30,11 @@ export default function CropImage ({
src,
id,
username,
email
}) {
const imgRef = useRef(null)
const [completedCrop, setCompletedCrop] = useState()
const [crop, setCrop] = useState()
const [isLoading, setIsLoading] = useState(false)

function onImageLoad(e) {
const { naturalWidth: width, naturalHeight: height } = e.currentTarget
Expand All @@ -63,6 +61,7 @@ export default function CropImage ({
}, [!!isOpen])

async function handlerUpdatePicture() {
setIsLoading(true)
const image = imgRef.current

if (!image || !completedCrop) return null
Expand Down Expand Up @@ -130,7 +129,8 @@ export default function CropImage ({

const res = await updatePictureProfile(uid, filePic)
if(res?.status === 200) {
const userData = await getUser(email)
const userData = await fetch(`/api/user/getUser?p=${btoa(uid)}`, { method: "GET" })
.then(res => res.json())
cookies.set('userBD', JSON.stringify(userData))
window.location.reload()
}
Expand Down Expand Up @@ -203,6 +203,7 @@ export default function CropImage ({
width={isMobileMod() ? "100%" : "fit-content"}
_hover={{transform: "none", opacity: 0.8}}
onClick={onClose}
isDisabled={isLoading}
>
Cancelar
</RoundedButton>
Expand All @@ -211,8 +212,13 @@ export default function CropImage ({
borderRadius="30px"
_hover={{transform: "none", opacity: 0.8}}
onClick={() => handlerUpdatePicture()}
isDisabled={isLoading}
>
Salvar
{isLoading ?
<Spinner />
:
"Salvar"
}
</RoundedButton>
</Stack>
</ModalFooter>
Expand Down
2 changes: 1 addition & 1 deletion next/components/molecules/KnowOurServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
Heading,
HStack,
VStack
} from "@chakra-ui/layout";
} from "@chakra-ui/react";
import { useState } from "react";
import SectionText from "../atoms/SectionText";
import SectionTitle from "../atoms/SectionTitle";
Expand Down
Loading

0 comments on commit 0f57849

Please sign in to comment.