Skip to content

Commit

Permalink
Merge pull request #137 from teodorus-nathaniel/zero-to-hero
Browse files Browse the repository at this point in the history
Improve Twitter Dapp Zero to Hero
  • Loading branch information
olehmell authored Dec 28, 2023
2 parents e47ddbf + a363d13 commit 5909943
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/develop/zero-to-hero/twitter-dapp/CreatingTweet.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Now, Let's rewrite the **onTweetBtnClick** method of **src/components/tweet-box.
IpfsContent
} from '@subsocial/api/substrate/wrappers'

...
// ...

const SPACE_ID = '1059'
const ACCOUNT_STORAGE_KEY = 'connected_account'
Expand Down
4 changes: 2 additions & 2 deletions docs/develop/zero-to-hero/twitter-dapp/FetchingTweets.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Now, lets put this logic inside a useEffect hook on the **home.tsx** file.

```tsx
const HomeScreen = () => {
...
// ...

const [tweets, setTweets] = useState<ITweet[]>([])

Expand Down Expand Up @@ -53,6 +53,6 @@ Now, lets put this logic inside a useEffect hook on the **home.tsx** file.
fetchTweets()
}, [isReady])

...
// ...
}
```
2 changes: 1 addition & 1 deletion docs/develop/zero-to-hero/twitter-dapp/LikeaTweet.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Let's add this functionality on the Dapp. Here's an example:
It's time to add this in the codebase inside of **tweet.tsx** like this:

```tsx
...
// ...

const ACCOUNT_STORAGE_KEY = 'connected_account'

Expand Down
12 changes: 10 additions & 2 deletions docs/develop/zero-to-hero/twitter-dapp/LoginScreen.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ For connecting the web app to the wallet, we need to do 2 things:
Update the **App.tsx** file above the return statement like this, and clear everything else:

```tsx
import { useState } from 'react'
import polkadotjs from './subsocial/wallets/polkadotjs'
import LoginScreen from './login'

const ACCOUNT_STORAGE_KEY = 'connected_account'

const App = () => {
Expand All @@ -88,8 +92,10 @@ const App = () => {
}
}

return ...
// ... continue with the rest of the code below
}

export default App
```

#### Rendering the UI conditionally
Expand All @@ -98,7 +104,7 @@ Now, we have to make sure that the login screen UI is rendered conditionally.

```tsx
const App = () => {
...
// ...

if(account) {
// User is already logged-in.
Expand All @@ -109,6 +115,8 @@ const App = () => {
onLoginClick={connectWallet}
/>
}

export default App
```

:::info Note
Expand Down
4 changes: 2 additions & 2 deletions docs/develop/zero-to-hero/twitter-dapp/Styling.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Follow these steps:
1. Run the following commands:

```ts
yarn add -D tailwindcss postcss autoprefixer
yarn add -D tailwindcss postcss postcss-cli autoprefixer
```

```ts
Expand Down Expand Up @@ -67,7 +67,7 @@ Follow these steps:
xl: "1rem",
},
},
...
// ... keep the other fields as it is
};
```

Expand Down

0 comments on commit 5909943

Please sign in to comment.