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

V0.0.5 rewrite #16

Merged
merged 27 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
12763cd
🔪🔪🔪
cesardeazevedo Jul 12, 2024
ba34db3
New place for content code
cesardeazevedo Jul 12, 2024
70516f2
New core code around observables
cesardeazevedo Jul 12, 2024
cfc0c4f
Core code unit tests
cesardeazevedo Jul 12, 2024
0e62044
New indexeddb layer
cesardeazevedo Jul 12, 2024
57e1468
New nostr subscriptions code
cesardeazevedo Jul 12, 2024
d26aa7d
United tests for nostr folder
cesardeazevedo Jul 12, 2024
706c75a
New store code
cesardeazevedo Jul 12, 2024
bcbc347
New deck modules
cesardeazevedo Jul 12, 2024
88d64a7
New store models
cesardeazevedo Jul 12, 2024
76233a6
Some store unit tests
cesardeazevedo Jul 12, 2024
dd5d30a
New deck components modules
cesardeazevedo Jul 12, 2024
61921d7
Components refactor
cesardeazevedo Jul 12, 2024
25816df
Refactor on signin components
cesardeazevedo Jul 12, 2024
4144bd8
Update some tests config files
cesardeazevedo Jul 12, 2024
aa2fc80
New stats footer component
cesardeazevedo Jul 12, 2024
12621c3
Update dot files and dependencies
cesardeazevedo Jul 12, 2024
3b8394d
Commit broken storybooks
cesardeazevedo Jul 12, 2024
cc15cec
Don't complete pagination subject on stop
cesardeazevedo Jul 12, 2024
227fee5
Merge branch 'dev' into v0.0.5-rewrite
cesardeazevedo Jul 12, 2024
6aba01d
Update nostr-tools
cesardeazevedo Jul 12, 2024
a54398c
Remove notificationpopover for now
cesardeazevedo Jul 12, 2024
1ef25e4
Fix typo
cesardeazevedo Jul 12, 2024
54dc2d1
Change deploy job condition
cesardeazevedo Jul 12, 2024
8ac654b
remove deploy condition
cesardeazevedo Jul 12, 2024
96a8803
Bump ci versions
cesardeazevedo Jul 12, 2024
77f5cf8
fix linter
cesardeazevedo Jul 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
VITE_DB_NAME=NosotrosDB
VITE_BUGSNAG_API_KEY=4dc625765598a98e69c5215ce6e75062
VITE_FIXED_RELAYS='["wss://purplepag.es"]'
VITE_DEFAULT_RELAYS='[
"wss://nostr.wine",
"wss://nos.lol",
Expand All @@ -9,6 +8,10 @@ VITE_DEFAULT_RELAYS='[
"wss://nostr.ch3n2k.com",
"wss://nostr-pub.wellorder.net"
]'
VITE_OUTBOX_RELAYS='[
"wss://relay.damus.io",
"wss://purplepag.es"
]'
VITE_IMGPROXY_URL='https://imgproxy.nosotros.app'
VITE_RECOMMENDED_PUBKEYS='[
"c6603b0f1ccfec625d9c08b753e4f774eaf7d1cf2769223125b5fd4da728019e",
Expand Down
39 changes: 32 additions & 7 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { join } = require('path')

module.exports = {
env: {
browser: true,
Expand All @@ -11,12 +13,19 @@ module.exports = {
'plugin:prettier/recommended',
'plugin:storybook/recommended',
],
settings: {
react: {
version: 'detect',
},
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
project: join(__dirname, './tsconfig.json'),
sourceType: 'module',
},
plugins: [
'rxjs',
'react',
'react-refresh',
'jest',
Expand All @@ -27,14 +36,35 @@ module.exports = {
'no-only-tests',
],
rules: {
'rxjs/finnish': 0,
'rxjs/ban-operators': 'error',
'rxjs/no-create': 'error',
'rxjs/no-async-subscribe': 'error',
'rxjs/no-ignored-notifier': 'error',
//"rxjs/no-ignored-replay-buffer": "error",
'rxjs/no-ignored-takewhile-value': 'error',
'rxjs/no-ignored-subscription': 0,
'rxjs/no-implicit-any-catch': 'error',
'rxjs/no-index': 'error',
'rxjs/no-internal': 'error',
'rxjs/no-nested-subscribe': 'error',
'rxjs/no-redundant-notify': 'error',
// "rxjs/no-sharereplay": ["error", { allowConfig: true }],
'rxjs/no-subject-unsubscribe': 'error',
'rxjs/no-unbound-methods': 'error',
//"rxjs/no-unsafe-subject-next": "error",
// "rxjs/no-unsafe-takeuntil": "error",
// "rxjs/throw-error": "error",
'react/react-in-jsx-scope': 0,
'@typescript-eslint/consistent-type-imports': 'error',
'arrow-parens': 'error',
semi: [2, 'never'],
'prettier/prettier': [
'error',
'off',
{
printWidth: 120,
semi: false,
endOfLine: 'auto',
trailingComma: 'all',
singleQuote: true,
jsxSingleQuote: true,
Expand All @@ -44,11 +74,6 @@ module.exports = {
],
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-unused-vars': [
'error',
{
ignoreRestSiblings: true,
},
],
'@typescript-eslint/no-unused-vars': 'warn',
},
}
16 changes: 8 additions & 8 deletions .github/workflows/ci-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:

strategy:
matrix:
node-version: [18]
node-version: [20]

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
Expand Down Expand Up @@ -51,15 +51,15 @@ jobs:

strategy:
matrix:
node-version: [18]
node-version: [20]

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
Expand Down
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"printWidth": 120,
"tabWidth": 2,
"semi": false,
"endOfLine": "auto",
"trailingComma": "all",
"singleQuote": true,
"jsxSingleQuote": true,
"bracketSpacing": true,
"bracketSameLine": true
}
}
38 changes: 15 additions & 23 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ import { CssBaseline, Experimental_CssVarsProvider as CssVarsProvider, useColorS
import { addons } from '@storybook/addons'
import type { PartialStoryFn } from '@storybook/csf'
import type { Preview, ReactRenderer } from '@storybook/react'
import { RootRoute, Route, Router, RouterProvider } from '@tanstack/react-router'
import { createRootRouteWithContext, createRoute, createRouter, RouterProvider } from '@tanstack/react-router'
import React, { useEffect, useState } from 'react'
import { dbBatcher } from '../src/stores/db/observabledb.store'
import { RootStore, StoreProvider } from '../src/stores/index'
import { storage } from '../src/nostr/storage'

import { database } from '../src/stores/db/database.store'
import theme from '../src/themes/theme'

const channel = addons.getChannel()

const App = (props: { Story: PartialStoryFn<ReactRenderer>; store: RootStore }) => {
const App = (props: { Story: PartialStoryFn<ReactRenderer> }) => {
const { setMode } = useColorScheme()
const { Story, store } = props
const { Story } = props
const [ready, setReady] = useState(false)

useEffect(() => {
Expand All @@ -23,32 +21,26 @@ const App = (props: { Story: PartialStoryFn<ReactRenderer>; store: RootStore })
}, [channel, setMode])

useEffect(() => {
dbBatcher._subject.complete()
database.initialize()
database.clear().then(() => setReady(true))
storage.clearDB().then(() => setReady(true))
}, [])

return ready && <Story globals={{ store }} />
return ready && <Story />
}

const preview: Preview = {
decorators: [
(Story, context) => {
const store = new RootStore()
const rootRoute = new RootRoute({
component: () => <App Story={Story} store={store} />,
(Story) => {
const rootRoute = createRootRouteWithContext()({
component: () => <App Story={Story} />,
})
const index = new Route({ getParentRoute: () => rootRoute, path: '/' })
const index = createRoute({ getParentRoute: () => rootRoute, path: '/' })
const routeTree = rootRoute.addChildren([index])
const router = new Router({ routeTree })
context.parameters.setup?.(store)
const router = createRouter({ routeTree })
return (
<StoreProvider value={store}>
<CssVarsProvider theme={theme}>
<CssBaseline />
<RouterProvider router={router} />
</CssVarsProvider>
</StoreProvider>
<CssVarsProvider theme={theme}>
<CssBaseline />
<RouterProvider router={router} />
</CssVarsProvider>
)
},
],
Expand Down
13 changes: 0 additions & 13 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
export default {
setupFilesAfterEnv: ['fake-indexeddb/auto', '<rootDir>/jest.setup.ts'],
testMatch: ['<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}', '<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}'],
testEnvironment: 'jsdom',
moduleDirectories: ['node_modules', 'src'],
modulePathIgnorePatterns: ['<rootDir>/src/e2e'],
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
diagnostics: false,
},
],
},
verbose: true,
}
9 changes: 7 additions & 2 deletions jest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { storage } from 'nostr/storage'
import { vi } from 'vitest'

vi.mock('core/Relay')
vi.mock('constants/relays')
vi.mock('mobx-persist-store')

vi.mock('nostr-tools', async () => {
const originalModule = await vi.importActual<Record<string, unknown>>('nostr-tools')
return {
...originalModule,
validateEvent: vi.fn(() => true),
verifySignature: vi.fn(() => true),
verifyEvent: vi.fn(() => true),
}
})

// Reset Indexeddb
beforeEach(() => storage.clearDB())
Loading
Loading