Skip to content

Commit

Permalink
Merge branch 'dev' into feature/issue_84
Browse files Browse the repository at this point in the history
# Conflicts:
#	frontend/gostarkme-web/app/app/fund/[fundId]/page.tsx
  • Loading branch information
[email protected] authored and [email protected] committed Sep 30, 2024
2 parents a1a8dcc + 48ba356 commit 9eeb669
Show file tree
Hide file tree
Showing 17 changed files with 489 additions and 59 deletions.
94 changes: 54 additions & 40 deletions .github/workflows/contract_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@ name: CI

on:
pull_request:
branches:
- dev

push:
branches:
- dev
- main

jobs:
check-lint:
determine-changes:
runs-on: ubuntu-latest
outputs:
contracts_dir: ${{ steps.changes.outputs.contracts_dir }}
steps:
- uses: actions/checkout@v2

Expand All @@ -14,71 +23,76 @@ jobs:
id: changes
with:
filters: |
contracts_dir:
contracts_dir:
- 'contracts/src/**'
- name: Install scarb
if: steps.changes.outputs.contracts_dir == 'true'
run: |
cd contracts
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v 2.6.5
check-lint:
runs-on: ubuntu-latest
needs: determine-changes
steps:
- uses: actions/checkout@v2

- name: Setup Scarb
uses: software-mansion/setup-scarb@v1
if: needs.determine-changes.outputs.contracts_dir == 'true'
with:
scarb-version: "2.6.5"

- name: Run scarb fmt
if: steps.changes.outputs.contracts_dir == 'true'
run: |
cd contracts
scarb fmt
- name: Run Scarb formatting
if: needs.determine-changes.outputs.contracts_dir == 'true'
working-directory: contracts
run: scarb fmt

- name: No changes detected in contracts directory
if: needs.determine-changes.outputs.contracts_dir == 'false'
run: echo "No linting perfomed since no changes have been detected in the contracts directory."

check-contracts-changes:
runs-on: ubuntu-latest
needs: determine-changes
steps:
- uses: actions/checkout@v2

- name: Check for changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
contracts_dir:
- 'contracts/src/**'

- name: Install scarb
if: steps.changes.outputs.contracts_dir == 'true'
run: |
cd contracts
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v 2.6.5
uses: software-mansion/setup-scarb@v1
if: needs.determine-changes.outputs.contracts_dir == 'true'
with:
scarb-version: "2.6.5"

- name: Run Scarb check
if: needs.determine-changes.outputs.contracts_dir == 'true'
working-directory: contracts
run: scarb check

- name: Run scarb check
if: steps.changes.outputs.contracts_dir == 'true'
run: |
cd contracts
scarb check
- name: No changes detected in contracts directory
if: needs.determine-changes.outputs.contracts_dir == 'false'
run: echo "No contracts checks done since no changes have been detected in the contracts directory."

run-tests:
runs-on: ubuntu-latest
needs: determine-changes
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Check for changes
uses: dorny/paths-filter@v3
id: changes
- name: Install Scarb
uses: software-mansion/setup-scarb@v1
if: needs.determine-changes.outputs.contracts_dir == 'true'
with:
filters: |
contracts_dir:
- 'contracts/src/**'
scarb-version: "2.6.5"

- name: Install scarb
if: steps.changes.outputs.contracts_dir == 'true'
run: |
cd contracts
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v 2.6.5

- name: Install snfoundry
uses: foundry-rs/setup-snfoundry@v3
if: needs.determine-changes.outputs.contracts_dir == 'true'
with:
starknet-foundry-version: "0.20.1"

- name: Run Cairo tests
if: needs.determine-changes.outputs.contracts_dir == 'true'
id: cairo_tests
run: bash scripts/run_tests.sh

- name: No changes detected in contracts directory
if: needs.determine-changes.outputs.contracts_dir == 'false'
run: echo "No tests were run since no changes have been detected in the contracts directory."
10 changes: 5 additions & 5 deletions frontend/gostarkme-web/animations/StardustAnimation.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useRef } from 'react';

export const StardustAnimation = () => {
export const StardustAnimation = ({height, width}: {height: number, width: number}) => {
const canvasRef = useRef<HTMLCanvasElement>(null);

useEffect(() => {
Expand All @@ -11,8 +11,8 @@ export const StardustAnimation = () => {
let animationFrameId: number;

// Set canvas size
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
canvas.width = width;
canvas.height = height;

// Create stars
const stars: { x: number; y: number; size: number; speed: number; }[] = [];
Expand Down Expand Up @@ -54,7 +54,7 @@ export const StardustAnimation = () => {
return () => {
cancelAnimationFrame(animationFrameId);
};
}, []);
}, [height, width]);

return <canvas ref={canvasRef} className="relative top-0 left-0 w-full h-full" style={{position: 'absolute'}} />;
return <canvas ref={canvasRef} className="top-0 left-0" style={{position: 'absolute', inset: 0}} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import Fund from "@/components/modules/Fund/Fund";
import Bounded from "@/components/ui/Bounded";
import Divider from "@/components/ui/Divider";

export function generateStaticParams() {
return [{ fundId: '1' }]
}

const FundDetailsPage = async ({ params }: { params: { fundId: string } }) => {
return (
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
import ProgressBar from '@/components/ui/ProgressBar';
import Divider from '@/components/ui/Divider';
import Image from 'next/image';
import Footer from '@/components/ui/Footer';
import Navbar from '@/components/ui/Navbar';

const navItems = [
{ label: 'My Profile', href: '/profile' },
{ label: 'My funds', href: '/funds' }
];

interface UserProfilePageProps {
params: {
useraddr: string;
};
}

export function generateStaticParams() {
return [{ useraddr: '1' }]
}

const UserProfilePage: React.FC<UserProfilePageProps> = ({ params }) => {
const { useraddr } = params;

Expand All @@ -22,9 +33,16 @@ const UserProfilePage: React.FC<UserProfilePageProps> = ({ params }) => {

return (
<div className="min-h-screen flex flex-col">
<header className="w-full">
{/* TODO:The navbar can be added here in the future */}
</header>
<Navbar
logoSrc={process.env.NEXT_PUBLIC_APP_ROOT + "icons/starklogo.png"}
logoAlt="Go Stark Me logo"
title="Go Stark Me"
navItems={navItems}
ctaButton={{
label: "Connect wallet",
href: "/"
}}
/>

<main className="flex flex-grow w-full items-center justify-center bg-white p-8">
{/* Profile Section */}
Expand Down Expand Up @@ -77,6 +95,7 @@ const UserProfilePage: React.FC<UserProfilePageProps> = ({ params }) => {
</div>
</section>
</main>
<Footer />
</div>
);
};
Expand Down
20 changes: 20 additions & 0 deletions frontend/gostarkme-web/app/app/newfunding/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"use client"; // Mark this component as a Client Component
import Bounded from "@/components/ui/Bounded";
import Divider from "@/components/ui/Divider";
import Stages from "@/components/modules/newfunding/Stages";

const NewFundingPage = ({ params }: { params: { fundId: string } }) => {
return (
<>
<Bounded className="px-60 text-lg">
<h1 className="font-sans text-4xl font-normal leading-snug text-left">
Your new fund!
</h1>
<Divider />
<Stages />
</Bounded>
</>
);
};

export default NewFundingPage;
53 changes: 53 additions & 0 deletions frontend/gostarkme-web/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import FundCards from "@/components/dashboard/fundCard";
import React from "react";

const Dashboard = () => {
const funds = [
{
type: "Project",
title: "Adrian's fund",
description: "I need help with my project",
},
{
type: "Charity",
title: "Adrian's fund",
description: "I need help with my project",
},
{
type: "Charity",
title: "Adrian's fund",
description: "I need help with my project",
},
{
type: "Project",
title: "Adrian's fund",
description: "I need help with my project",
},

{
type: "Charity",
title: "Adrian's fund",
description: "I need help with my project",
},
{
type: "Project",
title: "Adrian's fund",
description: "I need help with my project",
},
];
return (
<div className="container mx-auto p-6 min-h-screen">
<h1 className="text-4xl font-bold mb-6 flex items-center">
Latest Funds
<span className="ml-2 text-yellow-400">&#x2728;</span>
</h1>
<div className="grid grid-cols-1 md:grid-cols-2 gap-x-4 gap-y-6 md:gap-x-[138px] md:gap-y-[84px]">
{funds.map((fund, index) => (
<FundCards key={index} fund={fund} index={index} />
))}
</div>
</div>
);
};

export default Dashboard;
16 changes: 11 additions & 5 deletions frontend/gostarkme-web/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,28 @@
import { LinkButton } from "@/components/ui/LinkButton";
import { WelcomeBar } from "@/components/welcomepage/WelcomeBar";
import { WelcomeItems } from "@/components/welcomepage/WelcomeItems";
import Footer from "@/components/ui/Footer";
import Image from "next/image";
import { StardustAnimation } from "@/animations/StardustAnimation";
import useComponentSize from "@/hooks/useComponentSize.hook";

export default function Home() {
const ROOT = process.env.NEXT_PUBLIC_APP_ROOT;


const [ref, width, height] = useComponentSize();

return (
<main className="flex min-h-screen w-full flex-col items-center">
<main className="flex min-h-screen w-full flex-col items-center" >
<WelcomeBar />
<div className="w-full max-w-screen-2xl relative" ref={ref}>
<section className="w-full max-w-screen-2xl grid grid-cols-1 md:grid-cols-2 p-10">
<div className="justify-self-center flex flex-col justify-center items-center md:items-start gap-4 p-4">
<h1 className="text-4xl font-bold">Upload your cause</h1>
<WelcomeItems text="Give it a name." src={ROOT + "icons/user.png"} />
<WelcomeItems text="Give a good purpose." src={ROOT + "icons/target.png"} />
<WelcomeItems text="Recollect Stars." src={ROOT + "icons/star.png"} />
<WelcomeItems text="Receive donations." src={ROOT + "icons/starklogo.png"} />
</div>
<StardustAnimation />
</div>
<Image
src={ROOT + "images/starcard.png"}
alt="stark logo"
Expand All @@ -28,7 +32,8 @@ export default function Home() {
className="self-center justify-self-center w-2/3 max-w-80 rounded-2xl"
/>
</section>

<StardustAnimation height={height} width={width} />
</div>
<section className="flex flex-col md:flex-row justify-center space-y-4 md:space-y-0 md:space-x-1.5 p-4 m-10">
{/* <!-- Card 1 --> */}
<div className="flex flex-col gap-y-6 p-8 md:p-12 shadow-md bg-gray-100 grow-0 shrink-0 md:basis-1/2">
Expand Down Expand Up @@ -102,6 +107,7 @@ export default function Home() {
</div>
</div>
</section>
<Footer />
</main>
);
}
Loading

0 comments on commit 9eeb669

Please sign in to comment.