-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ad7f64
commit 87e010c
Showing
76 changed files
with
5,931 additions
and
3,126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
REACT_APP_DFX_NETWORK = local | ||
|
||
REACT_APP_USER_CANISTER_ID = bkyz2-fmaaa-aaaaa-qaaaq-cai |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,3 @@ | ||
.App { | ||
text-align: center; | ||
} | ||
|
||
.App-logo { | ||
height: 40vmin; | ||
pointer-events: none; | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
.App-logo { | ||
animation: App-logo-spin infinite 20s linear; | ||
} | ||
} | ||
|
||
.App-header { | ||
background-color: #282c34; | ||
min-height: 100vh; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: calc(10px + 2vmin); | ||
color: white; | ||
} | ||
|
||
.App-link { | ||
color: #61dafb; | ||
} | ||
|
||
@keyframes App-logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { ActorSubclass, HttpAgent, Identity } from "@dfinity/agent"; | ||
import { _SERVICE } from "../declarations/feed/feed.did"; | ||
import { createActor } from "../declarations/feed/index"; | ||
import { _getHttpAgent } from '../utils/common'; | ||
import { Principal } from "@dfinity/principal"; | ||
|
||
const DFX_NETWORK = process.env.REACT_APP_DFX_NETWORK; | ||
|
||
export default class Feed { | ||
|
||
canisterId: Principal; | ||
identity: Identity; | ||
actor: ActorSubclass<_SERVICE>; | ||
|
||
constructor(canisterId: Principal, identity: Identity) { | ||
this.canisterId = canisterId; | ||
this.identity = identity; | ||
this.actor = createActor(canisterId, { | ||
agent: _getHttpAgent(identity), | ||
}); | ||
} | ||
|
||
// async createPost() { | ||
// // 发帖前更新当前可用的bucket | ||
// assert(await this.actor.checkAvailableBucket(), true); | ||
|
||
// const result = await this.actor.createPost( | ||
// "this is title", | ||
// "this is content" | ||
// ); | ||
// // console.log('createPost result', result); | ||
// return result | ||
// } | ||
|
||
// async createComment(postId, content) { | ||
// const result = await this.actor.createComment(postId, content); | ||
// return result; | ||
// } | ||
|
||
// async createRepost(postId) { | ||
// const result = await this.actor.createRepost(postId); | ||
// return result; | ||
// } | ||
|
||
// async createLike(postId) { | ||
// const result = await this.actor.createLike(postId); | ||
// return result; | ||
// } | ||
|
||
// async getFeedNumber() { | ||
// const result = await this.actor.getFeedNumber(); | ||
// return result; | ||
// } | ||
|
||
// async getFeed(postId) { | ||
// return await this.actor.getFeed(postId); | ||
// } | ||
|
||
// async getLatestFeed(n) { | ||
// return await this.actor.getLatestFeed(n); | ||
// } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { ActorSubclass, HttpAgent, Identity } from "@dfinity/agent"; | ||
import { _SERVICE } from "../declarations/user/user.did"; | ||
import { createActor } from "../declarations/user/index"; | ||
import { _getHttpAgent } from '../utils/common'; | ||
import { Principal } from "@dfinity/principal"; | ||
|
||
const userCanisterId = process.env.REACT_APP_USER_CANISTER_ID; | ||
|
||
export default class User { | ||
|
||
canisterId: Principal; | ||
|
||
identity: Identity; | ||
|
||
actor: ActorSubclass<_SERVICE>; | ||
|
||
constructor(identity: Identity) { | ||
this.canisterId = Principal.fromText(userCanisterId!); | ||
this.identity = identity; | ||
this.actor = createActor(userCanisterId!, { | ||
agent: _getHttpAgent(identity), | ||
}); | ||
} | ||
|
||
// async createProfile() { | ||
// const result = await this.actor.createProfile({ | ||
// name: "John", | ||
// biography : "I am a developer", | ||
// education : "MIT", | ||
// company : "Dfinity Foundation", | ||
// imgUrl : "https://images.unsplash.com/photo-1593642532842-98d0fd5ebc1a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80", | ||
// feedCanister : [] //, | ||
// }); | ||
// console.log("createProfile Result", result, "\n"); | ||
// } | ||
|
||
// async updateProfile() { | ||
// const result = await this.actor.updateProfile({ | ||
// name: "update: John", | ||
// biography : "update: I am a developer", | ||
// education : "update: MIT", | ||
// company : "update: Dfinity Foundation", | ||
// imgUrl : "https://images.unsplash.com/photo-1593642532842-98d0fd5ebc1a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80", | ||
// feedCanister : [] //, | ||
// }); | ||
// console.log("updateProfile Result", result, "\n"); | ||
// } | ||
|
||
// async getProfile() { | ||
// const result = await this.actor.getProfile(this.identity.getPrincipal()); | ||
// console.log("getProfile result : ", result, "\n"); | ||
// } | ||
|
||
// async follow(user) { | ||
// const result = await this.actor.follow(user); | ||
// return result; | ||
// } | ||
|
||
// async getFollowersList(user) { | ||
// const result = await this.actor.getFollowersList(user); | ||
// return result; | ||
// } | ||
|
||
// async init(_rootFeedCanister) { | ||
// const result = await this.actor.init(_rootFeedCanister); | ||
// return result; | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Flex, Space, Avatar, Typography, Divider } from 'antd'; | ||
|
||
export default function Comment() { | ||
return ( | ||
<Flex | ||
vertical | ||
style={{ | ||
paddingLeft: '10px', | ||
}} | ||
> | ||
<Divider /> | ||
<Space> | ||
<Avatar | ||
size={32} | ||
src="https://avatars.githubusercontent.com/u/120618331?s=200&v=4" | ||
style={{ | ||
border: '1px solid #D3D540', | ||
}} | ||
/> | ||
<p>NeutronStarDAO</p> | ||
</Space> | ||
<Typography.Paragraph> | ||
This is Comment;This is Comment;This is Comment; | ||
This is Comment;This is Comment;This is Comment; | ||
This is Comment;This is Comment;This is Comment; | ||
This is Comment;This is Comment;This is Comment; | ||
</Typography.Paragraph> | ||
</Flex> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
import { Button, Result } from 'antd'; | ||
|
||
|
||
function backHome() { | ||
|
||
} | ||
|
||
const ErrorPage: React.FC = () => ( | ||
<Result | ||
status="404" | ||
title="404" | ||
subTitle="Sorry, the page you visited does not exist." | ||
extra={<Button type="primary" onClick={backHome} >Back Home</Button>} | ||
style={{ | ||
height: '100vh', | ||
}} | ||
/> | ||
); | ||
|
||
export default ErrorPage; |
Oops, something went wrong.