-
Notifications
You must be signed in to change notification settings - Fork 0
/
detailsview.js
49 lines (45 loc) · 2.22 KB
/
detailsview.js
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
/*
LiveG APT Repository
Copyright (C) LiveG. All Rights Reserved.
https://opensource.liveg.tech/liveg-apt
Licensed by the LiveG Open-Source Licence, which can be found at LICENCE.md.
*/
import * as astronaut from "https://opensource.liveg.tech/Adapt-UI/astronaut/astronaut.js";
import * as sizeUnits from "https://opensource.liveg.tech/Adapt-UI/src/sizeunits.js";
export var DetailsViewScreen = astronaut.component("DetailsViewScreen", function(props, children) {
return Screen (
Header (
IconButton({icon: "back", alt: _("back"), attributes: {"aui-bind": "back"}}) (),
CodeSnippet() (props.Package)
),
Page(true) (
Section (
Heading(1) (CodeSnippet() (props.Package)),
PropertyList (
Property (Text(_("details_version")), Text(props.Version)),
Property (Text(_("details_arch")), CodeSnippet() (props.Architecture)),
Property (Text(_("details_size")), Text(sizeUnits.getString(props.Size, _))),
Property (
Text(_("details_website")),
props.Homepage ? Link(props.Homepage, true) (props.Homepage.match(/(?:[a-zA-Z0-9-]+:\/\/\/?)?([^?]+)(?:\?.*)?/)[1]) : Text(_("details_website_none"))
),
Property (
Text(_("details_downloadLink")),
Link({source: props.Filename, download: props.Filename.match(/([^\/]+.deb)$/)[1]}) (`opensource.liveg.tech/${props.Filename.replace(/^\.\//, "")}`)
)
),
Paragraph({attributes: {"aui-select": true}}) (
BoldTextFragment() (props.Description.split("\n")[0])
),
// For description, split by paragraph for double line breaks only
...props.Description
.split("\n")
.slice(1) // Skip short description line
.map((line) => line.trim() == "" ? "\n" : line)
.join(" ")
.split("\n")
.map((line) => Paragraph({attributes: {"aui-select": true}}) (line))
)
)
);
});