@@ -0,0 +1,5 @@ + \ No newline at end of file @@ -6,6 +6,7 @@ export interface IShortModel { description: string slug: string image: string + blocked: boolean actual_stat: { generation_time: string tokens_cost: string @@ -4,10 +4,18 @@ import { useMemo, useState } from 'react' export function useImageModelsPopup() { const { bots, fetchBots, setBots } = useImagesBots() - const [popupOpen, setPopupOpen] = useState(false) + const [popupOpen, setPopupOpen] = useState(false) + + const fileteredModels = useMemo( + () => + bots.sort((a, b) => + a.blocked && !b.blocked ? 1 : !a.blocked && b.blocked ? -1 : 0 + ), + [bots] + ) const averageTokenCost = useMemo(() => { - if (!bots.length) return 0 + if (!bots.length) return 0 const prices = bots.filter((item) => item.actual_stat).map((item) => item.actual_stat) @@ -21,7 +29,8 @@ export function useImageModelsPopup() { setBots, fetchBots, averageTokenCost, - popupOpen, - setPopupOpen + popupOpen, + fileteredModels, + setPopupOpen, } } @@ -1,11 +1,27 @@ .container { position: relative; - @media (max-width: 768px) { - position: static; - } + @media (max-width: 768px) { + position: static; + } } +.wrapper { + background: rgba($color: #000000, $alpha: 0.4); + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 104; + visibility: hidden; + opacity: 0; + transition: all 0.3s ease-in-out; + &_open { + visibility: visible; + opacity: 1; + } +} .select { padding: 0px 18px; background: rgba(#8280ff, 0.1); @@ -19,8 +35,8 @@ &__arrow { padding-top: 5px; @media (max-width: 768px) { - width: 15px; - height: 15px; + width: 15px; + height: 15px; } } @@ -45,16 +61,16 @@ visibility: hidden; opacity: 0; transition: all 0.3s ease-in-out; - border: 1px solid #40404e4b; - max-height: 70vh; - overflow-y: scroll; + border: 1px solid #40404e4b; + max-height: 70vh; + overflow-y: scroll; + top: calc(100% + 10px); - - @media (max-width: 768px) { - left: 0; - right: 0; - width: fit-content; - } + @media (max-width: 768px) { + left: 0; + right: 0; + width: fit-content; + } &_open { visibility: visible; @@ -13,7 +13,8 @@ interface ImageModelsPopupProps { } export const ImageModelsPopup = ({ model }: ImageModelsPopupProps) => { - const { bots, fetchBots, averageTokenCost, popupOpen, setPopupOpen } = useImageModelsPopup() + const { fileteredModels, fetchBots, averageTokenCost, popupOpen, setPopupOpen } = + useImageModelsPopup() const { push } = useRouter() @@ -36,10 +37,14 @@ export const ImageModelsPopup = ({ model }: ImageModelsPopupProps) => { height={20} /> +
{title}
{description}
@@ -68,7 +74,10 @@ export const ImagePopupModel = ({ {formatedTime}