@moises.ai/design-system 4.20.10 → 4.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. package/dist/index.js +4865 -4378
  2. package/package.json +1 -1
  3. package/src/components/ProjectsList/ProjectItem/ListItems.jsx +106 -0
  4. package/src/components/ProjectsList/ProjectItem/ListItems.module.css +43 -0
  5. package/src/components/ProjectsList/ProjectItem/ProjectItem.jsx +13 -84
  6. package/src/components/ProjectsList/ProjectItem/ProjectItem.module.css +0 -44
  7. package/src/components/ProjectsList/ProjectItemStemSeparation/ListStems.jsx +108 -0
  8. package/src/components/ProjectsList/ProjectItemStemSeparation/ListStems.module.css +43 -0
  9. package/src/components/ProjectsList/ProjectItemStemSeparation/ProjectItemStemSeparation.jsx +153 -0
  10. package/src/components/ProjectsList/ProjectItemStemSeparation/ProjectItemStemSeparation.module.css +68 -0
  11. package/src/components/ProjectsList/ProjectItemStemSeparation/StemSeparationForm.jsx +82 -0
  12. package/src/components/ProjectsList/ProjectItemStemSeparation/StemSeparationForm.module.css +40 -0
  13. package/src/components/ProjectsList/ProjectItemStemSeparation/use-form.js +48 -0
  14. package/src/components/ProjectsList/ProjectItemStemSeparation/utils.js +170 -0
  15. package/src/components/ProjectsList/ProjectTrack/ProjectTrack.jsx +12 -4
  16. package/src/components/ProjectsList/ProjectTrack/ProjectTrack.module.css +6 -2
  17. package/src/components/ProjectsList/ProjectsList.jsx +14 -3
  18. package/src/components/ProjectsList/ProjectsList.stories.jsx +47 -0
  19. package/src/components/ProjectsList/context.js +2 -0
  20. package/src/components/ProjectsList/utils-stories.js +425 -215
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moises.ai/design-system",
3
- "version": "4.20.10",
3
+ "version": "4.21.1",
4
4
  "description": "Design System package based on @radix-ui/themes with custom defaults",
5
5
  "private": false,
6
6
  "type": "module",
@@ -0,0 +1,106 @@
1
+ import { Flex, Text, Separator, Spinner, Button } from '@radix-ui/themes'
2
+ import { Collapsible } from 'radix-ui'
3
+ import { useState, useContext, useCallback, useMemo, useEffect } from 'react'
4
+ import { ArrowLeftIcon, NoMusicIcon, ChevronDownIcon, ChevronUpIcon } from '../../../icons'
5
+ import { ProjectsListContext } from '../context'
6
+ import styles from './ListItems.module.css'
7
+
8
+ const ListItems = ({
9
+ id,
10
+ type,
11
+ tracks: allTracks = [],
12
+ loading = false,
13
+ children,
14
+ labels = {},
15
+ }) => {
16
+ const { onInsertAllTracks, openedItem } = useContext(ProjectsListContext)
17
+ const [showAllTracks, setShowAllTracks] = useState(false)
18
+
19
+ const visibleTracks = useMemo(() => allTracks.slice(0, 6), [allTracks])
20
+ const extraTracks = useMemo(() => allTracks.slice(6), [allTracks])
21
+
22
+ useEffect(() => {
23
+ if (openedItem !== id) {
24
+ setShowAllTracks(false)
25
+ }
26
+ }, [openedItem, id])
27
+
28
+ const handleClickShowAllTracks = useCallback((e) => {
29
+ e.preventDefault()
30
+ e.stopPropagation()
31
+ setShowAllTracks(!showAllTracks)
32
+ }, [showAllTracks])
33
+
34
+ const handleInsertAllTracks = useCallback((e) => {
35
+ e.stopPropagation()
36
+ let tracksFiltered = []
37
+ if (type === 'voice') {
38
+ tracksFiltered = allTracks.filter((track) => !track.loading && track.transfers?.length > 0)
39
+ } else {
40
+ tracksFiltered = allTracks.filter((track) => !track.loading && track.audioUrl)
41
+ }
42
+ onInsertAllTracks?.(tracksFiltered)
43
+ }, [onInsertAllTracks, allTracks, type])
44
+
45
+ return (
46
+ <Collapsible.Root open={openedItem === id} className={styles.tracksCollapsible}>
47
+ <Collapsible.Content className={styles.tracksContent}>
48
+ <Flex direction="column" pt="2">
49
+ {type !== 'voice' && allTracks.length === 0 && !loading && (
50
+ <Flex direction="row" gap="3" p="5" pt="2" align="center" justify="center">
51
+ <NoMusicIcon width={16} height={16} style={{ color: 'var(--neutral-alpha-10)' }} />
52
+ <Text size="2" style={{ color: 'var(--neutral-alpha-10)' }}>{labels.noTracks || 'This file has no tracks'}</Text>
53
+ </Flex>
54
+ )}
55
+
56
+ {loading && (
57
+ <Flex direction="row" gap="3" p="5" align="center" justify="center">
58
+ <Spinner width={16} height={16} style={{ color: 'var(--neutral-alpha-10)' }} />
59
+ <Text size="2" style={{ color: 'var(--neutral-alpha-10)' }}>{labels.loading || 'Loading tracks...'}</Text>
60
+ </Flex>
61
+ )}
62
+
63
+ {allTracks.length > 0 && (
64
+ <Flex direction="column" gap="1">
65
+ {typeof children === 'function' ? (
66
+ <>
67
+ {children({ projectId: id, tracks: visibleTracks })}
68
+ {extraTracks.length > 0 && (
69
+ <Collapsible.Root open={showAllTracks} className={styles.extraTracksCollapsible}>
70
+ <Collapsible.Content className={styles.tracksContent}>
71
+ <Flex direction="column" gap="1" className={styles.extraTracksInner}>
72
+ {children({ projectId: id, tracks: extraTracks })}
73
+ </Flex>
74
+ </Collapsible.Content>
75
+ </Collapsible.Root>
76
+ )}
77
+ </>
78
+ ) : children}
79
+
80
+ <Flex direction="row" gap="3" p="2" align="center" justify="center">
81
+ <Button variant="ghost" color="gray" style={{ flex: '1' }}
82
+ onClick={handleInsertAllTracks}
83
+ >
84
+ <ArrowLeftIcon width={16} height={16} /> {labels.insertAll || 'Insert all'}
85
+ </Button>
86
+
87
+ {allTracks.length > 6 && (
88
+ <>
89
+ <Separator orientation="vertical" />
90
+
91
+ <Button variant="ghost" color="gray" style={{ flex: '1' }} onClick={handleClickShowAllTracks}>
92
+ {showAllTracks ? labels.showLess || 'Show less' : labels.showMore || 'Show more'}
93
+ {showAllTracks ? <ChevronUpIcon width={16} height={16} /> : <ChevronDownIcon width={16} height={16} />}
94
+ </Button>
95
+ </>
96
+ )}
97
+ </Flex>
98
+ </Flex>
99
+ )}
100
+ </Flex>
101
+ </Collapsible.Content>
102
+ </Collapsible.Root>
103
+ )
104
+ }
105
+
106
+ export default ListItems
@@ -0,0 +1,43 @@
1
+ .tracksCollapsible {
2
+ width: 100%;
3
+ }
4
+
5
+ .extraTracksCollapsible {
6
+ width: 100%;
7
+ margin-top: calc(-1 * var(--space-1));
8
+ }
9
+
10
+ .extraTracksInner {
11
+ padding-top: var(--space-1);
12
+ }
13
+
14
+ .tracksContent {
15
+ overflow: hidden;
16
+ width: 100%;
17
+ }
18
+
19
+ .tracksContent[data-state='open'] {
20
+ animation: projectItemSlideDown 0.3s ease;
21
+ }
22
+
23
+ .tracksContent[data-state='closed'] {
24
+ animation: projectItemSlideUp 0.3s ease;
25
+ }
26
+
27
+ @keyframes projectItemSlideDown {
28
+ from {
29
+ height: 0;
30
+ }
31
+ to {
32
+ height: var(--radix-collapsible-content-height);
33
+ }
34
+ }
35
+
36
+ @keyframes projectItemSlideUp {
37
+ from {
38
+ height: var(--radix-collapsible-content-height);
39
+ }
40
+ to {
41
+ height: 0;
42
+ }
43
+ }
@@ -1,9 +1,9 @@
1
- import { Flex, Text, Separator, Spinner, Button } from '@radix-ui/themes'
2
- import { Collapsible } from 'radix-ui'
3
- import { useState, useContext, useCallback, useMemo } from 'react'
4
- import { ArrowLeftIcon, NoMusicIcon, ChevronDownIcon, ChevronUpIcon, InfoIcon } from '../../../icons'
1
+ import { Flex, Text } from '@radix-ui/themes'
2
+ import { useContext, useCallback } from 'react'
3
+ import { InfoIcon } from '../../../icons'
5
4
  import { ProjectsListContext } from '../context'
6
5
  import { ProductsBrandPattern } from '../../ProductsBrandPattern/ProductsBrandPattern'
6
+ import ListItems from './ListItems'
7
7
  import styles from './ProjectItem.module.css'
8
8
 
9
9
  const ProjectItem = ({
@@ -21,15 +21,10 @@ const ProjectItem = ({
21
21
  }) => {
22
22
  const {
23
23
  projects,
24
- onInsertAllTracks,
25
24
  onProjectClick,
26
25
  openedItem,
27
26
  setOpenedItem,
28
27
  } = useContext(ProjectsListContext)
29
- const [showAllTracks, setShowAllTracks] = useState(false)
30
-
31
- const visibleTracks = useMemo(() => allTracks.slice(0, 6), [allTracks])
32
- const extraTracks = useMemo(() => allTracks.slice(6), [allTracks])
33
28
 
34
29
  const handleClickProject = useCallback(() => {
35
30
  if (failed) return
@@ -39,29 +34,11 @@ const ProjectItem = ({
39
34
  setOpenedItem(null)
40
35
  onProjectClick?.(project, false)
41
36
  } else {
42
- setShowAllTracks(false)
43
37
  setOpenedItem(id)
44
38
  onProjectClick?.(project, true)
45
39
  }
46
40
  }, [id, openedItem, setOpenedItem, onProjectClick, projects, failed])
47
41
 
48
- const handleClickShowAllTracks = useCallback((e) => {
49
- e.preventDefault()
50
- e.stopPropagation()
51
- setShowAllTracks(!showAllTracks)
52
- }, [showAllTracks])
53
-
54
- const handleInsertAllTracks = useCallback((e) => {
55
- e.stopPropagation()
56
- let tracksFiltered = []
57
- if (type === 'voice') {
58
- tracksFiltered = allTracks.filter((track) => !track.loading && track.transfers?.length > 0)
59
- } else {
60
- tracksFiltered = allTracks.filter((track) => !track.loading && track.audioUrl)
61
- }
62
- onInsertAllTracks?.(tracksFiltered)
63
- }, [onInsertAllTracks, allTracks, type])
64
-
65
42
  return (
66
43
  <Flex
67
44
  direction="column"
@@ -103,63 +80,15 @@ const ProjectItem = ({
103
80
  </Flex>
104
81
  </Flex>
105
82
 
106
- <Collapsible.Root open={openedItem === id} className={styles.tracksCollapsible}>
107
- <Collapsible.Content className={styles.tracksContent}>
108
- <Flex direction="column" pt="2">
109
- {type !== 'voice' && allTracks.length === 0 && !loading && (
110
- <Flex direction="row" gap="3" p="5" pt="2" align="center" justify="center">
111
- <NoMusicIcon width={16} height={16} style={{ color: 'var(--neutral-alpha-10)' }} />
112
- <Text size="2" style={{ color: 'var(--neutral-alpha-10)' }}>{labels.noTracks || 'This file has no tracks'}</Text>
113
- </Flex>
114
- )}
115
-
116
- {loading && (
117
- <Flex direction="row" gap="3" p="5" align="center" justify="center">
118
- <Spinner width={16} height={16} style={{ color: 'var(--neutral-alpha-10)' }} />
119
- <Text size="2" style={{ color: 'var(--neutral-alpha-10)' }}>{labels.loading || 'Loading tracks...'}</Text>
120
- </Flex>
121
- )}
122
-
123
- {allTracks.length > 0 && (
124
- <Flex direction="column" gap="1">
125
- {typeof children === 'function' ? (
126
- <>
127
- {children({ projectId: id, tracks: visibleTracks })}
128
- {extraTracks.length > 0 && (
129
- <Collapsible.Root open={showAllTracks} className={styles.extraTracksCollapsible}>
130
- <Collapsible.Content className={styles.tracksContent}>
131
- <Flex direction="column" gap="1" className={styles.extraTracksInner}>
132
- {children({ projectId: id, tracks: extraTracks })}
133
- </Flex>
134
- </Collapsible.Content>
135
- </Collapsible.Root>
136
- )}
137
- </>
138
- ) : children}
139
-
140
- <Flex direction="row" gap="3" p="2" align="center" justify="center">
141
- <Button variant="ghost" color="gray" style={{ flex: '1' }}
142
- onClick={handleInsertAllTracks}
143
- >
144
- <ArrowLeftIcon width={16} height={16} /> {labels.insertAll || 'Insert all'}
145
- </Button>
146
-
147
- {allTracks.length > 6 && (
148
- <>
149
- <Separator orientation="vertical" />
150
-
151
- <Button variant="ghost" color="gray" style={{ flex: '1' }} onClick={handleClickShowAllTracks}>
152
- {showAllTracks ? labels.showLess || 'Show less' : labels.showMore || 'Show more'}
153
- {showAllTracks ? <ChevronUpIcon width={16} height={16} /> : <ChevronDownIcon width={16} height={16} />}
154
- </Button>
155
- </>
156
- )}
157
- </Flex>
158
- </Flex>
159
- )}
160
- </Flex>
161
- </Collapsible.Content>
162
- </Collapsible.Root>
83
+ <ListItems
84
+ id={id}
85
+ type={type}
86
+ tracks={allTracks}
87
+ loading={loading}
88
+ labels={labels}
89
+ >
90
+ {children}
91
+ </ListItems>
163
92
  </Flex>
164
93
  )
165
94
  }
@@ -51,47 +51,3 @@
51
51
  background: rgba(216, 244, 246, 0.04);
52
52
  }
53
53
  }
54
-
55
- .tracksCollapsible {
56
- width: 100%;
57
- }
58
-
59
- .extraTracksCollapsible {
60
- width: 100%;
61
- margin-top: calc(-1 * var(--space-1));
62
- }
63
-
64
- .extraTracksInner {
65
- padding-top: var(--space-1);
66
- }
67
-
68
- .tracksContent {
69
- overflow: hidden;
70
- width: 100%;
71
- }
72
-
73
- .tracksContent[data-state='open'] {
74
- animation: projectItemSlideDown 0.3s ease;
75
- }
76
-
77
- .tracksContent[data-state='closed'] {
78
- animation: projectItemSlideUp 0.3s ease;
79
- }
80
-
81
- @keyframes projectItemSlideDown {
82
- from {
83
- height: 0;
84
- }
85
- to {
86
- height: var(--radix-collapsible-content-height);
87
- }
88
- }
89
-
90
- @keyframes projectItemSlideUp {
91
- from {
92
- height: var(--radix-collapsible-content-height);
93
- }
94
- to {
95
- height: 0;
96
- }
97
- }
@@ -0,0 +1,108 @@
1
+ import { Flex, Text, Separator, Spinner, Button } from '@radix-ui/themes'
2
+ import { Collapsible } from 'radix-ui'
3
+ import { useState, useContext, useCallback, useMemo, useEffect } from 'react'
4
+ import { ArrowLeftIcon, NoMusicIcon, ChevronDownIcon, ChevronUpIcon } from '../../../icons'
5
+ import { ProjectsListContext } from '../context'
6
+ import styles from './ListStems.module.css'
7
+
8
+ const ListStems = ({
9
+ id,
10
+ type,
11
+ tracks: allTracks = [],
12
+ loading = false,
13
+ children,
14
+ labels = {},
15
+ open,
16
+ }) => {
17
+ const { onInsertAllTracks, openedItem } = useContext(ProjectsListContext)
18
+ const isOpen = open ?? openedItem === id
19
+ const [showAllTracks, setShowAllTracks] = useState(false)
20
+
21
+ const visibleTracks = useMemo(() => allTracks.slice(0, 6), [allTracks])
22
+ const extraTracks = useMemo(() => allTracks.slice(6), [allTracks])
23
+
24
+ useEffect(() => {
25
+ if (openedItem !== id) {
26
+ setShowAllTracks(false)
27
+ }
28
+ }, [openedItem, id])
29
+
30
+ const handleClickShowAllTracks = useCallback((e) => {
31
+ e.preventDefault()
32
+ e.stopPropagation()
33
+ setShowAllTracks(!showAllTracks)
34
+ }, [showAllTracks])
35
+
36
+ const handleInsertAllTracks = useCallback((e) => {
37
+ e.stopPropagation()
38
+ let tracksFiltered = []
39
+ if (type === 'voice') {
40
+ tracksFiltered = allTracks.filter((track) => !track.loading && track.transfers?.length > 0)
41
+ } else {
42
+ tracksFiltered = allTracks.filter((track) => !track.loading && track.audioUrl)
43
+ }
44
+ onInsertAllTracks?.(tracksFiltered)
45
+ }, [onInsertAllTracks, allTracks, type])
46
+
47
+ return (
48
+ <Collapsible.Root open={isOpen} className={styles.tracksCollapsible}>
49
+ <Collapsible.Content className={styles.tracksContent}>
50
+ <Flex direction="column" pt="2">
51
+ {type !== 'voice' && allTracks.length === 0 && !loading && (
52
+ <Flex direction="row" gap="3" p="5" pt="2" align="center" justify="center">
53
+ <NoMusicIcon width={16} height={16} style={{ color: 'var(--neutral-alpha-10)' }} />
54
+ <Text size="2" style={{ color: 'var(--neutral-alpha-10)' }}>{labels.noTracks || 'This file has no tracks'}</Text>
55
+ </Flex>
56
+ )}
57
+
58
+ {loading && (
59
+ <Flex direction="row" gap="3" p="5" align="center" justify="center">
60
+ <Spinner width={16} height={16} style={{ color: 'var(--neutral-alpha-10)' }} />
61
+ <Text size="2" style={{ color: 'var(--neutral-alpha-10)' }}>{labels.loading || 'Loading tracks...'}</Text>
62
+ </Flex>
63
+ )}
64
+
65
+ {allTracks.length > 0 && (
66
+ <Flex direction="column" gap="1">
67
+ {typeof children === 'function' ? (
68
+ <>
69
+ {children({ projectId: id, tracks: visibleTracks })}
70
+ {extraTracks.length > 0 && (
71
+ <Collapsible.Root open={showAllTracks} className={styles.extraTracksCollapsible}>
72
+ <Collapsible.Content className={styles.tracksContent}>
73
+ <Flex direction="column" gap="1" className={styles.extraTracksInner}>
74
+ {children({ projectId: id, tracks: extraTracks })}
75
+ </Flex>
76
+ </Collapsible.Content>
77
+ </Collapsible.Root>
78
+ )}
79
+ </>
80
+ ) : children}
81
+
82
+ <Flex direction="row" gap="3" p="2" align="center" justify="center">
83
+ <Button variant="ghost" color="gray" style={{ flex: '1' }}
84
+ onClick={handleInsertAllTracks}
85
+ >
86
+ <ArrowLeftIcon width={16} height={16} /> {labels.insertAll || 'Insert all'}
87
+ </Button>
88
+
89
+ {allTracks.length > 6 && (
90
+ <>
91
+ <Separator orientation="vertical" />
92
+
93
+ <Button variant="ghost" color="gray" style={{ flex: '1' }} onClick={handleClickShowAllTracks}>
94
+ {showAllTracks ? labels.showLess || 'Show less' : labels.showMore || 'Show more'}
95
+ {showAllTracks ? <ChevronUpIcon width={16} height={16} /> : <ChevronDownIcon width={16} height={16} />}
96
+ </Button>
97
+ </>
98
+ )}
99
+ </Flex>
100
+ </Flex>
101
+ )}
102
+ </Flex>
103
+ </Collapsible.Content>
104
+ </Collapsible.Root>
105
+ )
106
+ }
107
+
108
+ export default ListStems
@@ -0,0 +1,43 @@
1
+ .tracksCollapsible {
2
+ width: 100%;
3
+ }
4
+
5
+ .extraTracksCollapsible {
6
+ width: 100%;
7
+ margin-top: calc(-1 * var(--space-1));
8
+ }
9
+
10
+ .extraTracksInner {
11
+ padding-top: var(--space-1);
12
+ }
13
+
14
+ .tracksContent {
15
+ overflow: hidden;
16
+ width: 100%;
17
+ }
18
+
19
+ .tracksContent[data-state='open'] {
20
+ animation: projectItemSlideDown 0.3s ease;
21
+ }
22
+
23
+ .tracksContent[data-state='closed'] {
24
+ animation: projectItemSlideUp 0.3s ease;
25
+ }
26
+
27
+ @keyframes projectItemSlideDown {
28
+ from {
29
+ height: 0;
30
+ }
31
+ to {
32
+ height: var(--radix-collapsible-content-height);
33
+ }
34
+ }
35
+
36
+ @keyframes projectItemSlideUp {
37
+ from {
38
+ height: var(--radix-collapsible-content-height);
39
+ }
40
+ to {
41
+ height: 0;
42
+ }
43
+ }
@@ -0,0 +1,153 @@
1
+ import { Flex, Text, Button } from '@radix-ui/themes'
2
+ import { useContext, useCallback, useState, useEffect } from 'react'
3
+ import { InfoIcon } from '../../../icons'
4
+ import { ProjectsListContext } from '../context'
5
+ import { ProductsBrandPattern } from '../../ProductsBrandPattern/ProductsBrandPattern'
6
+ import ListStems from './ListStems'
7
+ import StemSeparationForm from './StemSeparationForm'
8
+ import styles from './ProjectItemStemSeparation.module.css'
9
+
10
+ const ProjectItemStemSeparation = ({
11
+ id,
12
+ title,
13
+ artist,
14
+ cover,
15
+ type,
16
+ tracks: allTracks = [],
17
+ loading = false,
18
+ failed = false,
19
+ children,
20
+ labels = {},
21
+ stemSeparation,
22
+ ...props
23
+ }) => {
24
+ const {
25
+ projects,
26
+ onProjectClick,
27
+ onSubmitStemSeparation,
28
+ openedItem,
29
+ setOpenedItem,
30
+ } = useContext(ProjectsListContext)
31
+ const [isChangingStems, setIsChangingStems] = useState(false)
32
+ const isOpen = openedItem === id
33
+
34
+ useEffect(() => {
35
+ if (!isOpen) {
36
+ setIsChangingStems(false)
37
+ }
38
+ }, [isOpen])
39
+
40
+ const handleClickProject = useCallback(() => {
41
+ if (failed) return
42
+ const project = projects.find((p) => p.id === id)
43
+
44
+ if (openedItem === id) {
45
+ setOpenedItem(null)
46
+ onProjectClick?.(project, false)
47
+ } else {
48
+ setOpenedItem(id)
49
+ onProjectClick?.(project, true)
50
+ }
51
+ }, [id, openedItem, setOpenedItem, onProjectClick, projects, failed])
52
+
53
+ const handleToggleChangeStems = useCallback((e) => {
54
+ e.stopPropagation()
55
+ setIsChangingStems((current) => !current)
56
+ }, [])
57
+
58
+ return (
59
+ <Flex
60
+ direction="column"
61
+ p="1"
62
+ className={`${styles.item} ${openedItem === id ? styles.opened : ''} ${failed ? styles.failed : ''}`}
63
+ onClick={handleClickProject}
64
+ {...props}
65
+ >
66
+ <Flex direction="row" gap="3">
67
+ <Flex className={styles.projectCover}>
68
+ <ProductsBrandPattern type={type} cover={cover} title={title} size="48px" />
69
+ </Flex>
70
+
71
+ <Flex
72
+ direction="row"
73
+ gap="1"
74
+ align="start"
75
+ justify="center"
76
+ style={{ flex: 1, minWidth: 0 }}
77
+ >
78
+ <Flex
79
+ direction="column"
80
+ gap="1"
81
+ align="start"
82
+ justify="center"
83
+ height="100%"
84
+ style={{ flex: 1, minWidth: 0 }}
85
+ >
86
+ <Text size="2" asChild>
87
+ <span className={styles.projectTitle}>
88
+ {title}
89
+ </span>
90
+ </Text>
91
+
92
+ {failed ? (
93
+ <Flex size="1" gap="1" className={styles.projectFailed}>
94
+ <InfoIcon width={16} height={16} />
95
+ <Text size="1">Failed</Text>
96
+ </Flex>
97
+ ) : artist && (
98
+ <Text size="1" asChild>
99
+ <span className={styles.projectArtist}>
100
+ {artist}
101
+ </span>
102
+ </Text>
103
+ )}
104
+ </Flex>
105
+
106
+ <Flex
107
+ direction="column"
108
+ pt="1"
109
+ pr="1"
110
+ className={`${styles.changeStems} ${isChangingStems ? styles.changeStemsVisible : ''}`}
111
+ >
112
+ {isOpen ? (
113
+ <Button
114
+ variant="soft"
115
+ color="gray"
116
+ size="1"
117
+ onClick={handleToggleChangeStems}
118
+ style={{ minWidth: 101 }}
119
+ >
120
+ {isChangingStems
121
+ ? (labels.cancel || 'Cancel')
122
+ : (labels.changeStems || 'Change Stems')}
123
+ </Button>
124
+ ) : null}
125
+ </Flex>
126
+ </Flex>
127
+ </Flex>
128
+
129
+ <StemSeparationForm
130
+ id={id}
131
+ project={projects.find((p) => p.id === id)}
132
+ open={isOpen && isChangingStems}
133
+ selected={stemSeparation.selected}
134
+ options={stemSeparation.options}
135
+ onSubmit={onSubmitStemSeparation}
136
+ setIsChangingStems={setIsChangingStems}
137
+ />
138
+
139
+ <ListStems
140
+ id={id}
141
+ type={type}
142
+ tracks={allTracks}
143
+ loading={loading}
144
+ labels={labels}
145
+ open={isOpen && !isChangingStems}
146
+ >
147
+ {children}
148
+ </ListStems>
149
+ </Flex>
150
+ )
151
+ }
152
+
153
+ export default ProjectItemStemSeparation