Skip to content

Commit

Permalink
[Release 1.2.0] - Adding new features and bug fixes πŸ’š (#9)
Browse files Browse the repository at this point in the history
At this pull request, we have made a lot of improvements in all the app.

- [x] Added new docs to readme
- [x] Added mainly features.
- [x] And much more!
  • Loading branch information
neopromic authored Nov 27, 2024
2 parents 60a6ed7 + 46c3932 commit 69613e5
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 49 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@ next-env.d.ts
.env

# docker
.postgres-data
.postgres-data

# IDES
.idea
57 changes: 34 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,47 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
# πŸ’š Jupiter finance, seu gerenciador de finanΓ§as inteligente.

## Getting Started
O Jupiter Finance foi desenvolvido com auxilio da full stack week, do Felipe Rocha, e sofreu algumas mudanΓ§as para tornΓ‘-lo ΓΊnico e feito com carinho por mim, Wesley. πŸ’š

First, run the development server:
---

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
## πŸ’š Funcionalidades

- [x] VocΓͺ pode adicionar transaçáes com base na sua data atual, transaçáes futuras (com o date picker), e adicionar transaçáes da datas passadas.
- [x] VocΓͺ pode deletar transaçáes
- [x] VocΓͺ pode editar transaçáes (nome, valor, data, etc)
- [x] Validaçáes de seguranΓ§a adicionadas, vocΓͺ pode obter os dados apenas se vocΓͺ estiver autenticado, e se aqueles dados forem seus.
- [ ] Dashboard pra gerenciar usuÑrios, orgs, webhooks, e mais. (Apenas pra desenvolvimento e pra administração apenas, em produção.)
- [ ] Adicionar novos meios de autenticação além do clerk (auth js, por exemplo).
- [x] Adicionar logs de clicks, page views, web records, e mais, usando o PostHog.
- [ ] Adicionar WebHooks do discord, etc
- [ ] Adicionar organizaçáes no login (originalmente clerk, deve ser implementado do zero se for auth js. A logica deve ser feita o mais genérica o possível em caso do uso de outros métodos de login.).

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
---

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
## πŸ’š Como contribuir

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
Para contribuir, vocΓͺ pode clonar o repositΓ³rio e seguir os seguintes passos:

## Learn More
### 1. Clonando repositΓ³rio

```bash
git clone https://github.com/neopromic/jupiter-finance.git
```

To learn more about Next.js, take a look at the following resources:
### 2. Obtendo variΓ‘veis de ambiente de desenvolvimento

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
- 1. Primeiro, vocΓͺ deve ter o docker instalado em sua mΓ‘quina, ou criar um banco de testes grΓ‘tis na [neon](https://neon.tech).
- 2. Em seu `.env`, cole a string de conexΓ£o obtida no [neon.tech](https://neon.tech), ou use `"postgresql://postgres:password@localhost:5432/finance-ai"` do docker.
- 3. Caso prefira usar o docker, suba o container (pois o docker compose jΓ‘ estΓ‘ configurado no projeto), usando `docker compose up -d`.
- 4. Crie um projeto no clerk, e obtenha as credenciais.
- 5. Crie uma conta no PostHog e adicione as credenciais.
- Pronto! Credenciais adicionadas! πŸ’š

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
### 3. Crie uma branch nova e comece a contribuir!

## Deploy on Vercel
- 1. Crie uma nova branch (`git branch feat/name-of-the-feat && git checkout feat/name-of-the-feat`)
- 2. Quando for fazer Pull Request, envie pra comparação com a branch de **`dev`**(desenvolvimento)! Nós lançamos primeiro na dev, e depois fazemos merge na main, quando tiver um bom número de mudanças.

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
---

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
#### Criado por Wesley Souza, com carinho. πŸ’š
13 changes: 5 additions & 8 deletions app/(authenticated)/transactions/_columns/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
"use client";

import { ColumnDef } from "@tanstack/react-table";
import { Transactions } from "@prisma/client";
import type { ColumnDef } from "@tanstack/react-table";
import type { Transactions } from "@prisma/client";
import TransactionTypeBadge from "../_components/type-badge";
import { Button } from "@/app/_components/ui/button";
import { TrashIcon } from "lucide-react";
import { TRANSACTION_PAYMENT_METHOD_MAP } from "@/app/_constants/transaction";
import { TRANSACTION_CATEGORY_MAP } from "@/app/_constants/transaction";
import EditTransactionButton from "../_components/edit-transaction-button";
import DeleteTransactionButton from "../_components/delete-transaction-button";

export const transactionsColumns: ColumnDef<Transactions>[] = [
{
Expand Down Expand Up @@ -44,7 +43,7 @@ export const transactionsColumns: ColumnDef<Transactions>[] = [
header: "Data",
cell: ({ row: { original: transaction } }) => {
return (
<p className="text-muted">
<p className="text-muted-foreground">
{new Date(transaction.date).toLocaleDateString("pt-BR", {
day: "2-digit",
month: "long",
Expand All @@ -71,9 +70,7 @@ export const transactionsColumns: ColumnDef<Transactions>[] = [
return (
<div className="flex items-center gap-2">
<EditTransactionButton transaction={transaction} />
<Button variant="ghost" size="icon">
<TrashIcon size={16} />
</Button>
<DeleteTransactionButton transactionId={transaction.id} />
</div>
);
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { deleteTransaction } from "@/app/_actions/delete-transactions";
import { Button } from "@/app/_components/ui/button";
import { TrashIcon } from "lucide-react";

interface IDeleteTransactionsButtonProps {
transactionId: string;
}

const DeleteTransactionButton = ({
transactionId,
}: IDeleteTransactionsButtonProps) => {
const handleClick = async () => {
await deleteTransaction({ transactionId });
};

return (
<Button variant="ghost" size="icon" onClick={handleClick}>
<TrashIcon size={16} />
</Button>
);
};

export default DeleteTransactionButton;
29 changes: 29 additions & 0 deletions app/_actions/delete-transactions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"use server";

import { db } from "@/app/_lib/prisma";
import { auth } from "@clerk/nextjs/server";
import { revalidatePath } from "next/cache";

interface IDeleteTransactions {
transactionId: string;
}

export const deleteTransaction = async ({
transactionId,
}: IDeleteTransactions) => {
const { userId } = await auth();

if (!userId) {
throw new Error("", {
cause: "You need log-in account to delete transactions.",
});
}

await db.transactions.delete({
where: {
id: transactionId,
userId,
},
});
revalidatePath("/transactions");
};
2 changes: 1 addition & 1 deletion app/_actions/upsert-transactions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { db } from "@/app/_lib/prisma";
import { auth } from "@clerk/nextjs/server";
import {
import type {
TransactionCategory,
TransactionPaymentMethod,
TransactionType,
Expand Down
4 changes: 1 addition & 3 deletions app/_components/user-avatar-button.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react-hooks/rules-of-hooks */
"use client";

import { redirect } from "next/navigation";
Expand All @@ -16,6 +15,7 @@ import { useRouter } from "next/navigation";
const UserAvatarButton = () => {
const { user } = useUser();
const { signOut } = useClerk();
const router = useRouter();

const handleLogout = async () => {
await signOut();
Expand All @@ -28,8 +28,6 @@ const UserAvatarButton = () => {
return null;
}

const router = useRouter();

return (
<>
<DropdownMenu>
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ version: "3"
services:
postgres:
image: postgres:latest
container_name: finance-ai-database
container_name: jupiter-finance-database
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: finance-ai
POSTGRES_DB: jupiter-finance
ports:
- "5432:5432"
volumes:
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"name": "finance-ai",
"name": "jupiter-finance",
"version": "1.1.0",
"private": true,
"author": {
"email": "[email protected]",
"name": "Wesley Souza",
"url": "https://dev-wesleysouza.vercel.app/"
},
"scripts": {
"dev": "next dev",
"build": "prisma generate && prisma migrate deploy && next build",
Expand Down Expand Up @@ -113,4 +118,4 @@
"@semantic-release/github"
]
}
}
}
12 changes: 3 additions & 9 deletions public/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 69613e5

Please sign in to comment.