build-fix+const-fix+icon-fix+expo-fix

This commit is contained in:
Untone 2024-09-16 15:57:00 +03:00
parent 08cbfa1d57
commit d3cd027910
11 changed files with 25 additions and 29 deletions

View File

@ -140,7 +140,7 @@
"engines": { "engines": {
"node": ">= 20" "node": ">= 20"
}, },
"trustedDependencies": ["@biomejs/biome", "esbuild", "protobufjs"], "trustedDependencies": ["@biomejs/biome", "@swc/core", "esbuild", "protobufjs"],
"dependencies": { "dependencies": {
"form-data": "^4.0.0", "form-data": "^4.0.0",
"idb": "^8.0.0", "idb": "^8.0.0",

View File

@ -36,7 +36,7 @@
width: 200px; width: 200px;
height: 200px; height: 200px;
transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out;
background: var(--placeholder-color-semi) url('/icons/create-music.svg') no-repeat 50% 50%; background: var(--placeholder-color-semi) url('/icons/create-audio.svg') no-repeat 50% 50%;
.image { .image {
object-fit: cover; object-fit: cover;

View File

@ -6,17 +6,17 @@ import { LoadMoreItems, LoadMoreWrapper } from '~/components/_shared/LoadMoreWra
import { Loading } from '~/components/_shared/Loading' import { Loading } from '~/components/_shared/Loading'
import { ArticleCardSwiper } from '~/components/_shared/SolidSwiper/ArticleCardSwiper' import { ArticleCardSwiper } from '~/components/_shared/SolidSwiper/ArticleCardSwiper'
import { coreApiUrl } from '~/config' import { coreApiUrl } from '~/config'
import { useFeed } from '~/context/feed' import { EXPO_LAYOUTS, SHOUTS_PER_PAGE, useFeed } from '~/context/feed'
import { useLocalize } from '~/context/localize' import { useLocalize } from '~/context/localize'
import { useSession } from '~/context/session' import { useSession } from '~/context/session'
import { loadShouts } from '~/graphql/api/public' import { loadShouts } from '~/graphql/api/public'
import { graphqlClientCreate } from '~/graphql/client' import { graphqlClientCreate } from '~/graphql/client'
import getRandomTopShoutsQuery from '~/graphql/query/core/articles-load-random-top' import getRandomTopShoutsQuery from '~/graphql/query/core/articles-load-random-top'
import { LoadShoutsFilters, LoadShoutsOptions, Shout } from '~/graphql/schema/core.gen' import { LoadShoutsFilters, LoadShoutsOptions, Shout } from '~/graphql/schema/core.gen'
import { SHOUTS_PER_PAGE } from '~/routes/(main)'
import { LayoutType } from '~/types/common' import { LayoutType } from '~/types/common'
import { getUnixtime } from '~/utils/date' import { getUnixtime } from '~/utils/date'
import { ArticleCard } from '../../Feed/ArticleCard' import { ArticleCard } from '../../Feed/ArticleCard'
import styles from './Expo.module.scss' import styles from './Expo.module.scss'
type Props = { type Props = {
@ -38,9 +38,7 @@ export const Expo = (props: Props) => {
const [reactedTopMonthArticles, setReactedTopMonthArticles] = createSignal<Shout[]>([]) const [reactedTopMonthArticles, setReactedTopMonthArticles] = createSignal<Shout[]>([])
const [expoShouts, setExpoShouts] = createSignal<Shout[]>([]) const [expoShouts, setExpoShouts] = createSignal<Shout[]>([])
const { feedByLayout, expoFeed, setExpoFeed } = useFeed() const { feedByLayout, expoFeed, setExpoFeed } = useFeed()
const layouts = createMemo<LayoutType[]>(() => const layouts = createMemo<LayoutType[]>(() => (props.layout ? [props.layout] : EXPO_LAYOUTS))
props.layout ? [props.layout] : ['audio', 'video', 'image', 'literature']
)
const loadMoreFiltered = async () => { const loadMoreFiltered = async () => {
const limit = SHOUTS_PER_PAGE const limit = SHOUTS_PER_PAGE

View File

@ -1,10 +1,10 @@
import { For, Show, createEffect, createMemo, createSignal, on } from 'solid-js' import { For, Show, createEffect, createMemo, createSignal, on } from 'solid-js'
import { useAuthors } from '~/context/authors' import { useAuthors } from '~/context/authors'
import { SHOUTS_PER_PAGE } from '~/context/feed'
import { useLocalize } from '~/context/localize' import { useLocalize } from '~/context/localize'
import { useTopics } from '~/context/topics' import { useTopics } from '~/context/topics'
import { loadShouts } from '~/graphql/api/public' import { loadShouts } from '~/graphql/api/public'
import { Author, Shout, Topic } from '~/graphql/schema/core.gen' import { Author, Shout, Topic } from '~/graphql/schema/core.gen'
import { SHOUTS_PER_PAGE } from '~/routes/(main)'
import { capitalize } from '~/utils/capitalize' import { capitalize } from '~/utils/capitalize'
import { paginate } from '~/utils/paginate' import { paginate } from '~/utils/paginate'
import Banner from '../Discours/Banner' import Banner from '../Discours/Banner'

View File

@ -1,12 +1,11 @@
import { useSearchParams } from '@solidjs/router' import { useSearchParams } from '@solidjs/router'
import { clsx } from 'clsx' import { clsx } from 'clsx'
import { For, Match, Show, Suspense, Switch, createEffect, createMemo, createSignal, on } from 'solid-js' import { For, Match, Show, Suspense, Switch, createEffect, createMemo, createSignal, on } from 'solid-js'
import { useFeed } from '~/context/feed' import { SHOUTS_PER_PAGE, useFeed } from '~/context/feed'
import { useLocalize } from '~/context/localize' import { useLocalize } from '~/context/localize'
import { useTopics } from '~/context/topics' import { useTopics } from '~/context/topics'
import { loadAuthors, loadFollowersByTopic, loadShouts } from '~/graphql/api/public' import { loadAuthors, loadFollowersByTopic, loadShouts } from '~/graphql/api/public'
import { Author, AuthorsBy, LoadShoutsOptions, Shout, Topic } from '~/graphql/schema/core.gen' import { Author, AuthorsBy, LoadShoutsOptions, Shout, Topic } from '~/graphql/schema/core.gen'
import { SHOUTS_PER_PAGE } from '~/routes/(main)'
import { getUnixtime } from '~/utils/date' import { getUnixtime } from '~/utils/date'
import { restoreScrollPosition, saveScrollPosition } from '~/utils/scroll' import { restoreScrollPosition, saveScrollPosition } from '~/utils/scroll'
import { byPublished, byStat } from '~/utils/sort' import { byPublished, byStat } from '~/utils/sort'

View File

@ -11,12 +11,14 @@ import {
Shout, Shout,
Topic Topic
} from '~/graphql/schema/core.gen' } from '~/graphql/schema/core.gen'
import { LayoutType } from '~/types/common'
import { graphqlClientCreate } from '../graphql/client' import { graphqlClientCreate } from '../graphql/client'
import { byStat } from '../utils/sort' import { byStat } from '../utils/sort'
import { useSession } from './session' import { useSession } from './session'
export const PRERENDERED_ARTICLES_COUNT = 5 export const PRERENDERED_ARTICLES_COUNT = 5
export const SHOUTS_PER_PAGE = 20 export const SHOUTS_PER_PAGE = 20
export const EXPO_LAYOUTS = ['audio', 'literature', 'video', 'image'] as LayoutType[]
type FeedContextType = { type FeedContextType = {
sortedFeed: Accessor<Shout[]> sortedFeed: Accessor<Shout[]>

View File

@ -1,16 +1,13 @@
import { type RouteDefinition, type RouteSectionProps, createAsync } from '@solidjs/router' import { type RouteDefinition, type RouteSectionProps, createAsync } from '@solidjs/router'
import { LoadMoreItems, LoadMoreWrapper } from '~/components/_shared/LoadMoreWrapper' import { LoadMoreItems, LoadMoreWrapper } from '~/components/_shared/LoadMoreWrapper'
import { useFeed } from '~/context/feed' import { SHOUTS_PER_PAGE, useFeed } from '~/context/feed'
import { loadShouts, loadTopics } from '~/graphql/api/public' import { loadShouts, loadTopics } from '~/graphql/api/public'
import { LoadShoutsOptions, Shout } from '~/graphql/schema/core.gen' import { LoadShoutsOptions, Shout } from '~/graphql/schema/core.gen'
import { HomeView, HomeViewProps } from '../components/Views/Home' import { HomeView, HomeViewProps } from '../components/Views/Home'
import { PageLayout } from '../components/_shared/PageLayout' import { PageLayout } from '../components/_shared/PageLayout'
import { useLocalize } from '../context/localize' import { useLocalize } from '../context/localize'
export const SHOUTS_PER_PAGE = 20
const featuredLoader = (offset?: number) => { const featuredLoader = (offset?: number) => {
const SHOUTS_PER_PAGE = 20
return loadShouts({ return loadShouts({
filters: { featured: true }, filters: { featured: true },
limit: SHOUTS_PER_PAGE, limit: SHOUTS_PER_PAGE,

View File

@ -1,13 +1,13 @@
import { Params, RouteSectionProps, createAsync } from '@solidjs/router' import { Params, RouteSectionProps, createAsync } from '@solidjs/router'
import { createEffect, createMemo, on } from 'solid-js' import { Show, createEffect, createMemo, on } from 'solid-js'
import { TopicsNav } from '~/components/TopicsNav' import { TopicsNav } from '~/components/TopicsNav'
import { Expo } from '~/components/Views/Expo' import { Expo } from '~/components/Views/Expo'
import { PageLayout } from '~/components/_shared/PageLayout' import { PageLayout } from '~/components/_shared/PageLayout'
import { EXPO_LAYOUTS, SHOUTS_PER_PAGE } from '~/context/feed'
import { useLocalize } from '~/context/localize' import { useLocalize } from '~/context/localize'
import { loadShouts } from '~/graphql/api/public' import { loadShouts } from '~/graphql/api/public'
import { LoadShoutsOptions, Shout } from '~/graphql/schema/core.gen' import { LoadShoutsOptions, Shout } from '~/graphql/schema/core.gen'
import { LayoutType } from '~/types/common' import { LayoutType } from '~/types/common'
import { SHOUTS_PER_PAGE } from '../(main)'
const fetchExpoShouts = async (layouts: string[]) => { const fetchExpoShouts = async (layouts: string[]) => {
const result = await loadShouts({ const result = await loadShouts({
@ -20,7 +20,7 @@ const fetchExpoShouts = async (layouts: string[]) => {
export const route = { export const route = {
load: async ({ params }: { params: Params }) => { load: async ({ params }: { params: Params }) => {
const layouts = params.layout ? [params.layout] : ['audio', 'literature', 'article', 'video', 'image'] const layouts = params.layout ? [params.layout] : EXPO_LAYOUTS
const shoutsLoader = await fetchExpoShouts(layouts) const shoutsLoader = await fetchExpoShouts(layouts)
return (await shoutsLoader()) as Shout[] return (await shoutsLoader()) as Shout[]
} }
@ -30,10 +30,7 @@ export default (props: RouteSectionProps<Shout[]>) => {
const { t } = useLocalize() const { t } = useLocalize()
const shouts = createAsync( const shouts = createAsync(
async () => async () =>
props.data || props.data || (await fetchExpoShouts(props.params.layout ? [props.params.layout] : EXPO_LAYOUTS))
(await fetchExpoShouts(
props.params.layout ? [props.params.layout] : ['audio', 'literature', 'article', 'video', 'image']
))
) )
const layout = createMemo(() => props.params.layout) const layout = createMemo(() => props.params.layout)
const title = createMemo(() => { const title = createMemo(() => {
@ -61,7 +58,9 @@ export default (props: RouteSectionProps<Shout[]>) => {
return ( return (
<PageLayout withPadding={true} zeroBottomPadding={true} title={`${t('Discours')} :: ${title()}`}> <PageLayout withPadding={true} zeroBottomPadding={true} title={`${t('Discours')} :: ${title()}`}>
<TopicsNav /> <TopicsNav />
<Expo shouts={shouts() || []} layout={layout() as LayoutType} /> <Show when={shouts()} keyed>
{(sss) => <Expo shouts={sss} layout={layout() as LayoutType} />}
</Show>
</PageLayout> </PageLayout>
) )
} }

View File

@ -5,14 +5,13 @@ import { Feed } from '~/components/Views/Feed'
import { FeedProps } from '~/components/Views/Feed/Feed' import { FeedProps } from '~/components/Views/Feed/Feed'
import { LoadMoreItems, LoadMoreWrapper } from '~/components/_shared/LoadMoreWrapper' import { LoadMoreItems, LoadMoreWrapper } from '~/components/_shared/LoadMoreWrapper'
import { PageLayout } from '~/components/_shared/PageLayout' import { PageLayout } from '~/components/_shared/PageLayout'
import { useFeed } from '~/context/feed' import { SHOUTS_PER_PAGE, useFeed } from '~/context/feed'
import { useLocalize } from '~/context/localize' import { useLocalize } from '~/context/localize'
import { ReactionsProvider } from '~/context/reactions' import { ReactionsProvider } from '~/context/reactions'
import { useTopics } from '~/context/topics' import { useTopics } from '~/context/topics'
import { loadShouts } from '~/graphql/api/public' import { loadShouts } from '~/graphql/api/public'
import { LoadShoutsOptions, Shout, Topic } from '~/graphql/schema/core.gen' import { LoadShoutsOptions, Shout, Topic } from '~/graphql/schema/core.gen'
import { FromPeriod, getFromDate } from '~/lib/fromPeriod' import { FromPeriod, getFromDate } from '~/lib/fromPeriod'
import { SHOUTS_PER_PAGE } from '../(main)'
export type PeriodItem = { export type PeriodItem = {
value: FromPeriod value: FromPeriod

View File

@ -5,13 +5,13 @@ import { FourOuFourView } from '~/components/Views/FourOuFour'
import { TopicFeedSortBy, TopicView } from '~/components/Views/Topic' import { TopicFeedSortBy, TopicView } from '~/components/Views/Topic'
import { Loading } from '~/components/_shared/Loading' import { Loading } from '~/components/_shared/Loading'
import { PageLayout } from '~/components/_shared/PageLayout' import { PageLayout } from '~/components/_shared/PageLayout'
import { SHOUTS_PER_PAGE } from '~/context/feed'
import { useLocalize } from '~/context/localize' import { useLocalize } from '~/context/localize'
import { useTopics } from '~/context/topics' import { useTopics } from '~/context/topics'
import { loadShouts, loadTopics } from '~/graphql/api/public' import { loadShouts, loadTopics } from '~/graphql/api/public'
import { Author, LoadShoutsOptions, Shout, Topic } from '~/graphql/schema/core.gen' import { Author, LoadShoutsOptions, Shout, Topic } from '~/graphql/schema/core.gen'
import { getImageUrl } from '~/lib/getThumbUrl' import { getImageUrl } from '~/lib/getThumbUrl'
import { descFromBody } from '~/utils/meta' import { descFromBody } from '~/utils/meta'
import { SHOUTS_PER_PAGE } from '../../(main)'
const fetchTopicShouts = async (slug: string, offset?: number) => { const fetchTopicShouts = async (slug: string, offset?: number) => {
const opts: LoadShoutsOptions = { filters: { topic: slug }, limit: SHOUTS_PER_PAGE, offset } const opts: LoadShoutsOptions = { filters: { topic: slug }, limit: SHOUTS_PER_PAGE, offset }

View File

@ -1,6 +1,5 @@
// biome-ignore lint/correctness/noNodejsModules: <explanation> // biome-ignore lint/correctness/noNodejsModules: <explanation>
import path from 'node:path' import path from 'node:path'
import sass from "sass";
import { CSSOptions } from 'vite' import { CSSOptions } from 'vite'
import mkcert from 'vite-plugin-mkcert' import mkcert from 'vite-plugin-mkcert'
import { PolyfillOptions, nodePolyfills } from 'vite-plugin-node-polyfills' import { PolyfillOptions, nodePolyfills } from 'vite-plugin-node-polyfills'
@ -25,7 +24,11 @@ const polyfillOptions = {
export default { export default {
resolve: { resolve: {
alias: { alias: {
'~': path.resolve('./src') '~': path.resolve('./src'),
'@': path.resolve('./public'),
'/icons': path.resolve('./public/icons'),
'/fonts': path.resolve('./public/fonts'),
'bootstrap': path.resolve('./node_modules/bootstrap')
} }
}, },
envPrefix: 'PUBLIC_', envPrefix: 'PUBLIC_',
@ -34,9 +37,8 @@ export default {
preprocessorOptions: { preprocessorOptions: {
scss: { scss: {
sourceMaps: false, sourceMaps: false,
implementation: sass,
additionalData: '@import "~/styles/imports";\n', additionalData: '@import "~/styles/imports";\n',
includePaths: ['./public', './src/styles'], includePaths: ['./public', './src/styles', './node_modules']
} }
} as CSSOptions['preprocessorOptions'] } as CSSOptions['preprocessorOptions']
}, },