From c0c98b4e35c547d3fc5d64f7955e1a02ab1ae5d6 Mon Sep 17 00:00:00 2001 From: Victor Date: Tue, 6 Feb 2024 17:07:24 -0800 Subject: [PATCH] prep for weight card revisions --- .../common/MocapInput/MocapInput.tsx | 4 +- .../entities/EntityInput/EntityInput.scss | 109 ++++++++++++ .../entities/EntityInput/EntityInput.tsx | 159 ++++++++++++++++++ .../components/entities/EntityInput/index.tsx | 1 + .../src/components/entities/EntityTypes.tsx | 28 ++- .../entities/MediaList/MediaList.tsx | 22 ++- .../src/components/entities/index.tsx | 3 +- .../modals/MediaBrowser/MediaBrowser.tsx | 51 +++--- .../hooks/useListContent/useListContent.tsx | 1 + .../view/pages/dev_upload/DevMediaInput.tsx | 5 +- 10 files changed, 346 insertions(+), 37 deletions(-) create mode 100644 packages/fakeyou.com/src/components/entities/EntityInput/EntityInput.scss create mode 100644 packages/fakeyou.com/src/components/entities/EntityInput/EntityInput.tsx create mode 100644 packages/fakeyou.com/src/components/entities/EntityInput/index.tsx diff --git a/packages/fakeyou.com/src/components/common/MocapInput/MocapInput.tsx b/packages/fakeyou.com/src/components/common/MocapInput/MocapInput.tsx index 26e4957cf1..927fa15f75 100644 --- a/packages/fakeyou.com/src/components/common/MocapInput/MocapInput.tsx +++ b/packages/fakeyou.com/src/components/common/MocapInput/MocapInput.tsx @@ -5,7 +5,7 @@ import { MediaFile } from "@storyteller/components/src/api/media_files/GetMedia" import Iframe from "react-iframe"; import { MediaBrowser } from "components/modals"; import { FileWrapper, Label, Spinner } from "components/common"; -import { MediaFilterProp } from "components/entities/EntityTypes"; +import { EntityType, MediaFilterProp } from "components/entities/EntityTypes"; import { useFile, useMedia, useModal, useSession } from "hooks"; import { BucketConfig } from "@storyteller/components/src/api/BucketConfig"; import { faFileArrowUp, faGrid, faPersonWalking } from "@fortawesome/pro-solid-svg-icons"; @@ -65,7 +65,7 @@ const MocapInputFull = ({ media }: SlideProps) => { const MediaPickerEmpty = ({ media, onSelect, open, inputProps, type, user }: EmptySlideProps) => { const browserClick = () => open({ component: MediaBrowser, - props: { onSelect, type, username: user?.username || "" } + props: { entityType: EntityType.media, onSelect, type, username: user?.username || "" } }); return <> diff --git a/packages/fakeyou.com/src/components/entities/EntityInput/EntityInput.scss b/packages/fakeyou.com/src/components/entities/EntityInput/EntityInput.scss new file mode 100644 index 0000000000..a0d864315d --- /dev/null +++ b/packages/fakeyou.com/src/components/entities/EntityInput/EntityInput.scss @@ -0,0 +1,109 @@ +@import "scss/colours.scss"; +@import "scss/site-refresh.scss"; + + +.fy-slide-frame { + position: absolute; + height: 100%; + width: 100%; +} + +.fy-entity-input { + @include panel; + border-radius: .5rem; + overflow: hidden; + position: relative; + // background-color: $panel; +} + +.fy-entity-input-square { + aspect-ratio: 1/1; + height: 300px; + + .fy-entity-input-empty-controls {} +} + +.fy-entity-input-landscape { + width: 100%; + aspect-ratio: 4/3; + max-height: 66vh; +} + +.fy-entity-input-empty, .fy-entity-input-full { + // position: relative; + // overflow: hidden; + + .fy-entity-input-icon { + position: absolute; + height: 80%; + opacity: 75%; + // background-color: blue; + margin: auto; + inset: 0; + + path { fill: $panel-inner-border} + } + +} + +.fy-entity-input-label-icon { + margin-right: .5rem; + height: 1.25rem; +} + +.fy-entity-input-mocap-preview { + position: absolute; + border-radius: .5rem; + border: 1px solid rgba(#fff,.2); + display: block; + vertical-align: bottom; + height: 100%; + width: 100%; + margin: 0; +} + +.fy-entity-input-full-controls { + position: absolute; + background-color: rgba(#000, .5); + padding: 1rem; + // backdrop-filter: blur(2px); + overflow: hidden; + border-radius: .5rem .5rem 0 0; + width: 100%; +} + +.fy-entity-input-empty-controls { + // background-color: red; + position: absolute; + height: 100%; + width: 100%; + display: flex; + flex-direction: column; + justify-content: space-evenly; + padding: 1rem; + gap: 1rem; + + .fy-entity-input-row { + + height: 100%; + } + + .fy-entity-input-button { + background-color: rgba(#000,.15); + border-radius: .5rem; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + height: 100%; + transition: .25s all ease-in-out; + color: rgba(#fff, .66); + + &:hover { + background-color: rgba(#000,.1); + color: rgba(#fff, 1); + } + + label { } + } +} \ No newline at end of file diff --git a/packages/fakeyou.com/src/components/entities/EntityInput/EntityInput.tsx b/packages/fakeyou.com/src/components/entities/EntityInput/EntityInput.tsx new file mode 100644 index 0000000000..ec306800b6 --- /dev/null +++ b/packages/fakeyou.com/src/components/entities/EntityInput/EntityInput.tsx @@ -0,0 +1,159 @@ +import React, { useState } from "react"; +import { useLocation } from "react-router-dom"; +import { a, useTransition } from "@react-spring/web"; +import { MediaFile } from "@storyteller/components/src/api/media_files/GetMedia"; +import Iframe from "react-iframe"; +import { MediaBrowser } from "components/modals"; +import { FileWrapper, Label, Spinner } from "components/common"; +import { EntityType, MediaFilterProp, WeightFilterProp } from "components/entities/EntityTypes"; +import { useFile, useMedia, useModal, useSession } from "hooks"; +import { BucketConfig } from "@storyteller/components/src/api/BucketConfig"; +import { faFileArrowUp, faGrid, faPersonWalking } from "@fortawesome/pro-solid-svg-icons"; +import { FontAwesomeIcon as Icon } from "@fortawesome/react-fontawesome"; +import { UploadMedia, UploadMediaResponse } from "@storyteller/components/src/api/media_files/UploadMedia"; +import { v4 as uuidv4 } from "uuid"; +import "./EntityInput.scss"; + +interface Props { + label?: string, + onChange?: any, + mediaType?: MediaFilterProp, + aspectRatio?: "square" | "landscape" | "portrait", + weightType?: WeightFilterProp, +} + +interface SlideProps { + media?: MediaFile +}; + +interface EmptySlideProps extends SlideProps { + entityType: EntityType, + filterType: MediaFilterProp | WeightFilterProp, + inputProps?: any, + onSelect: any, + open: any, + user: any +}; + +interface AniProps { + animating: boolean, + className: string, + isLeaving: boolean, + render: any, + style: any +} + +const MediaBusy = () => { + return ; +}; + +const MocapInputFull = ({ media }: SlideProps) => { + const bucketConfig = new BucketConfig(); + const bvhUrl = media?.public_bucket_path ? bucketConfig.getGcsUrl(media.public_bucket_path) : ""; + + return <> +