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": {
"node": ">= 20"
},
"trustedDependencies": ["@biomejs/biome", "esbuild", "protobufjs"],
"trustedDependencies": ["@biomejs/biome", "@swc/core", "esbuild", "protobufjs"],
"dependencies": {
"form-data": "^4.0.0",
"idb": "^8.0.0",

View File

@ -36,7 +36,7 @@
width: 200px;
height: 200px;
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 {
object-fit: cover;

View File

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

View File

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

View File

@ -1,12 +1,11 @@
import { useSearchParams } from '@solidjs/router'
import { clsx } from 'clsx'
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 { useTopics } from '~/context/topics'
import { loadAuthors, loadFollowersByTopic, loadShouts } from '~/graphql/api/public'
import { Author, AuthorsBy, LoadShoutsOptions, Shout, Topic } from '~/graphql/schema/core.gen'
import { SHOUTS_PER_PAGE } from '~/routes/(main)'
import { getUnixtime } from '~/utils/date'
import { restoreScrollPosition, saveScrollPosition } from '~/utils/scroll'
import { byPublished, byStat } from '~/utils/sort'

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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