@@ -11,14 +11,15 @@ interface ISelect { setValue: React.Dispatch> list: IModelVersions[] [x: string]: any - setDefaultParams: () => void + setDefaultParams: (newVersion?: string) => void } export const ChatSelect: React.FC = ({ value, setValue, list, setDefaultParams, ...args }) => { const onChange = (event: SelectChangeEvent) => { - setValue(event.target.value as string) - setDefaultParams() + const newVersion = event.target.value as string + setValue(newVersion) + setDefaultParams(newVersion) } return ( @@ -75,13 +75,14 @@ export function useImageBot(slug: string) { } } - // это пиз**ц - const setDefaultParams = () => { + const setDefaultParams = (newVersion?: string) => { if (!botParams) return + const targetVersion = newVersion !== undefined ? newVersion : version + dispatch(setParams({})) - if (version === '') { + if (targetVersion === '') { return dispatch( setParams(botParams.parameters.reduce((a, v) => ({ ...a, [v.key]: v.values.default }), {})) ) @@ -91,7 +92,7 @@ export function useImageBot(slug: string) { setParams( botParams.parameters.reduce( (a, v) => - isParamForVersion(v, version) ? { ...a, [v.key]: v.values.default } : { ...a }, + isParamForVersion(v, targetVersion) ? { ...a, [v.key]: v.values.default } : { ...a }, {} ) ) @@ -28,18 +28,21 @@ .header { display: flex; align-items: center; - justify-content: space-between; width: 100%; gap: 22px; margin: 14px 0; + flex-direction: column; > *:first-child { min-width: 200px; } @media screen and (max-width: 768px) { + align-items: flex-start; width: 100%; - gap: 12px; + max-width: 100%; + gap: 4px; + overflow-x: hidden; } } @keyframes fadein { @@ -63,6 +66,16 @@ gap: 8px; align-items: center; justify-content: flex-end; + + @media screen and (max-width: 768px) { + overflow-x: auto; + overflow-y: hidden; + width: 100%; + min-width: 0; + max-width: 100%; + align-self: stretch; + -webkit-overflow-scrolling: touch; + } } .tag { @@ -77,8 +90,17 @@ transition: width 0.3s ease-in-out; @media screen and (max-width: 768px) { + width: 150px; height: 40px; - width: 40px; + padding: 12px; + transition: none; + flex-shrink: 0; + + .tag__text { + opacity: 1; + position: static; + display: block; + } } &__icon { @@ -91,17 +113,27 @@ @media screen and (max-width: 768px) { width: 150px; - } - .tag__icon { - animation: fadein 0.6s ease-in-out; + .tag__icon { + animation: none; + } + + .tag__text { + animation: none; + } } - .tag__text { - opacity: 1; - position: static; - animation: fadein 0.6s ease-in-out; - display: block; + @media screen and (min-width: 769px) { + .tag__icon { + animation: fadein 0.6s ease-in-out; + } + + .tag__text { + opacity: 1; + position: static; + animation: fadein 0.6s ease-in-out; + display: block; + } } } @@ -105,14 +105,16 @@ const Page: NextPageWithLayout = () => { } } - const setDefaultParams = () => { + const setDefaultParams = (newVersion?: string) => { if (botParams) { + const targetVersion = newVersion !== undefined ? newVersion : version + dispatch(setParametres({})) - if (version !== '') { + if (targetVersion !== '') { dispatch( setParametres( botParams.parameters.reduce( - (a, v) => (v.versions.includes(version) ? { ...a, [v.key]: v.values.default } : { ...a }), + (a, v) => (v.versions.includes(targetVersion) ? { ...a, [v.key]: v.values.default } : { ...a }), {} ) ) @@ -23,7 +23,10 @@ } @media screen and (max-width: 768px) { + align-items: flex-start; width: 100%; + gap: 4px; + flex-direction: column; } } @@ -39,8 +42,16 @@ transition: width 0.3s ease-in-out; @media screen and (max-width: 768px) { - width: 40px; + width: 150px; height: 40px; + padding: 12px; + transition: none; + + .tag__text { + opacity: 1; + position: static; + display: block; + } } &__icon { @@ -54,17 +65,27 @@ @media screen and (max-width: 768px) { width: 150px; - } - .tag__icon { - animation: fadein 0.6s ease-in-out; + .tag__icon { + animation: none; + } + + .tag__text { + animation: none; + } } - .tag__text { - opacity: 1; - position: static; - animation: fadein 0.6s ease-in-out; - display: block; + @media screen and (min-width: 769px) { + .tag__icon { + animation: fadein 0.6s ease-in-out; + } + + .tag__text { + opacity: 1; + position: static; + animation: fadein 0.6s ease-in-out; + display: block; + } } } @@ -84,7 +105,14 @@ display: flex; gap: 8px; align-items: center; - justify-content: flex-end; + justify-content: flex-start; + + @media screen and (max-width: 768px) { + overflow-x: auto; + overflow-y: hidden; + width: 100%; + -webkit-overflow-scrolling: touch; + } } .main { @@ -29,8 +29,12 @@ } @media screen and (max-width: 768px) { + align-items: flex-start; width: 100%; - gap: 12px; + max-width: 100%; + gap: 4px; + flex-direction: column; + overflow-x: hidden; } } @@ -50,7 +54,17 @@ display: flex; gap: 8px; align-items: center; - justify-content: flex-end; + justify-content: flex-start; + + @media screen and (max-width: 768px) { + overflow-x: auto; + overflow-y: hidden; + width: 100%; + min-width: 0; + max-width: 100%; + align-self: stretch; + -webkit-overflow-scrolling: touch; + } } .staticTabsWrapper { @@ -74,8 +88,17 @@ transition: width 0.3s ease-in-out; @media screen and (max-width: 768px) { + width: 150px; height: 40px; - width: 40px; + padding: 12px; + transition: none; + flex-shrink: 0; + + .tag__text { + opacity: 1; + position: static; + display: block; + } } &__icon { @@ -88,17 +111,27 @@ @media screen and (max-width: 768px) { width: 150px; - } - .tag__icon { - animation: fadein 0.6s ease-in-out; + .tag__icon { + animation: none; + } + + .tag__text { + animation: none; + } } - .tag__text { - opacity: 1; - position: static; - animation: fadein 0.6s ease-in-out; - display: block; + @media screen and (min-width: 769px) { + .tag__icon { + animation: fadein 0.6s ease-in-out; + } + + .tag__text { + opacity: 1; + position: static; + animation: fadein 0.6s ease-in-out; + display: block; + } } } @@ -39,8 +39,12 @@ } @media screen and (max-width: 768px) { + align-items: flex-start; width: 100%; - gap: 12px; + max-width: 100%; + gap: 4px; + flex-direction: column; + overflow-x: hidden; } } @@ -60,7 +64,17 @@ display: flex; gap: 8px; align-items: center; - justify-content: flex-end; + justify-content: flex-start; + + @media screen and (max-width: 768px) { + overflow-x: auto; + overflow-y: hidden; + width: 100%; + min-width: 0; + max-width: 100%; + align-self: stretch; + -webkit-overflow-scrolling: touch; + } } .tag { @@ -75,8 +89,17 @@ transition: width 0.3s ease-in-out; @media screen and (max-width: 768px) { + width: 150px; height: 40px; - width: 40px; + padding: 12px; + transition: none; + flex-shrink: 0; + + .tag__text { + opacity: 1; + position: static; + display: block; + } } &__icon { @@ -89,17 +112,27 @@ @media screen and (max-width: 768px) { width: 150px; - } - .tag__icon { - animation: fadein 0.6s ease-in-out; + .tag__icon { + animation: none; + } + + .tag__text { + animation: none; + } } - .tag__text { - opacity: 1; - position: static; - animation: fadein 0.6s ease-in-out; - display: block; + @media screen and (min-width: 769px) { + .tag__icon { + animation: fadein 0.6s ease-in-out; + } + + .tag__text { + opacity: 1; + position: static; + animation: fadein 0.6s ease-in-out; + display: block; + } } } @@ -123,8 +123,8 @@ const VideoModelPage: NextPageWithLayout = () => { }, [botParams?.inputs, version]) const predictPriceInfo = useMemo( - () => ({ ...(includeParams || {}), ...(version ? { version } : {}) }), - [includeParams, version] + () => ({ ...(filteredParams || {}), ...(version ? { version } : {}) }), + [filteredParams, version] ) const predictedPrice = usePredictPrice({