Skip to content

Commit f0e3e3c

Browse files
authored
add about box (#286)
1 parent 168df33 commit f0e3e3c

File tree

5 files changed

+105
-1
lines changed

5 files changed

+105
-1
lines changed

docs/change-log.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- Fix 1px border in compact mode
44
- Do not fail when configured music directory does not exist
55
- Replace invalid UTF-8 chars in JSON responses instead of failing
6+
- Add about box in web UI
67
### DeaDBeeF
78
- Raise minimal API version to v1.10 (corresponds to DeaDBeeF v1.8.0)
89
- Add support for artwork plugin v2 (used since DeaDBeeF v1.9)

js/webui/src/about_box.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import React from 'react'
2+
import ServiceContext from './service_context.js';
3+
import ModelBinding from './model_binding.js';
4+
5+
class AboutBox_ extends React.PureComponent
6+
{
7+
static contextType = ServiceContext;
8+
9+
constructor(props, context)
10+
{
11+
super(props, context);
12+
13+
this.state = this.getStateFromModel();
14+
}
15+
16+
getStateFromModel()
17+
{
18+
const { title, version, pluginVersion } = this.context.playerModel.info;
19+
return { title, version, pluginVersion };
20+
}
21+
22+
render()
23+
{
24+
const { title, version, pluginVersion } = this.state;
25+
26+
return (
27+
<div className='about-box'>
28+
<p>
29+
Beefweb v{pluginVersion} @ {title} v{version}
30+
</p>
31+
<p>
32+
<a href='https://hyperblast.org/donate/' className='about-box-link' target='_blank'>Donate to author</a>
33+
<a href='third-party-licenses.txt' className='about-box-link' target='_blank'>Third-party licenses</a>
34+
<a href='https://hyperblast.org/beefweb/api/' className='about-box-link' target='_blank'>API documentation</a>
35+
</p>
36+
<p className='license-text'>
37+
Copyright 2015-2024 Hyperblast<br/><br/>
38+
39+
Permission is hereby granted, free of charge, to any person obtaining a copy
40+
of this software and associated documentation files (the "Software"), to deal
41+
in the Software without restriction, including without limitation the rights
42+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43+
copies of the Software, and to permit persons to whom the Software is
44+
furnished to do so, subject to the following conditions:<br/><br/>
45+
46+
The above copyright notice and this permission notice shall be included in
47+
all copies or substantial portions of the Software.<br/><br/>
48+
49+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
55+
THE SOFTWARE.
56+
</p>
57+
</div>
58+
);
59+
}
60+
}
61+
62+
export default ModelBinding(AboutBox_, { playerModel: 'change'});

js/webui/src/navigation_model.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ export const View = Object.freeze({
1010

1111
export const SettingsView = Object.freeze({
1212
general: 'general',
13-
columns: 'columns'
13+
columns: 'columns',
14+
about: 'about',
1415
});
1516

1617
export const SettingsViewMetadata = [
@@ -22,6 +23,10 @@ export const SettingsViewMetadata = [
2223
key: SettingsView.columns,
2324
title: 'Columns',
2425
},
26+
{
27+
key: SettingsView.about,
28+
title: 'About'
29+
}
2530
];
2631

2732
export default class NavigationModel extends EventEmitter

js/webui/src/settings_content.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import ModelBinding from './model_binding.js';
44
import GeneralSettings from './general_settings.js';
55
import ColumnsSettings from './columns_settings.js';
66
import ServiceContext from './service_context.js';
7+
import AboutBox from './about_box.js';
78

89
class SettingsContent extends React.PureComponent
910
{
@@ -17,6 +18,7 @@ class SettingsContent extends React.PureComponent
1718
this.renderView = {
1819
[SettingsView.general]: this.renderGeneral,
1920
[SettingsView.columns]: this.renderColumns,
21+
[SettingsView.about]: this.renderAbout,
2022
};
2123
}
2224

@@ -36,6 +38,11 @@ class SettingsContent extends React.PureComponent
3638
return <ColumnsSettings columnsSettingsModel={this.context.columnsSettingsModel} />;
3739
}
3840

41+
renderAbout()
42+
{
43+
return <AboutBox />;
44+
}
45+
3946
render()
4047
{
4148
const { settingsView } = this.state;

js/webui/src/style.less

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ body {
100100
--color-shadow: rgba(189, 189, 189, 0.7);
101101
--color-play-button: #006600;
102102
--color-stop-button: #b30000;
103+
--color-link: #0000F0;
103104
}
104105

105106
.st-uitheme-dark {
@@ -111,6 +112,7 @@ body {
111112
--color-shadow: rgba(0, 0, 0, 0.7);
112113
--color-play-button: #00aa00;
113114
--color-stop-button: #e30000;
115+
--color-link: #ebf0ea;
114116
}
115117

116118
/* Elements */
@@ -734,6 +736,33 @@ body {
734736
.input-element();
735737
}
736738

739+
.about-box {
740+
max-width: 40rem;
741+
}
742+
743+
.about-box-link {
744+
margin-right: 1rem;
745+
text-decoration: underline;
746+
text-wrap: nowrap;
747+
display: inline-block;
748+
padding: 0.5rem 0;
749+
750+
color: var(--color-link);
751+
752+
&:hover {
753+
color: var(--color-link);
754+
}
755+
756+
&:visited {
757+
color: var(--color-link);
758+
}
759+
}
760+
761+
.license-text {
762+
font-family: monospace;
763+
font-size: 110%;
764+
}
765+
737766
.st-mediasize-medium-up {
738767
.settings-form {
739768
display: grid;

0 commit comments

Comments
 (0)