From ce20df343a8eec2222acb1f78f33de6f0dac39b9 Mon Sep 17 00:00:00 2001 From: InfiniteTF Date: Mon, 17 May 2021 06:58:25 +0200 Subject: [PATCH] Add option to remove studio stash ids (#1378) * Add option to remove studio stash ids * Add v0.8 changelog --- .../src/components/Changelog/Changelog.tsx | 157 ++++++++++-------- .../src/components/Changelog/versions/v080.md | 2 + .../Studios/StudioDetails/Studio.tsx | 32 +++- 3 files changed, 115 insertions(+), 76 deletions(-) create mode 100644 ui/v2.5/src/components/Changelog/versions/v080.md diff --git a/ui/v2.5/src/components/Changelog/Changelog.tsx b/ui/v2.5/src/components/Changelog/Changelog.tsx index a00beacf7..5b7608034 100644 --- a/ui/v2.5/src/components/Changelog/Changelog.tsx +++ b/ui/v2.5/src/components/Changelog/Changelog.tsx @@ -10,8 +10,12 @@ import V040 from "./versions/v040.md"; import V050 from "./versions/v050.md"; import V060 from "./versions/v060.md"; import V070 from "./versions/v070.md"; +import V080 from "./versions/v080.md"; import { MarkdownPage } from "../Shared/MarkdownPage"; +// to avoid use of explicit any +type Module = typeof V010; + const Changelog: React.FC = () => { const [{ data, loading }, setOpenState] = useChangelogStorage(); @@ -35,82 +39,89 @@ const Changelog: React.FC = () => { }, }); + interface IStashRelease { + version: string; + date?: string; + page: Module; + defaultOpen?: boolean; + } + + // after new release: + // add entry to releases, using the current* fields + // then update the current fields. + const currentVersion = stashVersion || "v0.8.0"; + const currentDate = buildDate; + const currentPage = V080; + + const releases: IStashRelease[] = [ + { + version: currentVersion, + date: currentDate, + page: currentPage, + defaultOpen: true, + }, + { + version: "v0.7.0", + date: "2021-05-15", + page: V070, + }, + { + version: "v0.6.0", + date: "2021-03-29", + page: V060, + }, + { + version: "v0.5.0", + date: "2021-02-23", + page: V050, + }, + { + version: "v0.4.0", + date: "2020-11-24", + page: V040, + }, + { + version: "v0.3.0", + date: "2020-09-02", + page: V030, + }, + { + version: "v0.2.1", + date: "2020-06-10", + page: V021, + }, + { + version: "v0.2.0", + date: "2020-06-06", + page: V020, + }, + { + version: "v0.1.1", + date: "2020-02-25", + page: V011, + }, + { + version: "v0.1.0", + date: "2020-02-24", + page: V010, + }, + ]; + return ( <>

Changelog:

- - - - - - - - - - - - - - - - - - - - - - - - - - - + {releases.map((r) => ( + + + + ))} ); }; diff --git a/ui/v2.5/src/components/Changelog/versions/v080.md b/ui/v2.5/src/components/Changelog/versions/v080.md new file mode 100644 index 000000000..1b4fb4faa --- /dev/null +++ b/ui/v2.5/src/components/Changelog/versions/v080.md @@ -0,0 +1,2 @@ +### 🎨 Improvements +* Add button to remove studio stash ID. ([#1378](https://github.com/stashapp/stash/pull/1378)) diff --git a/ui/v2.5/src/components/Studios/StudioDetails/Studio.tsx b/ui/v2.5/src/components/Studios/StudioDetails/Studio.tsx index c232df6a9..0682225f7 100644 --- a/ui/v2.5/src/components/Studios/StudioDetails/Studio.tsx +++ b/ui/v2.5/src/components/Studios/StudioDetails/Studio.tsx @@ -1,4 +1,4 @@ -import { Table, Tabs, Tab } from "react-bootstrap"; +import { Button, Table, Tabs, Tab } from "react-bootstrap"; import React, { useEffect, useState } from "react"; import { useParams, useHistory, Link } from "react-router-dom"; import cx from "classnames"; @@ -14,6 +14,7 @@ import { } from "src/core/StashService"; import { ImageUtils, TableUtils } from "src/utils"; import { + Icon, DetailsEditNavbar, Modal, LoadingIndicator, @@ -48,6 +49,7 @@ export const Studio: React.FC = () => { const [parentStudioId, setParentStudioId] = useState(); const [rating, setRating] = useState(undefined); const [details, setDetails] = useState(); + const [stashIDs, setStashIDs] = useState([]); // Studio state const [studio, setStudio] = useState>({}); @@ -68,6 +70,7 @@ export const Studio: React.FC = () => { setParentStudioId(state?.parent_studio?.id ?? undefined); setRating(state.rating ?? undefined); setDetails(state.details ?? undefined); + setStashIDs(state.stash_ids ?? []); } function updateStudioData(studioData: Partial) { @@ -150,6 +153,10 @@ export const Studio: React.FC = () => { details, parent_id: parentStudioId ?? null, rating: rating ?? null, + stash_ids: stashIDs.map((s) => ({ + stash_id: s.stash_id, + endpoint: s.endpoint, + })), }; if (!isNew) { @@ -203,6 +210,15 @@ export const Studio: React.FC = () => { history.push(`/studios`); } + const removeStashID = (stashID: GQL.StashIdInput) => { + setStashIDs( + stashIDs.filter( + (s) => + !(s.endpoint === stashID.endpoint && s.stash_id === stashID.stash_id) + ) + ); + }; + function onImageChangeHandler(event: React.FormEvent) { ImageUtils.onImageChange(event, onImageLoad); } @@ -230,7 +246,7 @@ export const Studio: React.FC = () => { StashIDs