Skip to content

Commit

Permalink
Merge branch 'dev' into fix-pool-form-conviction-growth-not-converted
Browse files Browse the repository at this point in the history
  • Loading branch information
Corantin authored Sep 18, 2024
2 parents df53c0b + bbb3262 commit 0202ac0
Show file tree
Hide file tree
Showing 25 changed files with 11,112 additions and 8,556 deletions.
51 changes: 38 additions & 13 deletions .github/workflows/ai-code-review.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: "Code Review by Gemini AI"
on:
pull_request:
paths:
- "**/*.ts"
- "**/*.tsx"
- "**/*.sol"
jobs:
review:
runs-on: ubuntu-latest
Expand All @@ -13,24 +9,53 @@ jobs:
pull-requests: write
steps:
- uses: actions/checkout@v3
- name: "Get filtered diff of the pull request"

- name: "Check for !ai keyword in commit message"
id: check_commit_message
run: |
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
echo "Commit message: $COMMIT_MESSAGE"
if [[ "$COMMIT_MESSAGE" == *"!ai"* ]]; then
echo "run_ai=true" >> $GITHUB_ENV
else
echo "run_ai=false" >> $GITHUB_ENV
fi
- name: "Check if relevant files are modified"
id: check_changes
shell: bash
run: |
# Check for modified .ts, .tsx, or .sol files
git fetch origin "${{ github.event.pull_request.head.ref }}" # fetch the branch with changes
git fetch origin "${{ github.event.pull_request.base.ref }}" # fetch the target branch
git diff --name-only "origin/${{ github.event.pull_request.base.ref }}" "origin/${{ github.event.pull_request.head.ref }}" > modified_files.txt
# Check if there are any .ts, .tsx, or .sol files modified
if grep -E '\.ts$|\.tsx$|\.sol$' modified_files.txt; then
echo "files_changed=true" >> $GITHUB_ENV
else
echo "files_changed=false" >> $GITHUB_ENV
fi
- name: "Get diff of the pull request"
if: env.files_changed == 'true' && env.run_ai == 'true'
id: get_diff
shell: bash
env:
PULL_REQUEST_HEAD_REF: "${{ github.event.pull_request.head.ref }}"
PULL_REQUEST_BASE_REF: "${{ github.event.pull_request.base.ref }}"
run: |-
git fetch origin "${{ env.PULL_REQUEST_HEAD_REF }}" # fetch the branch with changes
git fetch origin "${{ env.PULL_REQUEST_BASE_REF }}" # fetch the target branch
git checkout "${{ env.PULL_REQUEST_HEAD_REF }}" # switch to the branch with changes
git diff -- '*.ts' '*.tsx' '*.sol' "origin/${{ env.PULL_REQUEST_BASE_REF }}" > "filtered_diff.txt" # generate a filtered diff
# Only include changes to .ts, .tsx, and .sol files in the diff
git diff "origin/${{ env.PULL_REQUEST_BASE_REF }}" -- '*.ts' '*.tsx' '*.sol' > "diff.txt"
{
echo "pull_request_diff<<EOF";
cat "filtered_diff.txt";
cat "diff.txt";
echo 'EOF';
} >> $GITHUB_OUTPUT # save the filtered diff to an output variable
- uses: rubensflinco/[email protected]
name: "Code Review by Gemini AI"
if: env.files_changed == 'true' && env.run_ai == 'true'
continue-on-error: true
id: review
with:
Expand All @@ -42,8 +67,8 @@ jobs:
model: "gemini-1.5-pro-latest"
pull_request_diff: |-
${{ steps.get_diff.outputs.pull_request_diff }}
pull_request_chunk_size: "5000" # chunk size is important to avoid exceeding the API limits
pull_request_chunk_size: "3500"
extra_prompt: |-
Only focus on logic and security-sensitive sections of the code.
Skip reviewing helper functions, comments, or tests.
Only review files with extensions: .ts, .tsx, .sol
Focus your review on code logic, security vulnerabilities, and potential improvements in these files.
log_level: "DEBUG"
21 changes: 14 additions & 7 deletions apps/web/app/(app)/gardens/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
getTokenGardensDocument,
getTokenGardensQuery,
} from "#/subgraph/.graphclient";
import { clouds1, clouds2 } from "@/assets";
import { clouds1, clouds2, groupFlowers } from "@/assets";
import { GardenCard, InfoBox } from "@/components";
import { LoadingSpinner } from "@/components/LoadingSpinner";
import { useSubgraphQueryMultiChain } from "@/hooks/useSubgraphQueryMultiChain";
Expand All @@ -15,6 +15,12 @@ export default function Page() {
const { data: gardens, fetching } =
useSubgraphQueryMultiChain<getTokenGardensQuery>({
query: getTokenGardensDocument,
modifier: (data) =>
data.sort(
(a, b) =>
(a.tokenGardens.length ? a.tokenGardens[0].chainId : 0) -
(b.tokenGardens.length ? b.tokenGardens[0].chainId : 0),
),
changeScope: [
{
topic: "garden",
Expand Down Expand Up @@ -78,29 +84,30 @@ export default function Page() {
<header className="flex flex-col items-center gap-8 2xl:mt-20">
<div className="flex items-center text-center">
<div className="relative flex-1">
<Image src={clouds1} alt="clouds" />
<Image src={clouds1} alt="clouds" width={205} height={205} />
</div>
<div className="mx-10 flex flex-col items-center gap-5">
<div className="flex flex-col items-center">
<h1 className="max-w-xl text-center text-neutral-content">
Explore and Join Gardens Ecosystems
Welcome to Gardens
</h1>
<p className="text-xl text-primary-content">
A place where you help shape digital economies
<p className="text-xl text-primary-content text-center">
A place where communities grow through collective
decision-making
</p>
</div>
</div>
<div className="relative flex-1">
<Image src={clouds2} alt="clouds" />
<Image src={clouds2} alt="clouds" width={205} height={205} />
</div>
</div>
<div className="relative" />
</header>
<section className="my-2 flex w-full max-w-2xl flex-col items-center justify-center gap-8 2xl:mt-10">
<div className="grid max-w-7xl grid-cols-[repeat(auto-fit,minmax(310px,1fr))] gap-6 md:grid-cols-[repeat(auto-fit,320px)] z-10">
{GardenList}
</div>
</section>
<Image src={groupFlowers} alt="flowers" />
</div>
</>
);
Expand Down
12 changes: 1 addition & 11 deletions apps/web/app/(app)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
"use client";

import React from "react";
import { usePathname } from "next/navigation";
import { Banner } from "@/assets";
import { GoBackButton, NavBar } from "@/components";
import { Breadcrumbs } from "@/components/Breadcrumbs";

export default function Layout({ children }: { children: React.ReactNode }) {
const pathname = usePathname();
return (
<div
className="bg-fixed bg-cover min-h-screen"
style={{
backgroundImage:
pathname === "/gardens" ? `url('${Banner.src}')` : undefined,
}}
>
<div className="bg-fixed bg-cover min-h-screen">
<NavBar />
<main className="mt-10 flex flex-col items-center">
<nav className="w-full max-w-6xl">
Expand All @@ -26,7 +17,6 @@ export default function Layout({ children }: { children: React.ReactNode }) {
</nav>
{children}
</main>
{/* footer */}
</div>
);
}
1 change: 0 additions & 1 deletion apps/web/app/api/ipfs/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// api/ipfs

import { Readable } from "stream";
import pinataSDK from "@pinata/sdk";
import { NextRequest, NextResponse } from "next/server";
Expand Down
Loading

0 comments on commit 0202ac0

Please sign in to comment.