-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdetails.tsx
More file actions
112 lines (109 loc) · 4.19 KB
/
Copy pathdetails.tsx
File metadata and controls
112 lines (109 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import styles from '../styles/components/details.module.css';
import { getBasePath } from '../lib/path';
import Crumb from './crumb';
import { timeSince } from '../lib/utils';
import Audio from './audio';
import Player from './player';
import Dependency from './dependency';
import Downloads from './download';
import Code from './code';
import { licenses, PackageFileMap, PackageInterface, PackageVersion, RegistryType } from '@open-audio-stack/core';
type DetailsProps = {
downloads: PackageFileMap;
pkg: PackageInterface;
pkgVersion: PackageVersion;
type: RegistryType;
};
const Details = ({ downloads, pkg, pkgVersion, type }: DetailsProps) => (
<article>
<div className={styles.header}>
<div className={styles.headerInner2}>
<Crumb items={[type, pkg.slug.split('/')[0], pkg.slug.split('/')[1]]}></Crumb>
</div>
<div className={styles.headerInner}>
<div className={styles.media}>
<div className={styles.imageContainer}>
{pkgVersion.audio ? <Audio file={pkgVersion.audio} /> : ''}
{pkgVersion.tags.includes('sfz') ? <Player plugin={pkgVersion} /> : ''}
{pkgVersion.image ? (
<img className={styles.image} src={pkgVersion.image} alt={pkgVersion.name || ''} />
) : (
''
)}
</div>
</div>
<div className={styles.details}>
<h3 className={styles.title}>
{pkgVersion.name || ''} <span className={styles.version}>v{pkg.version}</span>
</h3>
<p className={styles.author}>
By{' '}
<a href={pkgVersion.url} target="_blank">
{pkgVersion.author}
</a>
</p>
<p>
{pkgVersion.description}
<Dependency plugin={pkgVersion} />
</p>
<div className={styles.metadataList}>
{/* <div className={styles.metadata}><img className={styles.icon} src={`${getBasePath()}/images/icon-filesize.svg`} alt="Filesize" loading="lazy" /> {formatBytes(plugin.files.linux.size)}</div> */}
<div className={styles.metadata}>
<img
className={styles.icon}
src={`${getBasePath()}/images/icon-date.svg`}
alt="Date updated"
loading="lazy"
/>{' '}
{timeSince(pkgVersion.date)} ago
</div>
<div className={styles.metadata}>
<img
className={styles.icon}
src={`${getBasePath()}/images/icon-license.svg`}
alt="License"
loading="lazy"
/>{' '}
{pkgVersion.license ? (
<a href={`https://choosealicense.com/licenses/${pkgVersion.license}`} target="_blank">
{licenses.filter(license => pkgVersion.license === license.value)[0].name}
</a>
) : (
'none'
)}
</div>
<div className={styles.metadata}>
<img className={styles.icon} src={`${getBasePath()}/images/icon-tag.svg`} alt="Tags" loading="lazy" />
<ul className={styles.tags}>
{pkgVersion.tags.map((tag: string, tagIndex: number) => (
<li className={styles.tag} key={`${tag}-${tagIndex}`}>
{tag}
{tagIndex !== pkgVersion.tags.length - 1 ? ',' : ''}
</li>
))}
</ul>
</div>
<div className={styles.metadataFooter}>
<a href={pkgVersion.url} target="_blank">
<button className="button button-clear">View source</button>
</a>
{pkgVersion.donate ? (
<a href={pkgVersion.donate} target="_blank">
<button className="button button-clear">Donate</button>
</a>
) : ''}
</div>
</div>
</div>
</div>
</div>
<div id="sfzPlayer"></div>
<div className={styles.options}>
<div className={styles.row}>
<Downloads downloads={downloads} />
<Code pkg={pkg} pkgVersion={pkgVersion} />
</div>
</div>
</article>
);
export default Details;