@@ -7,6 +7,7 @@ import { FormattedMessage } from "react-intl";
7
7
import { sortPerformers } from "src/core/performers" ;
8
8
import { Icon } from "src/components/Shared/Icon" ;
9
9
import { OperationButton } from "src/components/Shared/OperationButton" ;
10
+ import { StashIDPill } from "src/components/Shared/StashID" ;
10
11
import { PerformerLink , TagLink } from "src/components/Shared/TagLink" ;
11
12
import { TruncatedText } from "src/components/Shared/TruncatedText" ;
12
13
import { parsePath , prepareQueryString } from "src/components/Tagger/utils" ;
@@ -18,7 +19,6 @@ import {
18
19
faImage ,
19
20
} from "@fortawesome/free-solid-svg-icons" ;
20
21
import { objectPath , objectTitle } from "src/core/files" ;
21
- import { ExternalLink } from "src/components/Shared/ExternalLink" ;
22
22
import { ConfigurationContext } from "src/hooks/Config" ;
23
23
import { SceneQueue } from "src/models/sceneQueue" ;
24
24
@@ -85,6 +85,27 @@ const TaggerSceneDetails: React.FC<ITaggerSceneDetails> = ({ scene }) => {
85
85
) ;
86
86
} ;
87
87
88
+ type StashID = Pick < GQL . StashId , "endpoint" | "stash_id" > ;
89
+
90
+ const StashIDs : React . FC < { stashIDs : StashID [ ] } > = ( { stashIDs } ) => {
91
+ if ( ! stashIDs . length ) {
92
+ return null ;
93
+ }
94
+
95
+ const stashLinks = stashIDs . map ( ( stashID ) => {
96
+ const base = stashID . endpoint . match ( / h t t p s ? : \/ \/ .* ?\/ / ) ?. [ 0 ] ;
97
+ const link = base ? (
98
+ < StashIDPill stashID = { stashID } linkType = "scenes" />
99
+ ) : (
100
+ < span className = "small" > { stashID . stash_id } </ span >
101
+ ) ;
102
+
103
+ return < div key = { stashID . stash_id } > { link } </ div > ;
104
+ } ) ;
105
+
106
+ return < div className = "mt-2 sub-content text-right" > { stashLinks } </ div > ;
107
+ } ;
108
+
88
109
interface ITaggerScene {
89
110
scene : GQL . SlimSceneDataFragment ;
90
111
url : string ;
@@ -181,28 +202,6 @@ export const TaggerScene: React.FC<PropsWithChildren<ITaggerScene>> = ({
181
202
) ;
182
203
}
183
204
184
- function maybeRenderStashLinks ( ) {
185
- if ( scene . stash_ids . length > 0 ) {
186
- const stashLinks = scene . stash_ids . map ( ( stashID ) => {
187
- const base = stashID . endpoint . match ( / h t t p s ? : \/ \/ .* ?\/ / ) ?. [ 0 ] ;
188
- const link = base ? (
189
- < ExternalLink
190
- key = { `${ stashID . endpoint } ${ stashID . stash_id } ` }
191
- className = "small d-block"
192
- href = { `${ base } scenes/${ stashID . stash_id } ` }
193
- >
194
- { stashID . stash_id }
195
- </ ExternalLink >
196
- ) : (
197
- < div className = "small" > { stashID . stash_id } </ div >
198
- ) ;
199
-
200
- return link ;
201
- } ) ;
202
- return < div className = "mt-2 sub-content text-right" > { stashLinks } </ div > ;
203
- }
204
- }
205
-
206
205
function onSpriteClick ( ev : React . MouseEvent < HTMLElement > ) {
207
206
ev . preventDefault ( ) ;
208
207
showLightboxImage ( scene . paths . sprite ?? "" ) ;
@@ -276,7 +275,7 @@ export const TaggerScene: React.FC<PropsWithChildren<ITaggerScene>> = ({
276
275
{ errorMessage ? (
277
276
< div className = "text-danger font-weight-bold" > { errorMessage } </ div >
278
277
) : undefined }
279
- { maybeRenderStashLinks ( ) }
278
+ < StashIDs stashIDs = { scene . stash_ids } />
280
279
</ div >
281
280
< TaggerSceneDetails scene = { scene } />
282
281
</ div >
0 commit comments