Skip to content

Commit 9dbea84

Browse files
committed
Add settings page
1 parent ed4a076 commit 9dbea84

6 files changed

Lines changed: 92 additions & 137 deletions

File tree

src/App.css

Lines changed: 0 additions & 42 deletions
This file was deleted.

src/App.tsx

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
1-
import LBRY from "./LBRY";
2-
import './App.css';
1+
import {JSX} from "react";
32
import {Link} from "react-router";
43

4+
import LBRY from "./LBRY";
5+
56
const notTags = ["porn","porno","nsfw","mature","xxx","sex","creampie","blowjob","handjob","vagina","boobs","big boobs","big dick","pussy","cumshot","anal","hard fucking","ass","fuck","hentai"];
67

7-
function App() {
8+
function App(): JSX.Element {
89
LBRY.rpc('claim_search',{"page_size":4,"claim_type":["stream","repost","channel"],"no_totals":true,"any_tags":[],"not_tags":notTags,"channel_ids":["80d2590ad04e36fb1d077a9b9e3a8bba76defdf8","b58dfaeab6c70754d792cdd9b56ff59b90aea334"],"not_channel_ids":[],"order_by":["release_time"],"has_source":true,"release_time":">1731193200","include_purchase_receipt":true}).then(json => {
10+
document.getElementById('row-1').innerHTML = '';
911
json.result.items.forEach((item: object): void => {
1012
document.getElementById('row-1').innerHTML += '<div style="border:1px solid red;display:inline-block;max-width:200px;"><img alt="Thumbnail" src="'+(item.value?.thumbnail?.url || item.reposted_claim?.value?.thumbnail?.url)+'" style="height:100px;"><br>'+(item.value?.title || item.reposted_claim?.value?.title)+'</div>';
1113
});
1214
document.getElementById('row-1').innerHTML += '<br>-------<br>';
1315
});
1416

1517
LBRY.rpc('claim_search',{"page_size":4,"claim_type":["stream"],"no_totals":true,"any_tags":[],"not_tags":notTags,"channel_ids":[],"not_channel_ids":[],"order_by":["effective_amount"],"has_source":true,"release_time":">1762902000","limit_claims_per_channel":2,"include_purchase_receipt":true}).then(json => {
18+
document.getElementById('row-2').innerHTML = '';
1619
json.result.items.forEach((item: object): void => {
1720
document.getElementById('row-2').innerHTML += '<div style="border:1px solid red;display:inline-block;max-width:200px;"><img alt="Thumbnail" src="'+(item.value?.thumbnail?.url || item.reposted_claim?.value?.thumbnail?.url)+'" style="height:100px;"><br>'+(item.value?.title || item.reposted_claim?.value?.title)+'</div>';
1821
});
1922
document.getElementById('row-2').innerHTML += '<br>-------<br>';
2023
});
2124

2225
LBRY.rpc('claim_search',{"page_size":4,"claim_type":["stream","repost","channel"],"no_totals":true,"any_tags":[],"not_tags":notTags,"channel_ids":["3fda836a92faaceedfe398225fb9b2ee2ed1f01a"],"not_channel_ids":[],"order_by":["release_time"],"has_source":true,"include_purchase_receipt":true}).then(json => {
26+
document.getElementById('row-3').innerHTML = '';
2327
json.result.items.forEach((item: object): void => {
2428
document.getElementById('row-3').innerHTML += '<div style="border:1px solid red;display:inline-block;max-width:200px;"><img alt="Thumbnail" src="'+(item.value?.thumbnail?.url || item.reposted_claim?.value?.thumbnail?.url)+'" style="height:100px;"><br>'+(item.value?.title || item.reposted_claim?.value?.title)+'</div>';
2529
});
@@ -28,18 +32,6 @@ function App() {
2832

2933
return (
3034
<>
31-
<div>
32-
<a href="/">SLASH</a>
33-
|
34-
<a href="/about">SLASH ABOUT</a>
35-
</div>
36-
<hr/>
37-
<div>
38-
<Link to="/">SLASH 2</Link>
39-
|
40-
<Link to="/about">SLASH ABOUT 2</Link>
41-
</div>
42-
<hr/>
4335
<div id="row-1"></div>
4436
<hr/>
4537
<div id="row-2"></div>

src/SettingsPage.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import LBRY from "./LBRY";
2+
3+
function SettingsPage(){
4+
LBRY.rpc('settings_get').then(json => {
5+
if(json.error){
6+
document.getElementById('settings').innerHTML = json.error.message;
7+
return;
8+
}
9+
document.getElementById('settings').innerHTML = '';
10+
json.result.items.forEach((item: object): void => {
11+
document.getElementById('settings').innerHTML += '<div style="border:1px solid red;display:inline-block;max-width:200px;"><img alt="Thumbnail" src="'+(item.value?.thumbnail?.url || item.reposted_claim?.value?.thumbnail?.url)+'" style="height:100px;"><br>'+(item.value?.title || item.reposted_claim?.value?.title)+'</div>';
12+
});
13+
});
14+
15+
return (
16+
<>
17+
<h1>Settings</h1>
18+
<div id="settings"></div>
19+
</>
20+
);
21+
}
22+
23+
export default SettingsPage;

src/index.css

Lines changed: 0 additions & 68 deletions
This file was deleted.

src/main.css

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
html,body{
2+
margin:0;
3+
font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
4+
}
5+
6+
header{
7+
background:rgba(17,17,17,0.9);
8+
height:60px;
9+
position:sticky;
10+
top:0;
11+
}
12+
13+
header #header-name{
14+
color:white;
15+
float:left;
16+
font-size:20px;
17+
line-height:60px;
18+
padding:0 16px;
19+
}
20+
21+
header #header-settings{
22+
float:right;
23+
line-height:60px;
24+
padding:0 16px;
25+
}
26+
27+
main{
28+
margin:16px;
29+
}
30+
31+
footer{
32+
background:rgba(17,17,17,0.9);
33+
color:white;
34+
padding:8px;
35+
text-align:center;
36+
}

src/main.tsx

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,37 @@
11
import {StrictMode} from 'react';
22
import {createRoot, Root} from 'react-dom/client';
3-
import {Route, Routes} from 'react-router';
3+
import {Link, Route, Routes} from 'react-router';
44

55
import App from './App';
66
import AppRouter from './AppRouter';
77
import NotFound from './NotFound';
8-
import './index.css';
8+
9+
import './main.css';
10+
import SettingsPage from "./SettingsPage";
911

1012
const root: Root = createRoot(document.getElementById('root'));
1113

1214
root.render(
13-
<StrictMode>
14-
<header>LBRY Web</header>
15-
<AppRouter>
16-
<Routes>
17-
<Route index path="/" element={<App/>}/>
18-
<Route index path="/about" element={<App/>}/>
19-
<Route path="*" element={<NotFound/>}/>
20-
</Routes>
21-
</AppRouter>
22-
</StrictMode>
15+
<StrictMode>
16+
<AppRouter>
17+
<header>
18+
<Link to="/" id="header-name">
19+
<b>LBRY Web</b>
20+
</Link>
21+
<Link to="/settings" id="header-settings">
22+
<button>Settings</button>
23+
</Link>
24+
{/*<div id="header-settings"><b>LBRY Web</b></div>*/}
25+
</header>
26+
<main>
27+
<Routes>
28+
<Route index path="/" element={<App/>}/>
29+
<Route path="/about" element={<App/>}/>
30+
<Route path="/settings" element={<SettingsPage/>}/>
31+
<Route path="*" element={<NotFound/>}/>
32+
</Routes>
33+
</main>
34+
<footer>&copy; {new Date().getFullYear().toString()} LBRY Foundation</footer>
35+
</AppRouter>
36+
</StrictMode>
2337
);

0 commit comments

Comments
 (0)