Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Ylide forum #1365

Merged
merged 33 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
cf92af3
Merge pull request #1 from ElKornacio/main
ElKornacio Oct 10, 2023
4aad302
Initial
ElKornacio Oct 10, 2023
2728d39
update envs
ElKornacio Oct 11, 2023
8c08f8b
Update dev.preset.sh
ElKornacio Oct 11, 2023
39388c8
Update dev.preset.sh
ElKornacio Oct 11, 2023
30291c0
Update .env.eth
ElKornacio Oct 11, 2023
e451db3
filters, sortings, chats
ElKornacio Oct 11, 2023
1d3327a
editorjs for new threads
ElKornacio Oct 12, 2023
da9b654
walletconnect + evm chains switching
ElKornacio Oct 12, 2023
0cf1875
small fixes before mobile
ElKornacio Oct 17, 2023
09c3d74
Mobile version + tags + txDiscuss/addressDiscuss + bookmarks
ElKornacio Oct 23, 2023
1046c2a
bookmarks/watches/addrdiscuss/txdiscuss/tags
ElKornacio Oct 24, 2023
ecac16d
realtime chats + watched/bookmarked topics/threads
ElKornacio Oct 25, 2023
e1206c4
fix for single child of popovertrigger
ElKornacio Oct 25, 2023
77b4335
bookmark/watch in Thread, replies reload, fix tags selection
ElKornacio Oct 25, 2023
b4f9692
scroll on reply
ElKornacio Oct 25, 2023
8581787
Chats v2
ElKornacio Oct 26, 2023
cea068b
chats switches chain + back-arrow in bookmarks/watches
ElKornacio Oct 26, 2023
2fbadf5
remove Create Thread from txs/addrs topics
ElKornacio Oct 26, 2023
1a9dc18
Chats list -> Chats everywhere
ElKornacio Oct 26, 2023
aa4f970
Errors in chats + no watches for accountpopover
ElKornacio Oct 27, 2023
d3dc6e3
only evm chats
ElKornacio Oct 27, 2023
c5a0b1b
telegram pushes on watches + pagination fixes
ElKornacio Nov 3, 2023
48c8f3e
remote three dots from replies
ElKornacio Nov 8, 2023
f956f39
fixes
ElKornacio Nov 9, 2023
d8384e2
Merged
ElKornacio Nov 21, 2023
add8d98
Merge branch 'main' into ylide-forum
ElKornacio Nov 21, 2023
084af19
Envs for forum & CI
ElKornacio Nov 21, 2023
a2ee7fa
Forum Env variables for CI
ElKornacio Nov 21, 2023
09f365f
Add forum env variables for validation
ElKornacio Nov 21, 2023
97f68a2
Fix metadata for forum routes
ElKornacio Nov 21, 2023
1adaac5
TS fix on getPageType.ts
ElKornacio Nov 21, 2023
eb64cdc
Fix default eth envs + fix fetch types for address verificaion
ElKornacio Nov 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
32 changes: 32 additions & 0 deletions configs/app/features/forum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type { Feature } from './types';

import stripTrailingSlash from 'lib/stripTrailingSlash';

import { getEnvValue } from '../utils';

const indexerUrl = stripTrailingSlash(getEnvValue('NEXT_PUBLIC_FORUM_INDEXER_URL') || '') || null;
const walletConnectProjectId = getEnvValue('NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID') || '';

const title = 'Forum';

const config: Feature<{ indexerUrl: string; walletConnectProjectId: string }> = (() => {
if (
getEnvValue('NEXT_PUBLIC_IS_FORUM_SUPPORTED') === 'true' &&
indexerUrl &&
walletConnectProjectId
) {
return Object.freeze({
title,
isEnabled: true,
walletConnectProjectId,
indexerUrl,
});
}

return Object.freeze({
title,
isEnabled: false,
});
})();

export default config;
1 change: 1 addition & 0 deletions configs/app/features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export { default as beaconChain } from './beaconChain';
export { default as bridgedTokens } from './bridgedTokens';
export { default as blockchainInteraction } from './blockchainInteraction';
export { default as csvExport } from './csvExport';
export { default as forum } from './forum';
export { default as googleAnalytics } from './googleAnalytics';
export { default as graphqlApiDocs } from './graphqlApiDocs';
export { default as marketplace } from './marketplace';
Expand Down
5 changes: 5 additions & 0 deletions configs/envs/.env.eth
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,8 @@ NEXT_PUBLIC_ADMIN_SERVICE_API_HOST=https://admin-rs.services.blockscout.com

#meta
NEXT_PUBLIC_OG_IMAGE_URL=https://github.com/blockscout/frontend-configs/blob/main/configs/og-images/eth.jpg?raw=true

# ylide
NEXT_PUBLIC_IS_FORUM_SUPPORTED=true
NEXT_PUBLIC_FORUM_INDEXER_URL=https://forum-blockscout.ylide.io
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=e9deead089b3383b2db777961e3fa244
14 changes: 14 additions & 0 deletions deploy/tools/envs-validator/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,19 @@ const sentrySchema = yup
}),
});

const ylideSchema = yup
.object()
.shape({
NEXT_PUBLIC_IS_FORUM_SUPPORTED: yup.boolean(),
NEXT_PUBLIC_FORUM_INDEXER_URL: yup
.string()
.when('NEXT_PUBLIC_IS_FORUM_SUPPORTED', {
is: (value: boolean) => value,
then: (schema) => schema.test(urlTest).required(),
otherwise: (schema) => schema.max(-1, 'NEXT_PUBLIC_FORUM_INDEXER_URL cannot not be used if NEXT_PUBLIC_IS_FORUM_SUPPORTED is not set to "true"'),
}),
});

const accountSchema = yup
.object()
.shape({
Expand Down Expand Up @@ -453,6 +466,7 @@ const schema = yup
NEXT_PUBLIC_USE_NEXT_JS_PROXY: yup.boolean(),
})
.concat(accountSchema)
.concat(ylideSchema)
.concat(adsBannerSchema)
.concat(marketplaceSchema)
.concat(rollupSchema)
Expand Down
5 changes: 4 additions & 1 deletion deploy/tools/envs-validator/test/.env.base
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ NEXT_PUBLIC_VIEWS_TX_ADDITIONAL_FIELDS=['fee_per_gas']
NEXT_PUBLIC_VIEWS_TX_HIDDEN_FIELDS=['value','fee_currency','gas_price','tx_fee','gas_fees','burnt_fees']
NEXT_PUBLIC_VISUALIZE_API_HOST=https://example.com
NEXT_PUBLIC_WEB3_DISABLE_ADD_TOKEN_TO_WALLET=false
NEXT_PUBLIC_WEB3_WALLETS=['coinbase','metamask','token_pocket']
NEXT_PUBLIC_WEB3_WALLETS=['coinbase','metamask','token_pocket']
NEXT_PUBLIC_IS_FORUM_SUPPORTED=true
NEXT_PUBLIC_FORUM_INDEXER_URL=https://forum-blockscout.ylide.io
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=e9deead089b3383b2db777961e3fa244
2 changes: 2 additions & 0 deletions deploy/values/l2-optimism-goerli/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ frontend:
NEXT_PUBLIC_L1_BASE_URL: https://eth-goerli.blockscout.com/
NEXT_PUBLIC_OPTIMISTIC_L2_WITHDRAWAL_URL: https://app.optimism.io/bridge/withdraw
NEXT_PUBLIC_GRAPHIQL_TRANSACTION: 0x4a0ed8ddf751a7cb5297f827699117b0f6d21a0b2907594d300dc9fed75c7e62
NEXT_PUBLIC_IS_FORUM_SUPPORTED: true
NEXT_PUBLIC_FORUM_INDEXER_URL: https://forum-blockscout.ylide.io
envFromSecret:
NEXT_PUBLIC_AUTH0_CLIENT_ID: ref+vault://deployment-values/blockscout/dev/front-main?token_env=VAULT_TOKEN&address=https://vault.k8s.blockscout.com#/NEXT_PUBLIC_AUTH0_CLIENT_ID
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID: ref+vault://deployment-values/blockscout/dev/front-main?token_env=VAULT_TOKEN&address=https://vault.k8s.blockscout.com#/NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID
Expand Down
3 changes: 3 additions & 0 deletions deploy/values/main/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ frontend:
NEXT_PUBLIC_GRAPHIQL_TRANSACTION: 0xf7d4972356e6ae44ae948d0cf19ef2beaf0e574c180997e969a2837da15e349d
NEXT_PUBLIC_WEB3_WALLETS: "['token_pocket','coinbase','metamask']"
NEXT_PUBLIC_VIEWS_NFT_MARKETPLACES: "[{'name':'LooksRare','collection_url':'https://goerli.looksrare.org/collections/{hash}','instance_url':'https://goerli.looksrare.org/collections/{hash}/{id}','logo_url':'https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/nft-marketplace-logos/looks-rare.png'}]"

NEXT_PUBLIC_IS_FORUM_SUPPORTED: true
NEXT_PUBLIC_FORUM_INDEXER_URL: https://forum-blockscout.ylide.io
envFromSecret:
NEXT_PUBLIC_SENTRY_DSN: ref+vault://deployment-values/blockscout/dev/front-main?token_env=VAULT_TOKEN&address=https://vault.k8s.blockscout.com#/NEXT_PUBLIC_SENTRY_DSN
SENTRY_CSP_REPORT_URI: ref+vault://deployment-values/blockscout/dev/front-main?token_env=VAULT_TOKEN&address=https://vault.k8s.blockscout.com#/SENTRY_CSP_REPORT_URI
Expand Down
2 changes: 2 additions & 0 deletions deploy/values/review-l2/values.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ frontend:
NEXT_PUBLIC_L1_BASE_URL: https://blockscout-main.k8s-dev.blockscout.com
NEXT_PUBLIC_GRAPHIQL_TRANSACTION: 0x4a0ed8ddf751a7cb5297f827699117b0f6d21a0b2907594d300dc9fed75c7e62
NEXT_PUBLIC_USE_NEXT_JS_PROXY: true
NEXT_PUBLIC_IS_FORUM_SUPPORTED: true
NEXT_PUBLIC_FORUM_INDEXER_URL: https://forum-blockscout.ylide.io
envFromSecret:
NEXT_PUBLIC_SENTRY_DSN: ref+vault://deployment-values/blockscout/dev/review-l2?token_env=VAULT_TOKEN&address=https://vault.k8s.blockscout.com#/NEXT_PUBLIC_SENTRY_DSN
SENTRY_CSP_REPORT_URI: ref+vault://deployment-values/blockscout/dev/review-l2?token_env=VAULT_TOKEN&address=https://vault.k8s.blockscout.com#/SENTRY_CSP_REPORT_URI
Expand Down
2 changes: 2 additions & 0 deletions deploy/values/review/values.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ frontend:
OTEL_SDK_ENABLED: true
OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger-collector.jaeger.svc.cluster.local:4318
NEXT_OTEL_VERBOSE: 1
NEXT_PUBLIC_IS_FORUM_SUPPORTED: true
NEXT_PUBLIC_FORUM_INDEXER_URL: https://forum-blockscout.ylide.io
envFromSecret:
NEXT_PUBLIC_SENTRY_DSN: ref+vault://deployment-values/blockscout/dev/review?token_env=VAULT_TOKEN&address=https://vault.k8s.blockscout.com#/NEXT_PUBLIC_SENTRY_DSN
SENTRY_CSP_REPORT_URI: ref+vault://deployment-values/blockscout/dev/review?token_env=VAULT_TOKEN&address=https://vault.k8s.blockscout.com#/SENTRY_CSP_REPORT_URI
Expand Down
13 changes: 13 additions & 0 deletions docs/ENVS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Please be aware that all environment variables prefixed with `NEXT_PUBLIC_` will
- [SUAVE chain](ENVS.md#suave-chain)
- [Sentry error monitoring](ENVS.md#sentry-error-monitoring)
- [OpenTelemetry](ENVS.md#opentelemetry)
- [Ylide Forum](ENVS.md#ylide)
- [3rd party services configuration](ENVS.md#external-services-configuration)

&nbsp;
Expand Down Expand Up @@ -547,6 +548,18 @@ OpenTelemetry SDK for Node.js app could be enabled by passing `OTEL_SDK_ENABLED=

&nbsp;

### Ylide Forum

Decenrtalized forum feature could be enabled by passing `NEXT_PUBLIC_IS_FORUM_SUPPORTED=true` variable. After deploying the forum indexer Docker image, you should pass the public url of backend API to the variable `NEXT_PUBLIC_FORUM_INDEXER_URL` (without trailing slash). If you want to support WalletConnect protocol for authorization, please, kindly sign up in the [Wallet Connect Cloud](https://cloud.walletconnect.com/sign-in) and provide the WalletConnect project ID to the `NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID` variable.

| Variable | Type| Description | Compulsoriness | Default value | Example value |
| --- | --- | --- | --- | --- | --- |
| NEXT_PUBLIC_IS_FORUM_SUPPORTED | `boolean` | Flag to enable the feature | Required | `false` | `true` |
| NEXT_PUBLIC_FORUM_INDEXER_URL | `string` | URL of the forum public indexer | Optional | `` | `https://forum-blockscout.ylide.io` |
| NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID | `string` | Flag to enable the feature | Optional | `` | `e9deead089b3383b2db777961e3fa244` |

&nbsp;

## External services configuration

### Google ReCaptcha
Expand Down
9 changes: 9 additions & 0 deletions icons/account.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/arrows/arrow-back.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/arrows/arrow-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/arrows/arrow-up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/arrows/caret-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/arrows/caret-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/attachment.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/bookmark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/bookmark_filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/chat.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions icons/chat_list.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions icons/eye.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/eye_filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/forum.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/horizontal_dots.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/logout.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions icons/proceedTOWalletArrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/reply.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/send.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions jest/lib.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import React from 'react';

import { AppContextProvider } from 'lib/contexts/app';
import { ScrollDirectionProvider } from 'lib/contexts/scrollDirection';
import { YlideProvider } from 'lib/contexts/ylide';
import { SocketProvider } from 'lib/socket/context';
import theme from 'theme';

import 'lib/setLocale';

const PAGE_PROPS = {
Expand All @@ -19,6 +19,8 @@ const PAGE_PROPS = {
hash: '',
number: '',
q: '',
topic: '',
thread: '',
};

const TestApp = ({ children }: {children: React.ReactNode}) => {
Expand All @@ -37,7 +39,9 @@ const TestApp = ({ children }: {children: React.ReactNode}) => {
<AppContextProvider pageProps={ PAGE_PROPS }>
<ScrollDirectionProvider>
<SocketProvider>
{ children }
<YlideProvider>
{ children }
</YlideProvider>
</SocketProvider>
</ScrollDirectionProvider>
</AppContextProvider>
Expand Down
20 changes: 20 additions & 0 deletions lib/ago.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export default function ago(timestamp: number, now = Date.now()) {
const seconds = Math.floor((now - timestamp) / 1000);
const minutes = Math.floor(seconds / 60);
const hours = Math.floor(minutes / 60);
const days = Math.floor(hours / 24);

if (seconds < 60) {
return `${ seconds } second${ seconds === 1 ? '' : 's' } ago`;
}

if (minutes < 60) {
return `${ minutes } minute${ minutes === 1 ? '' : 's' } ago`;
}

if (hours < 24) {
return `${ hours } hour${ hours === 1 ? '' : 's' } ago`;
}

return `${ days } day${ days === 1 ? '' : 's' } ago`;
}
Loading
Loading