@@ -32,5 +39,5 @@ export default function FileDetails({ clear = () => {}, file, hideClearDetails,
{ !hideClearDetails && }
-
;
+ ;
};
diff --git a/packages/fakeyou.com/src/components/common/ImageInput/ImageInput.scss b/packages/fakeyou.com/src/components/common/ImageInput/ImageInput.scss
index c6a2169d5d..2927e32f40 100644
--- a/packages/fakeyou.com/src/components/common/ImageInput/ImageInput.scss
+++ b/packages/fakeyou.com/src/components/common/ImageInput/ImageInput.scss
@@ -42,6 +42,11 @@
border-radius: 0;
}
+ .placeholder-icon {
+ height: 10rem;
+ opacity: .15;
+ }
+
.image-placeholder {
// background-color: red;
fill: $secondary;
diff --git a/packages/fakeyou.com/src/components/common/ImageInput/ImageInput.tsx b/packages/fakeyou.com/src/components/common/ImageInput/ImageInput.tsx
index 162ef96370..85051f2e54 100644
--- a/packages/fakeyou.com/src/components/common/ImageInput/ImageInput.tsx
+++ b/packages/fakeyou.com/src/components/common/ImageInput/ImageInput.tsx
@@ -2,18 +2,23 @@ import React, { useState } from "react";
import { a, useSpring } from '@react-spring/web';
import { FileDetails, FileWrapper, FileLabel } from "components/common";
import { faImagePortrait } from "@fortawesome/pro-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
import "./ImageInput.scss";
const fileTypes = ["JPG", "GIF", "PNG"];
interface Props {
blob?: string;
+ children?: any;
clear?: (file?: any) => void;
+ disabled: boolean;
file?: any;
hideActions?: boolean;
hideClearDetails?: boolean;
inputProps?: any;
onRest?: () => void;
+ placeholderIcon?: IconDefinition;
success?: boolean;
submit?: () => void;
working?: boolean;
@@ -22,7 +27,7 @@ interface Props {
const n = () => {};
-export default function ImageInput({ blob = "", clear = n, file, hideActions, hideClearDetails, inputProps, onRest = n, success = false, submit = n, working = false, ...rest }: Props) {
+export default function ImageInput({ blob = "", children, clear = n, disabled, file, hideActions, hideClearDetails, inputProps, onRest = n, placeholderIcon, success = false, submit = n, working = false, ...rest }: Props) {
const [loaded,loadedSet] = useState
();
const onLoad = () => loadedSet(1);
const style = useSpring({
@@ -31,15 +36,17 @@ export default function ImageInput({ blob = "", clear = n, file, hideActions, hi
opacity: loaded ? 1 : 0
});
- return
+ return
{ file ? <>
-
+
+ { children }
> : <>
-
+ { placeholderIcon ?
:
+
}
{ !file && }
diff --git a/packages/fakeyou.com/src/components/common/TempTextArea/TempTextArea.tsx b/packages/fakeyou.com/src/components/common/TempTextArea/TempTextArea.tsx
new file mode 100644
index 0000000000..34dac2cac4
--- /dev/null
+++ b/packages/fakeyou.com/src/components/common/TempTextArea/TempTextArea.tsx
@@ -0,0 +1,16 @@
+import React from "react";
+
+interface TextAreaProps
+ extends React.TextareaHTMLAttributes
{
+ label?: string;
+ textArea?: boolean;
+}
+
+export default function TempTextArea({ label, textArea, ...rest }: TextAreaProps) {
+ return <>
+ { label && }
+
+
+
+ >;
+}
diff --git a/packages/fakeyou.com/src/components/common/TempTextArea/index.tsx b/packages/fakeyou.com/src/components/common/TempTextArea/index.tsx
new file mode 100644
index 0000000000..fd1c0f6958
--- /dev/null
+++ b/packages/fakeyou.com/src/components/common/TempTextArea/index.tsx
@@ -0,0 +1 @@
+export { default } from "./TempTextArea";
diff --git a/packages/fakeyou.com/src/components/common/index.tsx b/packages/fakeyou.com/src/components/common/index.tsx
index 43e9752abe..793ec58274 100644
--- a/packages/fakeyou.com/src/components/common/index.tsx
+++ b/packages/fakeyou.com/src/components/common/index.tsx
@@ -2,8 +2,8 @@ import AudioBlobPreview from "./AudioBlobPreview";
import AudioInput from "./AudioInput";
import BasicVideo from "./BasicVideo";
import Button from "./Button";
-import Check from "./Check";
import Checkbox from "./Checkbox";
+import Container from "./Container";
import FileActions from "./FileActions";
import FileDetails from "./FileDetails";
import FileWrapper from "./FileWrapper";
@@ -15,19 +15,22 @@ import Panel from "./Panel";
import Radio from "./Radio";
import SegmentButtons from "./SegmentButtons";
import Select from "./Select";
+import Skeleton from "./Skeleton";
import Slider from "./Slider";
import Spinner from "./Spinner";
+import SplitPanel from "./SplitPanel";
import TempAudioPlayer from "./TempAudioPlayer";
import TempInput from "./TempInput";
import TempSelect from "./TempSelect";
+import TempTextArea from "./TempTextArea";
export {
AudioBlobPreview,
AudioInput,
BasicVideo,
Button,
- Check,
Checkbox,
+ Container,
FileActions,
FileDetails,
FileWrapper,
@@ -39,9 +42,12 @@ export {
Radio,
SegmentButtons,
Select,
+ Skeleton,
Slider,
Spinner,
+ SplitPanel,
TempAudioPlayer,
TempInput,
- TempSelect
+ TempSelect,
+ TempTextArea
};
\ No newline at end of file
diff --git a/packages/fakeyou.com/src/components/layout/InferenceJobsList/InferenceJobsList.scss b/packages/fakeyou.com/src/components/layout/InferenceJobsList/InferenceJobsList.scss
index 6776c3d91c..f73c6c5bd6 100644
--- a/packages/fakeyou.com/src/components/layout/InferenceJobsList/InferenceJobsList.scss
+++ b/packages/fakeyou.com/src/components/layout/InferenceJobsList/InferenceJobsList.scss
@@ -1,72 +1,37 @@
@import "scss/colours.scss";
a.face-animator-job {
- &:hover {
- background-color: $panel-inner;
- }
+ &:hover {
+ background-color: $panel-inner;
+ }
}
.face-animator-job {
- border-radius: .5rem;
+ border-radius: .5rem;
+ display: flex;
+ flex-wrap: wrap;
+ align-items: stretch;
+ margin-top: .5rem;
+ padding: .5rem;
+
+ .job-details {
display: flex;
+ align-items: center;
flex-wrap: wrap;
- align-items: stretch;
- margin-top: .5rem;
- padding: .5rem;
+ // height: 100%;
+ width: min-content;
- svg {
- // background-color: rgba(#ccc, .05);
- margin-right: .5rem;
- height: 2.25rem;
- width: 2.25rem;
- fill: none;
+ }
- circle, line, polyline {
+ .work-indicator { margin-right: .5rem; }
- stroke-width: 4px;
- stroke-linecap: round;
- stroke: #fff;
- }
-
- polyline {
- transform: translate(2px,2px);
- }
- }
-
- @keyframes ckw {
- 0% {
- transform: rotate(0deg);
- }
- 100% {
- transform: rotate(360deg);
- }
-}
- .work-indicator-circle-track {
- stroke: rgba(#fff, .15);
- stroke-width: 4px;
- }
- .work-indicator-circle-marker {
- transform-origin: 18px 18px;
- animation: ckw 1.5s linear infinite;
- // strokeDashoffset: 4;
- // stroke: #fff;
- }
-
- .job-details {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- // height: 100%;
- width: min-content;
-
- }
-
- h6 {
- color: #fff;
- line-height: 1rem;
- height: 1rem;
- margin-bottom: 0;
- white-space: nowrap
- }
- span { font-weight: lighter; line-height: 1rem; }
+ h6 {
+ color: #fff;
+ line-height: 1rem;
+ height: 1rem;
+ margin-bottom: 0;
+ white-space: nowrap
+ }
+
+ span { font-weight: lighter; line-height: 1rem; }
}
\ No newline at end of file
diff --git a/packages/fakeyou.com/src/components/layout/InferenceJobsList/JobItem.tsx b/packages/fakeyou.com/src/components/layout/InferenceJobsList/JobItem.tsx
index 6a2c180732..0eaa6d4c6e 100644
--- a/packages/fakeyou.com/src/components/layout/InferenceJobsList/JobItem.tsx
+++ b/packages/fakeyou.com/src/components/layout/InferenceJobsList/JobItem.tsx
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import { a, useSpring } from "@react-spring/web";
-import { Check } from 'components/common';
+import { WorkIndicator } from 'components/svg';
import { FrontendInferenceJobType, InferenceJob } from "@storyteller/components/src/jobs/InferenceJob";
import { JobState } from "@storyteller/components/src/jobs/JobStates";
@@ -15,27 +15,8 @@ interface JobListItem extends InferenceJob {
t?: any
}
-const AniX = ({ checked = false }) => {
- const sharedStyle = {
- config: { tension: 280, friction: 45 },
- strokeDashoffset: 1,
- strokeDasharray: checked ? '13, 0' : '0,13'
- };
- const line1 = useSpring({
- ...sharedStyle,
- });
- const line2 = useSpring({
- delay: 450,
- ...sharedStyle
- });
- return <>
-
-
- >;
-}
-
-const OuterItem = ({ className, children, isComplete, jobToken, maybeResultToken, onSelect = () => {}, refSet }: { className?: string, children?: any, jobToken: string, isComplete: boolean, maybeResultToken?: any, onSelect?: any, refSet?: any }) => isComplete ?
+const OuterItem = ({ className, children, success, jobToken, maybeResultToken, onSelect = () => {}, refSet }: { className?: string, children?: any, jobToken: string, success: boolean, maybeResultToken?: any, onSelect?: any, refSet?: any }) => success ?
onSelect(), ref: refSet }}>{ children } :
{ children };
@@ -48,7 +29,7 @@ export default function JobItem({ failures, maybeFailureCategory, maybeResultTok
const jobType = FrontendInferenceJobType[inputType];
const jobStatus = jobStatusDescription(jobState);
const jobStatusClass = jobStatus.toLowerCase().replace("_","-");
- const circle = { cx: 18, cy: 18, r: 14, strokeWidth: 4 };
+
const dashStatus = () => {
switch (jobState) {
case JobState.COMPLETE_SUCCESS:
@@ -61,19 +42,10 @@ export default function JobItem({ failures, maybeFailureCategory, maybeResultTok
default: return 0;
}
};
- const isComplete = jobState === JobState.COMPLETE_SUCCESS;
- const isProblemo = jobState === JobState.COMPLETE_FAILURE || jobState === JobState.DEAD;
- const dashes = [ // the arity (amount of numbers) must remain the same or react-spring will freakout
- "1 7 1 7 1 70", // UKNOWN / PENDING - 3x 1pt strokes with 7 point gaps, then a big 70pt gap
- "6 0 6 0 6 70", // STARTED / ATTEMPT_FAILED - 6pt strokes with 0pt gaps to appear as one, big gap
- "0 0 50 0 0 0" // COMPLETE_SUCCESS / COMPLETE_FAILURE / DEAD - One big 50pt stroke
- ];
+ const success = jobState === JobState.COMPLETE_SUCCESS;
+ const failure = jobState === JobState.COMPLETE_FAILURE || jobState === JobState.DEAD;
const [bounce,bounceSet] = useState(false);
- const dashy = useSpring({
- config: { tension: 280, friction: 60 },
- opacity: [.5,1,1][dashStatus()],
- strokeDasharray: dashes[dashStatus()]
- });
+
const makeBounce = (amount = 0, delay = 0) => ({
delay,
config: { tension: 250, friction: 12 },
@@ -84,27 +56,21 @@ export default function JobItem({ failures, maybeFailureCategory, maybeResultTok
const subtitle = maybeFailureCategory ?`${ failures(maybeFailureCategory) }` : t(`subtitles.${jobStatus}`);
const className = `face-animator-job job-status-${jobStatusClass}`;
-
useEffect(() => {
- if (!bounce && !hasBounced && isComplete) {
+ if (!bounce && !hasBounced && success) {
hasBouncedSet(true);
bounceSet(true);
setTimeout(() => bounceSet(false),250);
}
- },[bounce, hasBounced, isComplete ]);
+ },[bounce, hasBounced, success ]);
- return
-
+ return
+
{ t(`${jobType}.${jobStatus}`) }
-
{ isComplete ? subtitle + " >" : subtitle }
+
{ success ? subtitle + " >" : subtitle }
;
};
\ No newline at end of file
diff --git a/packages/fakeyou.com/src/components/svg/AniX/AniX.tsx b/packages/fakeyou.com/src/components/svg/AniX/AniX.tsx
new file mode 100644
index 0000000000..0cda6e438e
--- /dev/null
+++ b/packages/fakeyou.com/src/components/svg/AniX/AniX.tsx
@@ -0,0 +1,26 @@
+import React from 'react';
+import { a, useSpring } from "@react-spring/web";
+
+interface Props {
+ checked?: boolean;
+}
+
+export default function AniX({ checked = false }: Props) {
+ const sharedStyle = {
+ config: { tension: 280, friction: 45 },
+ strokeDashoffset: 1,
+ strokeDasharray: checked ? '13, 0' : '0,13'
+ };
+ const line1 = useSpring({
+ ...sharedStyle,
+ });
+ const line2 = useSpring({
+ delay: 450,
+ ...sharedStyle
+ });
+
+ return <>
+
+
+ >;
+};
\ No newline at end of file
diff --git a/packages/fakeyou.com/src/components/svg/AniX/index.ts b/packages/fakeyou.com/src/components/svg/AniX/index.ts
new file mode 100644
index 0000000000..37757308ed
--- /dev/null
+++ b/packages/fakeyou.com/src/components/svg/AniX/index.ts
@@ -0,0 +1 @@
+export { default } from './AniX';
\ No newline at end of file
diff --git a/packages/fakeyou.com/src/components/common/Check/Check.tsx b/packages/fakeyou.com/src/components/svg/Check/Check.tsx
similarity index 100%
rename from packages/fakeyou.com/src/components/common/Check/Check.tsx
rename to packages/fakeyou.com/src/components/svg/Check/Check.tsx
diff --git a/packages/fakeyou.com/src/components/common/Check/index.ts b/packages/fakeyou.com/src/components/svg/Check/index.ts
similarity index 100%
rename from packages/fakeyou.com/src/components/common/Check/index.ts
rename to packages/fakeyou.com/src/components/svg/Check/index.ts
diff --git a/packages/fakeyou.com/src/components/svg/DashedCircle/DashedCircle.tsx b/packages/fakeyou.com/src/components/svg/DashedCircle/DashedCircle.tsx
new file mode 100644
index 0000000000..43d8825847
--- /dev/null
+++ b/packages/fakeyou.com/src/components/svg/DashedCircle/DashedCircle.tsx
@@ -0,0 +1,23 @@
+import React from 'react';
+import { a, useSpring } from "@react-spring/web";
+import { circle } from "../sharedSVGProps";
+
+interface Props {
+ className?: string,
+ stage: number
+}
+
+export default function DashedCircle({ className = "", stage = 0 }: Props) {
+ const dashes = [ // the arity (amount of numbers) must remain the same or react-spring will freakout
+ "1 7 1 7 1 70", // UKNOWN / PENDING - 3x 1pt strokes with 7 point gaps, then a big 70pt gap
+ "6 0 6 0 6 70", // STARTED / ATTEMPT_FAILED - 6pt strokes with 0pt gaps to appear as one, big gap
+ "0 0 50 0 0 0" // COMPLETE_SUCCESS / COMPLETE_FAILURE / DEAD - One big 50pt stroke
+ ];
+ const style = useSpring({
+ config: { tension: 280, friction: 60 },
+ opacity: [.5,1,1][stage],
+ strokeDasharray: dashes[stage]
+ });
+
+ return ;
+};
\ No newline at end of file
diff --git a/packages/fakeyou.com/src/components/svg/DashedCircle/index.ts b/packages/fakeyou.com/src/components/svg/DashedCircle/index.ts
new file mode 100644
index 0000000000..1ba45b23c3
--- /dev/null
+++ b/packages/fakeyou.com/src/components/svg/DashedCircle/index.ts
@@ -0,0 +1 @@
+export { default } from './DashedCircle';
\ No newline at end of file
diff --git a/packages/fakeyou.com/src/components/svg/WorkIndicator/WorkIndicator.scss b/packages/fakeyou.com/src/components/svg/WorkIndicator/WorkIndicator.scss
new file mode 100644
index 0000000000..25f08aaa26
--- /dev/null
+++ b/packages/fakeyou.com/src/components/svg/WorkIndicator/WorkIndicator.scss
@@ -0,0 +1,28 @@
+.work-indicator {
+ height: 2.25rem;
+ width: 2.25rem;
+ fill: none;
+
+ circle, line, polyline {
+ stroke-width: 4px;
+ stroke-linecap: round;
+ stroke: #fff;
+ }
+
+ polyline { transform: translate(2px,2px); }
+
+ .work-indicator-circle-track {
+ stroke: rgba(#fff, .15);
+ stroke-width: 4px;
+ }
+
+ .work-indicator-circle-marker {
+ transform-origin: 18px 18px;
+ animation: work-indicator-spin 1.5s linear infinite;
+ }
+
+ @keyframes work-indicator-spin {
+ 0% { transform: rotate(0deg) }
+ 100% { transform: rotate(360deg) }
+ }
+}
\ No newline at end of file
diff --git a/packages/fakeyou.com/src/components/svg/WorkIndicator/WorkIndicator.tsx b/packages/fakeyou.com/src/components/svg/WorkIndicator/WorkIndicator.tsx
new file mode 100644
index 0000000000..6199229559
--- /dev/null
+++ b/packages/fakeyou.com/src/components/svg/WorkIndicator/WorkIndicator.tsx
@@ -0,0 +1,19 @@
+import React from 'react';
+import { AniX, Check, DashedCircle } from 'components/svg';
+import { circle } from "../sharedSVGProps";
+import "./WorkIndicator.scss";
+
+interface Props {
+ failure: boolean,
+ stage: number,
+ success: boolean
+}
+
+export default function WorkIndicator({ failure = false, stage = 0, success = false }: Props) {
+ return ;
+};
\ No newline at end of file
diff --git a/packages/fakeyou.com/src/components/svg/WorkIndicator/index.ts b/packages/fakeyou.com/src/components/svg/WorkIndicator/index.ts
new file mode 100644
index 0000000000..d6c924aa5a
--- /dev/null
+++ b/packages/fakeyou.com/src/components/svg/WorkIndicator/index.ts
@@ -0,0 +1 @@
+export { default } from './WorkIndicator';
\ No newline at end of file
diff --git a/packages/fakeyou.com/src/components/svg/index.ts b/packages/fakeyou.com/src/components/svg/index.ts
new file mode 100644
index 0000000000..31ee4d8e98
--- /dev/null
+++ b/packages/fakeyou.com/src/components/svg/index.ts
@@ -0,0 +1,11 @@
+import AniX from "./AniX";
+import Check from "./Check";
+import DashedCircle from "./DashedCircle";
+import WorkIndicator from "./WorkIndicator";
+
+export {
+ AniX,
+ Check,
+ DashedCircle,
+ WorkIndicator
+};
\ No newline at end of file
diff --git a/packages/fakeyou.com/src/components/svg/sharedSVGProps.ts b/packages/fakeyou.com/src/components/svg/sharedSVGProps.ts
new file mode 100644
index 0000000000..b2e3b92215
--- /dev/null
+++ b/packages/fakeyou.com/src/components/svg/sharedSVGProps.ts
@@ -0,0 +1 @@
+export const circle = { cx: 18, cy: 18, r: 14, strokeWidth: 4 };
\ No newline at end of file
diff --git a/packages/fakeyou.com/src/hooks/useWeightFetch/useWeightFetch.tsx b/packages/fakeyou.com/src/hooks/useWeightFetch/useWeightFetch.tsx
index 0f7543c1f6..e07c9498dd 100644
--- a/packages/fakeyou.com/src/hooks/useWeightFetch/useWeightFetch.tsx
+++ b/packages/fakeyou.com/src/hooks/useWeightFetch/useWeightFetch.tsx
@@ -4,6 +4,9 @@ import { FetchStatus } from "@storyteller/components/src/api/_common/SharedFetch
import { GetWeight, Weight } from "@storyteller/components/src/api/weights/GetWeight";
import { UpdateWeight } from "@storyteller/components/src/api/weights/UpdateWeight";
import { DeleteWeight } from "@storyteller/components/src/api/weights/DeleteWeight";
+import { UploadMedia, UploadMediaResponse } from "@storyteller/components/src/api/media_files/UploadMedia";
+import { v4 as uuidv4 } from "uuid";
+import { useFile } from "hooks";
interface Props {
onRemove?: (x: any) => void;
@@ -17,6 +20,9 @@ export default function useWeightFetch({ onRemove = () => {}, token }: Props) {
const [title, titleSet] = useState("");
const [visibility, visibilitySet] = useState("public");
const [descriptionMD, descriptionMDSet] = useState("");
+ const [imgMediaFile, imgMediaFileSet] = useState("");
+ const [imgUploadStatus, imgUploadStatusSet] = useState(FetchStatus.ready);
+ const imageProps = useFile({});
const isLoading = status === FetchStatus.ready || status === FetchStatus.in_progress;
const fetchError = status === FetchStatus.error;
const history = useHistory();
@@ -29,6 +35,7 @@ export default function useWeightFetch({ onRemove = () => {}, token }: Props) {
const update = () => {
writeStatusSet(FetchStatus.in_progress);
UpdateWeight(token,{
+ cover_image_media_file_token: imgMediaFile,
description_markdown: descriptionMD,
description_rendered_html: data?.description_rendered_html || "",
title,
@@ -58,6 +65,25 @@ export default function useWeightFetch({ onRemove = () => {}, token }: Props) {
onRemove(res);
});
};
+
+ const uploadCoverImg = (e: any) => {
+ console.log("🧲",!!imageProps.file, imgUploadStatus);
+ // e.stopPropigation();
+ if (imageProps.file && imgUploadStatus < 2) {
+ imgUploadStatusSet(FetchStatus.in_progress);
+ UploadMedia({
+ uuid_idempotency_token: uuidv4(),
+ file: imageProps.file,
+ source: "file",
+ }) // if there an audio file it uploads here
+ .then((res: UploadMediaResponse) => {
+ if ("media_file_token" in res) {
+ imgUploadStatusSet(FetchStatus.success);
+ imgMediaFileSet(res.media_file_token);
+ }
+ });
+ }
+ };
useEffect(() => {
if (token && !data && status === FetchStatus.ready) {
@@ -78,5 +104,5 @@ export default function useWeightFetch({ onRemove = () => {}, token }: Props) {
}
}, [status, token, data]);
- return { data, fetchError, isLoading, descriptionMD, onChange, remove, status, title, update, visibility, writeStatus };
+ return { data, fetchError, imgMediaFile, imgMediaFileSet, imageProps, imgUploadStatus, isLoading, descriptionMD, onChange, remove, status, title, update, uploadCoverImg, visibility, writeStatus };
};
\ No newline at end of file
diff --git a/packages/fakeyou.com/src/scss/breakpoints.scss b/packages/fakeyou.com/src/scss/breakpoints.scss
new file mode 100644
index 0000000000..ed690c8db6
--- /dev/null
+++ b/packages/fakeyou.com/src/scss/breakpoints.scss
@@ -0,0 +1,2 @@
+$under992: max-width 992px;
+$over992: min-width 992px;
\ No newline at end of file
diff --git a/packages/fakeyou.com/src/v2/view/pages/face_animator/FaceAnimator.scss b/packages/fakeyou.com/src/v2/view/pages/face_animator/FaceAnimator.scss
index 2d4de9c5ad..d53f287c52 100644
--- a/packages/fakeyou.com/src/v2/view/pages/face_animator/FaceAnimator.scss
+++ b/packages/fakeyou.com/src/v2/view/pages/face_animator/FaceAnimator.scss
@@ -1,9 +1,7 @@
@import "scss/_breakpoint.scss";
+@import "scss/breakpoints.scss";
@import "scss/colours.scss";
-$under992: max-width 992px;
-$over992: min-width 992px;
-
@mixin FAltTxt { color: #b6b6bb; }
@mixin FApanel {
padding: 1.5rem;
diff --git a/packages/fakeyou.com/src/v2/view/pages/weight/WeightEditPage.scss b/packages/fakeyou.com/src/v2/view/pages/weight/WeightEditPage.scss
new file mode 100644
index 0000000000..d4fac90795
--- /dev/null
+++ b/packages/fakeyou.com/src/v2/view/pages/weight/WeightEditPage.scss
@@ -0,0 +1,88 @@
+@import "scss/_breakpoint.scss";
+@import "scss/breakpoints.scss";
+@import "scss/colours.scss";
+
+.weight-editor {
+ display: flex;
+
+ @include breakpoint($under992) {
+ flex-direction: column-reverse;
+ }
+ // background-color: red;
+
+ & > * {
+ flex-shrink: 0;
+ // margin-right: 1rem;
+ @include breakpoint($over992) {
+ width: 50%;
+ max-width: 50%;
+ }
+
+ @include breakpoint($under992) {
+ width: 100%;
+ }
+ }
+
+ textarea {
+ height: 10rem;
+ resize: none;
+ }
+
+ > :first-child {
+ // background-color: purple;
+ }
+
+ > :last-child {
+ // background-color: green;
+ padding-left: 2rem;
+ }
+
+
+ .fy-cover-img-input {
+ // background-color: red;
+ position: relative;
+ height: 0;
+ padding-bottom: 100%;
+
+ .fy-cover-control {
+ position: absolute;
+ }
+
+ .upload-control-btn {
+ background-color: rgba($secondary, .8);
+ backdrop-filter: blur(2px);
+ border: none;
+ margin: auto auto 1rem auto;
+ }
+ }
+
+ .weight-initial-cover-img {
+ background-size: cover;
+ background-position: center;
+ border-radius: .5rem;
+ position: absolute;
+ // display: flex;
+ overflow: hidden;
+ height: 100%;
+ width: 100%;
+ // padding-bottom: 100%;
+
+ div {
+ // background-color: red;
+ display: flex;
+ height: 100%;
+ width: 100%;
+ position: absolute;
+ }
+ }
+
+ .form-group {
+ margin-bottom: .75rem;
+ }
+
+ .upload-control-indicator {
+ align-items: center;
+ display: flex;
+ flex-direction: column;
+ }
+}
\ No newline at end of file
diff --git a/packages/fakeyou.com/src/v2/view/pages/weight/WeightEditPage.tsx b/packages/fakeyou.com/src/v2/view/pages/weight/WeightEditPage.tsx
index 4b2b6515a2..eb4b76c5f6 100644
--- a/packages/fakeyou.com/src/v2/view/pages/weight/WeightEditPage.tsx
+++ b/packages/fakeyou.com/src/v2/view/pages/weight/WeightEditPage.tsx
@@ -1,29 +1,42 @@
import React, { useState } from "react";
import { useParams } from "react-router-dom";
-import {
- faCircleExclamation,
- faEye,
- // faLanguage,
- faWaveform,
-} from "@fortawesome/pro-solid-svg-icons";
+import { a, useTransition } from "@react-spring/web";
+import { faCircleExclamation, faEye, faImage, faWaveform } from "@fortawesome/pro-solid-svg-icons";
import { usePrefixedDocumentTitle } from "common/UsePrefixedDocumentTitle";
-import Panel from "components/common/Panel";
import PageHeader from "components/layout/PageHeader";
-import Container from "components/common/Container";
-import TempInput from "components/common/TempInput";
-import { Button, TempSelect } from "components/common";
-// import useVoiceRequests from "./useVoiceRequests";
-// import { useHistory } from "react-router-dom";
+import { Button, Container, Panel, Skeleton, SplitPanel,
+ ImageInput, TempInput, TempSelect, TempTextArea } from "components/common";
+import { WorkIndicator } from "components/svg";
import { SessionWrapper } from "@storyteller/components/src/session/SessionWrapper";
-import TextArea from "components/common/TextArea";
+import { BucketConfig } from "@storyteller/components/src/api/BucketConfig";
+import { FetchStatus } from "@storyteller/components/src/api/_common/SharedFetchTypes";
import { useWeightFetch } from "hooks";
-import SplitPanel from "components/common/SplitPanel";
-import Skeleton from "components/common/Skeleton";
+import "./WeightEditPage.scss";
interface WeightEditPageProps {
sessionWrapper: SessionWrapper;
}
+// UploadControl will eventually live elsewhere
+const UploadControl = ({ onClick, status }:{ onClick: (x: any) => any, status: FetchStatus }) => {
+ const failure = status === FetchStatus.error;
+ const success = status === FetchStatus.success;
+
+ return status === FetchStatus.ready ? :
+
+ { success ? "Cover image uploaded" : "Uploading ..." }
+
;
+};
+
export default function WeightEditPage({
sessionWrapper,
}: WeightEditPageProps) {
@@ -34,30 +47,32 @@ export default function WeightEditPage({
const [weightCreatorToken] = useState("");
const {
- // data: weight,
+ data: weight,
descriptionMD,
// fetchError,
+ // imgMediaFile,
+ imageProps,
+ imgUploadStatus,
isLoading,
onChange,
title,
+ uploadCoverImg,
update,
visibility,
} = useWeightFetch({ token: weight_token });
- usePrefixedDocumentTitle("Edit Voice");
+ const src = new BucketConfig().getGcsUrl(weight?.maybe_cover_image_public_bucket_path || "");
- // const onClick = () =>
- // voices
- // .update(weight_token, {
- // title,
- // creator_set_visibility: visibility,
- // ietf_language_tag: language,
- // })
- // .then((res: any) => {
- // if (res && res.success) {
- // history.push("/voice-designer");
- // }
- // });
+ const [editingImg,editingImgSet] = useState(0);
+
+ const transitions = useTransition(editingImg, {
+ config: { tension: 120, friction: 15 },
+ from: { opacity: 0 },
+ enter: { opacity: 1 },
+ leave: { opacity: 0 },
+ });
+
+ usePrefixedDocumentTitle("Edit Voice");
const visibilityOptions = [
{ label: "Public", value: "public" },
@@ -118,55 +133,44 @@ export default function WeightEditPage({
) : (
-
- {/* Replace this with an image component component */}
-
- cover image select component here
+
+
+
{ weight?.maybe_cover_image_public_bucket_path &&
+ transitions((style, i) => !i ?
+
+
+ :
+
+ 1,
+ placeholderIcon: faImage
+ }}>
+
+
+
+
+ )
+ }
-
-
-
- {
- //
- //
- //
- }
-
-
+
+
+ }} />
+
+