Skip to content

Commit b49c51f

Browse files
committed
featured
1 parent 3241aab commit b49c51f

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

src/models/FeaturedApp.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export default class FeaturedApp {
2+
constructor(){
3+
this.applink = '';
4+
this.img = '';
5+
this.name = '';
6+
this.text = '';
7+
this.colors = null;
8+
}
9+
10+
static placeholder(){ return new FeaturedApp(); }
11+
static fromJson(json){
12+
return Object.assign(this.placeholder(), json);
13+
}
14+
}

src/routes.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ routes.get('/apps', async (req, res) => {
220220
returnResult(apps, req, res);
221221
});
222222

223+
routes.get('/apps/featured', async (req, res) => {
224+
returnResult(await AppService.getFeatured(), req, res);
225+
});
226+
223227
routes.post('/apps', async (req, res) => {
224228
const {apps} = req.body;
225229
let allApps = await AppService.getApps();

src/services/AppService.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import "isomorphic-fetch"
22
import config from '../util/config'
33
import app from "../app";
44
import {flattenBlockchainObject} from "../util/blockchains";
5+
import FeaturedApp from "../models/FeaturedApp";
56

67
// Once every 30 minutes.
78
const intervalTime = 60000 * 30;
@@ -75,4 +76,42 @@ export default class AppService {
7576
])
7677
}
7778

79+
static getFeatured(){
80+
// TODO: Hardcoded for now
81+
return [
82+
FeaturedApp.fromJson({
83+
applink:'bluebet.one',
84+
img:'https://images.unsplash.com/photo-1517232115160-ff93364542dd?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1266&q=80',
85+
name:'BlueBet',
86+
text:'Poker, Baccarat, Black Jack, Powerball.',
87+
colors:{
88+
overlays:'#000',
89+
text:'#000',
90+
button:{
91+
color:'#000',
92+
background:'#fff',
93+
border:'#000'
94+
},
95+
96+
}
97+
}),
98+
FeaturedApp.fromJson({
99+
applink:'decentium.org',
100+
img:'https://images.unsplash.com/photo-1484914440268-8d352fe4db95?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80',
101+
name:'Decentium',
102+
text:'Decentium is a decentralized publishing and tipping platform where authors own their content and earn money and exposure through endorsements.',
103+
colors:{
104+
overlays:'#fff',
105+
text:'#fff',
106+
button:{
107+
color:'#fff',
108+
background:'transparent',
109+
border:'#fff'
110+
},
111+
112+
}
113+
})
114+
]
115+
}
116+
78117
}

0 commit comments

Comments
 (0)