Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wantouw committed Aug 23, 2024
2 parents 69f72a0 + fb5974c commit 2b31ab3
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 50 deletions.
106 changes: 67 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,87 @@
# `ss`
# ☀️ Sunshine: A SocialFi and Crowdfunding Platform

Welcome to your new `ss` project and to the Internet Computer development community. By default, creating a new project adds this README and some template files to your project directory. You can edit these template files to customize your project and to include your own code to speed up the development cycle.
[![Mainnet](https://img.shields.io/badge/Deployed%20on-Mainnet-brightgreen)](https://gtbsm-faaaa-aaaak-ak2yq-cai.icp0.io/)
[![Repo](https://img.shields.io/badge/Repo-Link-blue)](https://github.com/TheoJustin/sunshine-bali)

To get started, you might want to explore the project directory structure and the default configuration file. Working with this project in your development environment will not affect any production deployment or identity tokens.
Sunshine is a SocialFi and Crowdfunding platform that revolutionizes how projects are funded and managed on the blockchain. Our platform offers seamless project prototype submission while integrating AI-driven sentiment analysis (NLP) to monitor and evaluate community feedback. By detecting negative comments, such as those related to disturbing content or potential scams, Sunshine automatically manages these flagged posts through a DAO system, ensuring that only trustworthy projects are promoted. Once a project is validated and stored in our dApp, users can crowdfund it, driving innovation and growth in the Web3 space.

To learn more before you start working with `ss`, see the following documentation available online:
## 🛠 Track

- [Quick Start](https://internetcomputer.org/docs/current/developer-docs/setup/deploy-locally)
- [SDK Developer Tools](https://internetcomputer.org/docs/current/developer-docs/setup/install)
- [Motoko Programming Language Guide](https://internetcomputer.org/docs/current/motoko/main/motoko)
- [Motoko Language Quick Reference](https://internetcomputer.org/docs/current/motoko/main/language-manual)
**Fully On-Chain dApps**

If you want to start working on your project right away, you might want to try the following commands:
## 👥 Team Participants

```bash
cd ss/
dfx help
dfx canister --help
```
- **@TheoJustin**
- **@josetano2**
- **@wantouw**

Discord Handles:
- **@tj_7**
- **@hazui**
- **@ryanui**

## Running the project locally
## 🌐 Mainnet Canister

If you want to test your project locally, you can use the following commands:
[Visit the Mainnet Deployment](https://gtbsm-faaaa-aaaak-ak2yq-cai.icp0.io/)

```bash
# Starts the replica, running in the background
dfx start --background
## 🪙 OISY Wallet Principal

# Deploys your canisters to the replica and generates your candid interface
dfx deploy
```
`k5dqk-jsgzj-tix5s-ik7kz-fhya7-nrrpa-ygsky-mndrl-mteyh-7zbcr-rqe`

Once the job completes, your application will be available at `http://localhost:4943?canisterId={asset_canister_id}`.
## 🖥️ Run Locally

If you have made changes to your backend canister, you can generate a new candid interface with
If you prefer to run the project locally instead of visiting the mainnet, follow these instructions:

```bash
npm run generate
```
1. **Update DFX**
```bash
dfxvm update
```

at any time. This is recommended before starting the frontend development server, and will be run automatically any time you run `dfx deploy`.
2. **Start the DFX network**
```bash
dfx start --clean --background
```

If you are making frontend changes, you can start a development server with
3. **Deploy the project locally**
```bash
dfx deploy
```

```bash
npm start
```
4. **Install dependencies**
```bash
npm i
```

Which will start a server at `http://localhost:8080`, proxying API requests to the replica at port 4943.
5. **Start the frontend**
```bash
npm start
```

### Note on frontend environment variables
6. **Set up the Python environment for NLP and Flask**
```bash
sudo apt install python3-pip
pip install Flask nltk
python3 nlp.py
python3 -c "import nltk; nltk.download('stopwords')"
python3 -c "import nltk; nltk.download('punkt_tab')"
python3 -c "import nltk; nltk.download('wordnet ')"
pip install flask-cors
python3 app.py
```

If you are hosting frontend code somewhere without using DFX, you may need to make one of the following adjustments to ensure your project does not fetch the root key in production:
7. **Quick setup with one command**
```bash
pip install Flask nltk;python3 -c "import nltk; nltk.download('stopwords')";python3 -c "import nltk; nltk.download('punkt_tab')";python3 -c "import nltk; nltk.download('wordnet ')";pip install flask-cors;
```

- set`DFX_NETWORK` to `ic` if you are using Webpack
- use your own preferred method to replace `process.env.DFX_NETWORK` in the autogenerated declarations
- Setting `canisters -> {asset_canister_id} -> declarations -> env_override to a string` in `dfx.json` will replace `process.env.DFX_NETWORK` with the string in the autogenerated declarations
- Write your own `createActor` constructor
## 📚 What We Learned

Throughout this project, we explored a multitude of features available on the Internet Computer, including timers, Internet Identity, and DAO tools, all of which we successfully integrated into Sunshine. Additionally, we learned how to incorporate AI capabilities through HTTP requests, enabling NLP and sentiment analysis to classify comments on our dApp.

## ⚠️ Challenges

Developing Sunshine was a complex endeavor that presented several challenges. We often faced time constraints, which led to frequent merge conflicts that were difficult to resolve. Despite encountering numerous errors and bugs, particularly with Motoko and other aspects of the dApp, we persevered, learned extensively, and ultimately enjoyed the process.

## 🎉 What We Are Proud Of

We take immense pride in the successful completion of Sunshine. All features were built to meet our expectations, and deploying the dApp to the mainnet marks a significant achievement. We are excited to see the impact Sunshine will have on the community, empowering project developers, Web3 builders, investors, and the broader Web3 ecosystem.
10 changes: 5 additions & 5 deletions src/ss_frontend/src/components/HomePost.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const HomePost = ({ post, choosePost, refetch }) => {
<p className='text-xl font-medium'>{name}</p>
</div>
<p className='text-base '>{post.description}</p>
{post.images.length != 0 && (
{post && post.images && post.images.length != 0 && (
<div className="items-center w-full flex justify-start gap-4 p-4 overflow-x-scroll">
{post.images.map((imageUrl) => {
return (
Expand All @@ -98,18 +98,18 @@ const HomePost = ({ post, choosePost, refetch }) => {
<div className='flex items-center gap-2 cursor-pointer' onClick={handleLike}>
{liked == true ? <>
<IoMdHeart className='size-6' />
<p className='text-lg text-gray-500'>{post.likes.length}</p>
<p className='text-lg text-gray-500'>{post && post.likes && post.likes.length}</p>
</> : <><IoIosHeartEmpty className='size-6' />
<p className='text-lg text-gray-500'>{post.likes.length}</p></>}
<p className='text-lg text-gray-500'>{post && post.likes && post.likes.length}</p></>}

</div>
<div className='flex items-center gap-2'>
<FaRegComments className='size-6' />
<p className='text-lg text-gray-500'>{post.comments.length}</p>
<p className='text-lg text-gray-500'>{post && post.comments && post.comments.length}</p>
</div>
<div className='flex items-center gap-2'>
<RiMoneyDollarCircleLine className='size-6' />
<p className='text-lg text-gray-500'>{post.investors.length}</p>
<p className='text-lg text-gray-500'>{post && post.investors && post.investors.length}</p>
</div>
</div>
{
Expand Down
9 changes: 3 additions & 6 deletions src/ss_frontend/src/pages/PeoplePage.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import React, { useState, useEffect } from "react";
import { useQuery, QueryClient, QueryClientProvider } from "react-query";
import { useQuery } from "react-query";
import MainTemplate from "../templates/MainTemplate";
import profile_1 from "../assets/about/theo.jpg";
import profile_2 from "../assets/about/ryan.jpg";
import People from "../components/People";
import { ss_backend } from "../../../declarations/ss_backend";

// Create a QueryClient instance
const queryClient = new QueryClient();

const PeoplePage = () => {
const [people, setPeople] = useState();
const { isLoading, error, isFetching } = useQuery({
Expand Down Expand Up @@ -42,10 +39,10 @@ const PeoplePage = () => {
return (
<MainTemplate>
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6 p-4 pt-24">
{isLoading || isFetching ? <></> : people}
{/* {isLoading || isFetching ? <></> : people} */}
</div>
</MainTemplate>
);
};

export default PeoplePage;
export default PeoplePage;

0 comments on commit 2b31ab3

Please sign in to comment.