some-fixes

This commit is contained in:
tonyrewin 2022-10-05 11:55:26 +03:00
parent d4a68c30b2
commit 8f6bea06bd
7 changed files with 49 additions and 47 deletions

View File

@ -157,7 +157,7 @@ export type Mutation = {
markAsRead: Result
rateUser: Result
refreshSession: AuthResult
registerUser: User
registerUser: AuthResult
removeAuthor: Result
sendLink: Result
unfollow: Result

View File

@ -1,32 +1,39 @@
// import { persistentAtom } from '@nanostores/persistent'
// import { Reaction, ReactionKind } from '../graphql/types.gen'
// import { atom, computed } from 'nanostores'
// import { reactionsOrdered } from './zine/reactions'
//
// interface Draft {
// createdAt: Date
// body?: string
// title?: string
// }
//
// interface Collab {
// authors: string[] // slugs
// invites?: string[]
// createdAt: Date
// body?: string
// title?: string
// }
//
// const drafts = persistentAtom<Draft[]>('drafts', [], {
// encode: JSON.stringify,
// decode: JSON.parse
// }) // save drafts on device
// const collabs = atom<Collab[]>([])
// // save collabs in backend or in p2p network
// const approvals = computed(reactionsOrdered, (rlist) => rlist.filter((r) => r.kind === ReactionKind.Accept))
// const proposals = computed<Reaction[], typeof reactionsOrdered>(reactionsOrdered, (rlist) =>
// rlist.filter((r) => r.kind === ReactionKind.Propose)
// )
//
// export { drafts, collabs, approvals, proposals }
export {}
import { persistentAtom } from '@nanostores/persistent'
import { Reaction, ReactionKind } from '../graphql/types.gen'
import { atom, computed } from 'nanostores'
import { reactions } from './zine/reactions'
interface Draft {
createdAt: Date
body?: string
title?: string
}
interface Collab {
authors: string[] // slugs
invites?: string[]
createdAt: Date
body?: string
title?: string
}
const drafts = persistentAtom<Draft[]>('drafts', [], {
encode: JSON.stringify,
decode: JSON.parse
}) // save drafts on device
const collabs = atom<Collab[]>([]) // save collabs in backend or in p2p network
/*
const approvals = computed(
reactions,
(rdict) => Object.values(rdict)
.filter((r: Reaction) => r.kind === ReactionKind.Accept)
)
const proposals = computed<Reaction[], typeof reactions>(
reactions,
(rdict) => Object.values(rdict)
.filter((r: Reaction) => r.kind === ReactionKind.Propose)
)
*/
export { drafts, collabs /* approvals, proposals */ }

View File

@ -1,6 +1,4 @@
// import { atom } from 'nanostores'
// import type { Chat, Message } from '../graphql/types.gen'
//
// export const chats = atom<Chat[]>([])
// export const messages = atom<Message[]>([])
export {}
import { atom } from 'nanostores'
import type { ChatResult } from '../graphql/types.gen'
export const chats = atom<ChatResult[]>([])

View File

@ -7,7 +7,7 @@ import { reduceBy } from '../../utils/reduce'
// FIXME
let reactionsOrdered: WritableAtom<Reaction[]>
const reactions = atom<{ [slug: string]: Reaction[] }>({}) // by shout
export const reactions = atom<{ [slug: string]: Reaction[] }>({}) // by shout
export const useReactionsStore = (initial?: Reaction[]) => {
if (!reactionsOrdered) {

View File

@ -1,15 +1,15 @@
import type { Reaction, Shout, FollowingEntity, AuthResult } from '../graphql/types.gen'
import { getLogger } from './logger'
import { publicGraphQLClient } from '../graphql/publicGraphQLClient'
import { privateGraphQLClient } from '../graphql/privateGraphQLClient'
import articleBySlug from '../graphql/query/article-by-slug'
import articleReactions from '../graphql/query/article-reactions'
import articlesRecentAll from '../graphql/query/articles-recent-all'
import articlesRecentPublished from '../graphql/query/articles-recent-published'
import topicsAll from '../graphql/query/topics-all'
import { getLogger } from './logger'
import reactionsForShouts from '../graphql/query/reactions-for-shouts'
import mySession from '../graphql/mutation/my-session'
import { privateGraphQLClient } from '../graphql/privateGraphQLClient'
import authLogoutQuery from '../graphql/mutation/auth-logout'
import authLoginQuery from '../graphql/query/auth-login'
import authRegisterMutation from '../graphql/mutation/auth-register'

View File

@ -3,10 +3,7 @@ import prefix from 'loglevel-plugin-prefix'
import { isDev } from './config'
prefix.reg(loglevel)
prefix.apply(loglevel, {
template: '[%n]'
})
prefix.apply(loglevel, { template: '[%n]' })
loglevel.setLevel(isDev ? loglevel.levels.TRACE : loglevel.levels.ERROR)
export const getLogger = (name: string) => loglevel.getLogger(name)

View File

@ -56,7 +56,7 @@ const ru2en: { [key: string]: string } = {
ь: 'i',
Ы: 'Y',
ы: 'y',
ъ: "'",
ъ: 'j',
Э: 'E',
э: 'e',
Ю: 'Yu',