@@ -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 }, {} ) ) @@ -39,7 +39,6 @@ display: flex; align-items: center; justify-content: center; - padding-left: 66px; /* резерв под predictPrice, чтобы не перекрывать */ } .divider { @@ -140,8 +140,8 @@ export const ModelInput: FC = ({ > {!desktop && ( - + {' '} {props.type} •{' '} @@ -31,14 +31,18 @@ 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 { @@ -62,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 { @@ -76,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 { @@ -88,15 +111,29 @@ padding: 12px; width: 200px; - .tag__icon { - animation: fadein 0.6s ease-in-out; + @media screen and (max-width: 768px) { + width: 150px; + + .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 }), {} ) ) @@ -13,6 +13,7 @@ .header { display: flex; align-items: center; + justify-content: space-between; width: 100%; gap: 22px; margin: 14px 0; @@ -22,8 +23,10 @@ } @media screen and (max-width: 768px) { + align-items: flex-start; width: 100%; - gap: 0; + 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 { @@ -51,15 +62,30 @@ padding: 12px; width: 200px; - .tag__icon { - animation: fadein 0.6s ease-in-out; + + @media screen and (max-width: 768px) { + width: 150px; + + .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; + } } } @@ -79,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 { @@ -19,6 +19,7 @@ .header { display: flex; align-items: center; + justify-content: space-between; width: 100%; gap: 22px; margin: 14px 0; @@ -28,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; } } @@ -49,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 { @@ -73,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 { @@ -85,15 +109,29 @@ padding: 12px; width: 200px; - .tag__icon { - animation: fadein 0.6s ease-in-out; + @media screen and (max-width: 768px) { + width: 150px; + + .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; + } } } @@ -233,6 +233,7 @@ const ImageModelPage: NextPageWithLayout = () => { images={messages} getMessagesPagination={fetchMessages} onPinImageFromUrl={pinImageFromUrl} + canAttachFile={showFileExample} /> { images={messages} getMessagesPagination={fetchMessages} onPinImageFromUrl={pinImageFromUrl} + canAttachFile={showFileExample} /> @@ -29,6 +29,7 @@ .header { display: flex; align-items: center; + justify-content: space-between; width: 100%; gap: 22px; margin: 14px 0; @@ -38,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; } } @@ -59,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 { @@ -74,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 { @@ -86,15 +110,29 @@ padding: 12px; width: 200px; - .tag__icon { - animation: fadein 0.6s ease-in-out; + @media screen and (max-width: 768px) { + width: 150px; + + .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({ @@ -44,6 +44,7 @@ overflow-y: auto; @media (max-width: 768px) { + width: 100%; max-width: 100%; margin-top: 0; padding-left: 8px; @@ -124,9 +125,6 @@ overflow: hidden; @media (max-width: 768px) { - width: 125px; - min-width: 125px; - max-width: 130px; height: 36px; min-height: 36px; padding: 0 12px; @@ -22,9 +22,10 @@ interface MessagesList { getMessagesPagination?: () => Promise isComplete: boolean onPinImageFromUrl?: (url: string) => void + canAttachFile?: boolean } -export const ImageMessagesList: React.FC = memo(({ device, images, getMessagesPagination, onPinImageFromUrl }) => { +export const ImageMessagesList: React.FC = memo(({ device, images, getMessagesPagination, onPinImageFromUrl, canAttachFile }) => { const { showMessage } = useShowDataStore() const [modal, setModal] = useState(false) @@ -211,16 +212,17 @@ export const ImageMessagesList: React.FC = memo(({ device, images, variant='rectangular' /> )} - onPinImageFromUrl(message.file!.toString()) - : undefined - } - /> + + onPinImageFromUrl(message.file!.toString()) + : undefined + } + />