diff --git a/packages/components/src/api/image_generation/EnqueueImageGen.ts b/packages/components/src/api/image_generation/EnqueueImageGen.ts index b3400df405..b3859b6741 100644 --- a/packages/components/src/api/image_generation/EnqueueImageGen.ts +++ b/packages/components/src/api/image_generation/EnqueueImageGen.ts @@ -2,7 +2,7 @@ import { ApiConfig } from "../ApiConfig"; export interface EnqueueImageGenRequest { uuid_idempotency_token: string; - maybe_sd_model_token: string | undefined; + maybe_sd_model_token: string | null; maybe_lora_model_token: string | null; maybe_prompt: string; maybe_n_prompt: string; diff --git a/packages/components/src/api/weights/Search.ts b/packages/components/src/api/weights/Search.ts new file mode 100644 index 0000000000..95303e1836 --- /dev/null +++ b/packages/components/src/api/weights/Search.ts @@ -0,0 +1,19 @@ +import MakeRequest from "../MakeRequest"; +import { Weight } from "./GetWeight"; + +export interface SearchWeightRequest { + search_term: string; + weight_type?: string; + weight_category?: string; + ietf_language_tag?: string; +} + +export interface SearchWeightResponse { + success: boolean; + weights?: Weight[]; +} + +export const SearchWeight = MakeRequest({ + method: "POST", + routingFunction: () => `/v1/weights/search`, +}); diff --git a/packages/fakeyou.com/src/components/common/Card/AudioCard/AudioCard.tsx b/packages/fakeyou.com/src/components/common/Card/AudioCard/AudioCard.tsx index 686385c0dd..6344ea1ca3 100644 --- a/packages/fakeyou.com/src/components/common/Card/AudioCard/AudioCard.tsx +++ b/packages/fakeyou.com/src/components/common/Card/AudioCard/AudioCard.tsx @@ -43,7 +43,7 @@ export default function AudioCard({ const linkUrl = getCardUrl(data, source, type); const history = useHistory(); - console.log("🟩",data); + console.log("🟩", data); const handleSelectModalResultSelect = () => { if (inSelectModal) { @@ -180,7 +180,8 @@ export default function AudioCard({ { const currentTab = tabs.find(tab => tab.tabKey === activeTab); diff --git a/packages/fakeyou.com/src/components/common/TempSelect/TempSelect.scss b/packages/fakeyou.com/src/components/common/TempSelect/TempSelect.scss index 55c75df3ac..788b21b4d3 100644 --- a/packages/fakeyou.com/src/components/common/TempSelect/TempSelect.scss +++ b/packages/fakeyou.com/src/components/common/TempSelect/TempSelect.scss @@ -1,3 +1,27 @@ -.fy-temp-select { // NO !IMPORTANT +.fy-temp-select { margin-bottom: 1rem; -} \ No newline at end of file + + &:only-child, + &:last-child { + margin-bottom: 0; + } +} + +.d-flex:not(.flex-column) > .fy-temp-select { + margin-bottom: 0; + margin-right: 0.5rem; + + &:only-child, + &:last-child { + margin-bottom: 0; + } +} + +.gap-1 > .fy-temp-select, +.gap-2 > .fy-temp-select, +.gap-3 > .fy-temp-select, +.gap-4 > .fy-temp-select, +.gap-5 > .fy-temp-select { + margin-bottom: 0; + margin-right: 0 !important; +} diff --git a/packages/fakeyou.com/src/components/entities/CardWrapper/CardWrapper.tsx b/packages/fakeyou.com/src/components/entities/CardWrapper/CardWrapper.tsx index ba02225d64..b327027379 100644 --- a/packages/fakeyou.com/src/components/entities/CardWrapper/CardWrapper.tsx +++ b/packages/fakeyou.com/src/components/entities/CardWrapper/CardWrapper.tsx @@ -20,7 +20,7 @@ export default function CardWrapper({ canHover, card: Card, data, onClick, paddi const className = `card ${ padding ? "p-3" : "" }${ onClick || canHover ? " card-clickable" : "" }`; return onClick ? -
+
onClick(data) }}>
: diff --git a/packages/fakeyou.com/src/components/entities/EntityInput/EntityInput.tsx b/packages/fakeyou.com/src/components/entities/EntityInput/EntityInput.tsx index 3224678abb..128d56b352 100644 --- a/packages/fakeyou.com/src/components/entities/EntityInput/EntityInput.tsx +++ b/packages/fakeyou.com/src/components/entities/EntityInput/EntityInput.tsx @@ -14,13 +14,20 @@ import { UploadMedia, UploadMediaResponse } from "@storyteller/components/src/ap import { v4 as uuidv4 } from "uuid"; import "./EntityInput.scss"; +// enum EntityInputMode { +// Bookmarks = "bookmarks", +// Media = "media", +// Weights = "weights", +// SearchWeights = "searchWeights", +// } + interface Props { + aspectRatio?: "square" | "landscape" | "portrait", + mediaType?: MediaFilterProp, label?: string, onChange?: any, - owner?: string, - mediaType?: MediaFilterProp, - aspectRatio?: "square" | "landscape" | "portrait", - weightType?: WeightFilterProp, + type: string, + weightType?: WeightFilterProp } interface SlideProps { @@ -31,9 +38,7 @@ interface EmptySlideProps extends SlideProps { entityType: EntityType, filterType: MediaFilterProp | WeightFilterProp, inputProps?: any, - onSelect: any, open: any, - owner: string, user: any }; @@ -66,10 +71,10 @@ const MocapInputFull = ({ media }: SlideProps) => { ; }; -const MediaPickerEmpty = ({ entityType, filterType, media, onSelect, open, owner, inputProps, user }: EmptySlideProps) => { +const MediaPickerEmpty = ({ entityType, filterType, open, inputProps, user, ...rest }: EmptySlideProps) => { const browserClick = () => open({ component: MediaBrowser, - props: { entityType, filterType, onSelect, owner, username: user?.username || "" } + props: { entityType, filterType, username: user?.username || "", ...rest } }); const mediaIcons = () => { @@ -109,7 +114,7 @@ const AniMod = ({ animating, className, isLeaving, render: Render, style, ...res ; -export default function EntityInput({ aspectRatio = "square", label, onChange, owner, mediaType, weightType }: Props) { +export default function EntityInput({ aspectRatio = "square", label, onChange, mediaType, weightType, ...rest }: Props) { const entityType = mediaType ? EntityType.media : weightType ? EntityType.weights : EntityType.unknown; const filterType = mediaType || weightType || "all"; const { search } = useLocation(); @@ -136,6 +141,7 @@ export default function EntityInput({ aspectRatio = "square", label, onChange, o }); const onSelect = (data: MediaFile) => { mediaSet(data) + console.log("🔅",data); onChange({ target: { name: "temp", value: data.token } }); } const busy = false; @@ -164,7 +170,7 @@ export default function EntityInput({ aspectRatio = "square", label, onChange, o return [ , , - + ][i]; }) diff --git a/packages/fakeyou.com/src/components/layout/InferenceJobsList/InferenceJobsList.tsx b/packages/fakeyou.com/src/components/layout/InferenceJobsList/InferenceJobsList.tsx index 45d1aa3a16..5c5a896355 100644 --- a/packages/fakeyou.com/src/components/layout/InferenceJobsList/InferenceJobsList.tsx +++ b/packages/fakeyou.com/src/components/layout/InferenceJobsList/InferenceJobsList.tsx @@ -23,6 +23,7 @@ interface JobsListProps { } const resultPaths = { + EngineComposition: "/media", FaceAnimation: "/media", TextToSpeech: "/media", VoiceConversion: "/media", diff --git a/packages/fakeyou.com/src/components/layout/TopNav/TopNav.tsx b/packages/fakeyou.com/src/components/layout/TopNav/TopNav.tsx index 706773e978..93011ebe2a 100644 --- a/packages/fakeyou.com/src/components/layout/TopNav/TopNav.tsx +++ b/packages/fakeyou.com/src/components/layout/TopNav/TopNav.tsx @@ -15,7 +15,7 @@ import React, { useEffect, useState } from "react"; import { Link, useHistory } from "react-router-dom"; import { SessionWrapper } from "@storyteller/components/src/session/SessionWrapper"; import { Logout } from "@storyteller/components/src/api/session/Logout"; -import { useModal } from "hooks"; +import { useModal, useSession } from "hooks"; import { InferenceJobsModal } from "components/modals"; import { useDomainConfig } from "context/DomainConfigContext"; import NavItem from "../../common/NavItem/NavItem"; @@ -112,12 +112,14 @@ export default function TopNav({ let profileDropdown = <>; + const { user } = useSession(); + if (sessionWrapper.isLoggedIn()) { - let displayName = sessionWrapper.getDisplayName(); - let username = sessionWrapper.getUsername(); - let emailHash = sessionWrapper.getEmailGravatarHash(); - let avatarIndex = 0; //temporary - let backgroundColorIndex = 0; //temporary + let displayName = user.display_name; + let username = user.username; + let emailHash = user.email_gravatar_hash; + let avatarIndex = user.core_info.default_avatar.image_index; + let backgroundColorIndex = user.core_info.default_avatar.color_index; profileDropdown = ( {}, onSelect, owner, username }: Props) { +export default function MediaBrowser({ + entityType, + filterType: inputFilter, + mediaToken, + handleClose = () => {}, + onSelect, + owner, + search, + username, +}: Props) { const ratings = useRatings(); const [showMasonryGrid, setShowMasonryGrid] = useState(true); - const [filterType, filterTypeSet] = useState(inputFilter || "all"); + const [filterType, filterTypeSet] = useState(inputFilter || "all"); const [list, listSet] = useState([]); + const fetcher = search + ? SearchWeights + : [() => {}, GetMediaByUser, GetWeightsByUser][entityType] || + GetMediaByUser; const entities = useListContent({ + debug: "media browser", addQueries: { - page_size: 24, - ...prepFilter(filterType, ["","filter_media_type","maybe_scoped_weight_type"][entityType]), + ...(search ? {} : { page_size: 24 }), + ...prepFilter( + filterType, + ["", "filter_media_type", "maybe_scoped_weight_type"][entityType] + ), }, addSetters: { filterTypeSet }, - fetcher: [() => {},GetMediaByUser,GetWeightsByUser][entityType] || GetMediaByUser, + fetcher, list, listSet, onInputChange: () => setShowMasonryGrid(false), - onSuccess: (res) => { + onSuccess: res => { // bookmarks.gather({ res, key: "token" }); ratings.gather({ res, key: "token" }); setShowMasonryGrid(true); }, + ...(search ? { request: { search_term: search } } : {}), requestList: true, + ...(search ? { resultsKey: "weights" } : {}), urlParam: owner || username, - urlUpdate: false + urlUpdate: false, }); const handlePageClick = (selectedItem: { selected: number }) => { @@ -66,53 +95,71 @@ export default function MediaBrowser({ entityType, filterType: inputFilter, medi // { value: "mostliked", label: "Most Liked" }, ]; - const title = ["",`${ owner ? owner + "'s " : "" }Media`,"Weights"][entityType]; + const title = ["", `${owner ? owner + "'s " : ""}Media`, "Weights"][ + entityType + ]; const onClick = (data: any) => { + console.log("🩵", data); onSelect(data); handleClose(); }; - return <> - - - { (!inputFilter || inputFilter === "all") && + + } - - - - { entities.isLoading ? ( -
- {Array.from({ length: 12 }).map((_, index) => ( - - ))} -
- ) : ( - <> - { showMasonryGrid && ( -
- -
- ) } - - )} -
+ value: entities.sort, + }} + /> + {(!inputFilter || inputFilter === "all") && ( + + )} + +
+ + {entities.isLoading ? ( +
+ {Array.from({ length: 12 }).map((_, index) => ( + + ))} +
+ ) : ( + <> + {showMasonryGrid && ( +
+ +
+ )} + + )} +
-
- -
- ; -}; \ No newline at end of file +
+ +
+ + ); +} diff --git a/packages/fakeyou.com/src/hooks/useListContent/useListContent.tsx b/packages/fakeyou.com/src/hooks/useListContent/useListContent.tsx index 8f4de8cc8a..066fedbd0f 100644 --- a/packages/fakeyou.com/src/hooks/useListContent/useListContent.tsx +++ b/packages/fakeyou.com/src/hooks/useListContent/useListContent.tsx @@ -12,7 +12,9 @@ interface Props { onInputChange?: (x?: any) => any; onSuccess?: (x?: any) => any; pagePreset?: number; + request?: any; requestList?: boolean; + resultsKey?: string; urlParam: string; urlUpdate?: boolean; } @@ -29,7 +31,9 @@ export default function useListContent({ onInputChange = n, onSuccess = n, pagePreset = 0, + request, requestList = false, + resultsKey = "results", urlParam = "", urlUpdate = true, }: Props) { @@ -71,7 +75,7 @@ export default function useListContent({ useEffect(() => { const queries = { - page_index: page, + ...page ? { page_index: page } : {}, ...addQueries, // eventually we should provide a way to type this ... or not. It works ...(sort ? { sort_ascending: true } : {}), }; @@ -83,15 +87,13 @@ export default function useListContent({ if (urlUpdate) { history.replace({ pathname, search }); } statusSet(FetchStatus.in_progress); - fetcher(urlParam, {}, queries).then((res: any) => { + fetcher(urlParam, request, queries).then((res: any) => { if (debug) - console.log(`🪲 useListContent success debug at: ${debug}`, res); + console.log(`🪲 useListContent success debug at: ${debug}`, res, resultsKey); statusSet(FetchStatus.success); onSuccess(res); - if (res.results && res.pagination) { - pageCountSet(res.pagination.total_page_count); - listSet(res.results); - } + if (res[resultsKey]) { listSet(res[resultsKey]); } + if (res.pagination) { pageCountSet(res.pagination.total_page_count); } }); } } @@ -105,6 +107,8 @@ export default function useListContent({ pathname, page, sort, + request, + resultsKey, status, urlParam, urlUpdate diff --git a/packages/fakeyou.com/src/v2/view/pages/EngineCompositor/EngineCompositor.tsx b/packages/fakeyou.com/src/v2/view/pages/EngineCompositor/EngineCompositor.tsx index 603a58ef65..48266d87ef 100644 --- a/packages/fakeyou.com/src/v2/view/pages/EngineCompositor/EngineCompositor.tsx +++ b/packages/fakeyou.com/src/v2/view/pages/EngineCompositor/EngineCompositor.tsx @@ -63,6 +63,7 @@ export default function EngineCompositor({ value, sessionWrapper }: Props) { aspectRatio: "landscape", label: "Choose 3D data", onChange, + type: "media", mediaType: "bvh", }} /> diff --git a/packages/fakeyou.com/src/v2/view/pages/dev_upload/DevMediaInput.tsx b/packages/fakeyou.com/src/v2/view/pages/dev_upload/DevMediaInput.tsx index e3508e9952..a72c9f85b4 100644 --- a/packages/fakeyou.com/src/v2/view/pages/dev_upload/DevMediaInput.tsx +++ b/packages/fakeyou.com/src/v2/view/pages/dev_upload/DevMediaInput.tsx @@ -31,13 +31,14 @@ export default function DevMediaInput({ value }: Props) { entityTypeSet(target.value), options, value: entityType }}/> ownerSet(target.value), placeholder: "User" }}/> -
- { media.urlCursor ? -