types-fixed
Some checks failed
deploy / test (push) Failing after 1m43s
deploy / deploy (push) Has been skipped

This commit is contained in:
Untone 2023-12-24 16:08:04 +03:00
parent 11788bcf0d
commit bd1b0025e7
10 changed files with 19 additions and 23 deletions

View File

@ -1,6 +1,6 @@
// TODO: additional entities list column + article // TODO: additional entities list column + article
import type { Author, Shout, Topic, User } from '../../graphql/schema/core.gen' import type { Author, Shout, Topic } from '../../graphql/schema/core.gen'
import { clsx } from 'clsx' import { clsx } from 'clsx'
import { For, Show } from 'solid-js' import { For, Show } from 'solid-js'
@ -16,7 +16,7 @@ import styles from './Beside.module.scss'
type Props = { type Props = {
title?: string title?: string
values: (Shout | User | Topic | Author)[] values: (Shout | Topic | Author)[]
beside: Shout beside: Shout
wrapper: 'topic' | 'author' | 'article' | 'top-article' wrapper: 'topic' | 'author' | 'article' | 'top-article'
isTopicCompact?: boolean isTopicCompact?: boolean
@ -68,7 +68,7 @@ export const Beside = (props: Props) => {
})} })}
> >
<For each={[...props.values]}> <For each={[...props.values]}>
{(value: Partial<Shout | User | Topic>) => ( {(value: Partial<Shout | Author | Topic>) => (
<li classList={{ [styles.top]: props.wrapper.startsWith('top-') }}> <li classList={{ [styles.top]: props.wrapper.startsWith('top-') }}>
<Show when={props.wrapper === 'topic'}> <Show when={props.wrapper === 'topic'}>
<TopicCard <TopicCard

View File

@ -130,7 +130,7 @@ export const Sidebar = () => {
classList={{ [styles.unread]: checkAuthorIsSeen(author.slug) }} classList={{ [styles.unread]: checkAuthorIsSeen(author.slug) }}
> >
<div class={styles.sidebarItemName}> <div class={styles.sidebarItemName}>
<Userpic name={author.name} userpic={author.userpic} size="XS" class={styles.userpic} /> <Userpic name={author.name} userpic={author.pic} size="XS" class={styles.userpic} />
<div class={styles.sidebarItemNameLabel}>{author.name}</div> <div class={styles.sidebarItemNameLabel}>{author.name}</div>
</div> </div>
</a> </a>

View File

@ -1,4 +1,4 @@
import type { Chat } from '../../graphql/schema/core.gen' import type { Chat } from '../../graphql/schema/chat.gen'
import DialogCard from './DialogCard' import DialogCard from './DialogCard'

View File

@ -1,4 +1,4 @@
import type { ChatMember } from '../../graphql/schema/core.gen' import type { ChatMember } from '../../graphql/schema/chat.gen'
import { clsx } from 'clsx' import { clsx } from 'clsx'
import { For } from 'solid-js' import { For } from 'solid-js'
@ -29,7 +29,7 @@ const GroupDialogAvatar = (props: Props) => {
bordered={true} bordered={true}
size="small" size="small"
name={user.name} name={user.name}
url={user.userpic} url={user.pic}
/> />
)} )}
</For> </For>

View File

@ -15,7 +15,7 @@ type DialogProps = {
const InviteUser = (props: DialogProps) => { const InviteUser = (props: DialogProps) => {
return ( return (
<div class={styles.InviteUser} onClick={props.onClick}> <div class={styles.InviteUser} onClick={props.onClick}>
<DialogAvatar name={props.author.name} url={props.author.userpic} /> <DialogAvatar name={props.author.name} url={props.author.pic} />
<div class={styles.name}>{props.author.name}</div> <div class={styles.name}>{props.author.name}</div>
<div class={styles.action}>{props.selected ? <Icon name="cross" /> : <Icon name="plus" />}</div> <div class={styles.action}>{props.selected ? <Icon name="cross" /> : <Icon name="plus" />}</div>
</div> </div>

View File

@ -31,7 +31,7 @@ export const Message = (props: Props) => {
<div class={clsx(styles.Message, isOwn && styles.own)}> <div class={clsx(styles.Message, isOwn && styles.own)}>
<Show when={!isOwn && user}> <Show when={!isOwn && user}>
<div class={styles.author}> <div class={styles.author}>
<DialogAvatar size="small" name={user.name} url={user.userpic} /> <DialogAvatar size="small" name={user.name} url={user.pic} />
<div class={styles.name}>{user.name}</div> <div class={styles.name}>{user.name}</div>
</div> </div>
</Show> </Show>

View File

@ -13,7 +13,7 @@ import { useArticlesStore, resetSortedArticles } from '../../../stores/zine/arti
import { useTopAuthorsStore } from '../../../stores/zine/topAuthors' import { useTopAuthorsStore } from '../../../stores/zine/topAuthors'
import { useTopicsStore } from '../../../stores/zine/topics' import { useTopicsStore } from '../../../stores/zine/topics'
import { getImageUrl } from '../../../utils/getImageUrl' import { getImageUrl } from '../../../utils/getImageUrl'
import { getServerDate } from '../../../utils/getServerDate' import { getUnixtime } from '../../../utils/getServerDate'
import { DropDown } from '../../_shared/DropDown' import { DropDown } from '../../_shared/DropDown'
import { Icon } from '../../_shared/Icon' import { Icon } from '../../_shared/Icon'
import { Loading } from '../../_shared/Loading' import { Loading } from '../../_shared/Loading'
@ -54,19 +54,21 @@ const getOrderBy = (by: FeedSearchParams['by']) => {
return '' return ''
} }
const getFromDate = (period: FeedPeriod): Date => { const getFromDate = (period: FeedPeriod): number => {
const now = new Date() const now = new Date()
let d: Date = now
switch (period) { switch (period) {
case 'week': { case 'week': {
return new Date(now.setDate(now.getDate() - 7)) d = new Date(now.setDate(now.getDate() - 7))
} }
case 'month': { case 'month': {
return new Date(now.setMonth(now.getMonth() - 1)) d = new Date(now.setMonth(now.getMonth() - 1))
} }
case 'year': { case 'year': {
return new Date(now.setFullYear(now.getFullYear() - 1)) d = new Date(now.setFullYear(now.getFullYear() - 1))
} }
} }
return Math.floor(d.getTime() / 1000)
} }
type Props = { type Props = {
@ -153,8 +155,7 @@ export const FeedView = (props: Props) => {
if (searchParams().by && searchParams().by !== 'publish_date') { if (searchParams().by && searchParams().by !== 'publish_date') {
const period = searchParams().period || 'month' const period = searchParams().period || 'month'
const fromDate = getFromDate(period) options.filters = { after: getFromDate(period) }
options.filters = { fromDate: getServerDate(fromDate) }
} }
return props.loadShouts(options) return props.loadShouts(options)

View File

@ -21,7 +21,6 @@ import {
MutationUpdate_MessageArgs, MutationUpdate_MessageArgs,
QueryLoad_ChatsArgs, QueryLoad_ChatsArgs,
QueryLoad_Messages_ByArgs, QueryLoad_Messages_ByArgs,
QueryLoad_RecipientsArgs,
} from '../schema/chat.gen' } from '../schema/chat.gen'
export const inboxClient = { export const inboxClient = {
@ -72,8 +71,4 @@ export const inboxClient = {
const resp = await inboxClient.private.query(chatMessagesLoadBy, options).toPromise() const resp = await inboxClient.private.query(chatMessagesLoadBy, options).toPromise()
return resp.data.load_messages_by.messages return resp.data.load_messages_by.messages
}, },
loadRecipients: async (options: QueryLoad_RecipientsArgs) => {
const resp = await inboxClient.private.query(loadRecipients, options).toPromise()
return resp.data.load_recipients.members
},
} }

View File

@ -1,4 +1,4 @@
import type { Author, Shout, Topic } from '../graphql/types.gen' import type { Author, Shout, Topic } from '../graphql/schema/core.gen'
export const groupByName = (arr: Author[]) => { export const groupByName = (arr: Author[]) => {
return arr.reduce( return arr.reduce(

View File

@ -1,4 +1,4 @@
import type { Author, Reaction, Shout, Stat, Topic, TopicStat } from '../graphql/types.gen' import type { Author, Reaction, Shout, Stat, Topic, TopicStat } from '../graphql/schema/core.gen'
export const byFirstChar = (a, b) => (a.name || a.title || '').localeCompare(b.name || b.title || '') export const byFirstChar = (a, b) => (a.name || a.title || '').localeCompare(b.name || b.title || '')