Commit e17f2ddb authored by 2breakegg's avatar 2breakegg

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	app/app-detail.component.html
#	app/roster.component.html
parents ce4419cd b40a9d87
......@@ -75,10 +75,8 @@
<div class="d-flex">
<div class="panel" id="game_info">
<p [innerHTML]="currentApp.description"></p>
<div id="tags">
<div class="btn btn-xs btn-danger" style="padding:3px 10px; margin:2px">弹幕</div>
<div class="btn btn-xs btn-danger" style="padding:3px 10px; margin:2px">射击</div>
<div class="btn btn-xs btn-danger" style="padding:3px 10px; margin:2px">单机</div>
<div id="tags" *ngIf="currentApp.tags">
<div *ngFor="let tag of currentApp.tags" class="btn btn-xs btn-danger" style="padding:3px 10px; margin:2px">{{tags[tag] || tag}}</div>
</div>
</div>
<div class="panel" id="game_info_2">
......@@ -143,7 +141,7 @@
<h2 i18n>新闻</h2>
<div id="news" *ngFor="let item of news">
<h3>{{item.title}}</h3>
<span>2017-01-18</span>
<span>{{item.updated_at | date:'shortDate'}}</span>
<p>{{item.text}}</p>
<a i18n *ngIf="item.url" [href]="item.url" target="_blank">了解更多</a>
</div>
......
......@@ -40,9 +40,25 @@ export class AppDetailComponent implements OnInit, OnChanges {
points: Points;
tags: {};
constructor(private appsService: AppsService, private settingsService: SettingsService,
private downloadService: DownloadService, private ref: ChangeDetectorRef, private el: ElementRef,
private http: Http) {
this.tags = this.settingsService.getLocale().startsWith('zh') ? {
'recommend': '推荐',
'mysterious': '迷之物体',
'touhou': '东方 Project',
'touhou-pc98': '东方旧作',
'language': '语言包'
} : {
'recommend': 'Recommended',
'mysterious': 'Something',
'touhou': 'Touhou Project',
'touhou-pc98': 'Touhou old series',
'language': 'Language Pack'
};
}
async ngOnChanges(changes: SimpleChanges) {
......
......@@ -55,6 +55,8 @@ export class App {
description: string; // i18n
author: string; // English Only
homepage: string;
developers: {name: string, url: string}[];
released_at: Date;
category: Category;
parent?: App;
......@@ -62,7 +64,7 @@ export class App {
references: Map<string, App>;
dependencies: Map<string, App>;
locales: string[];
news: {title: string, url: string, image: string}[];
news: {title: string, url: string, image: string, updated_at: Date}[];
network: any;
tags: string[];
version: string;
......@@ -154,6 +156,8 @@ export class App {
this.id = app.id;
this.name = app.name;
this.description = app.description;
this.developers = app.developers;
this.released_at = app.released_at;
this.author = app.author;
this.homepage = app.homepage;
this.category = Category[app.category as string];
......
......@@ -239,13 +239,9 @@ export class AppsService {
}
// 去除无关语言
for (let key of ['name', 'description', 'news']) {
for (let key of ['name', 'description', 'news', 'developers', 'publishers']) {
if (app[key]) {
let value = app[key][locale];
if (!value) {
value = app[key]['zh-CN'];
}
app[key] = value;
app[key] = app[key][locale] || app[key]['zh-CN'] || Object.values(app[key])[0];
}
}
......@@ -259,6 +255,17 @@ export class AppsService {
}
}
}
// 时间
if (app.released_at) {
app.released_at = new Date(app.released_at);
}
if (app.news) {
for (let item of app.news) {
item.updated_at = new Date(item.updated_at);
}
}
apps.set(item.id, app);
}
......@@ -418,7 +425,7 @@ export class AppsService {
});
}
async verifyFiles (app: App, checksumFiles: Map<string, string>, callback: () => void): Promise<Map<string, string>> {
async verifyFiles(app: App, checksumFiles: Map<string, string>, callback: () => void): Promise<Map<string, string>> {
let result = new Map<string, string>();
for (let [file, checksum] of checksumFiles) {
let filePath = path.join(app.local!.path, file);
......@@ -662,7 +669,7 @@ export class AppsService {
}
await this.doInstall(task);
};
const addDownloadTask = async (_app: App, dir: string): Promise<{app: App, files: string[]} > => {
const addDownloadTask = async(_app: App, dir: string): Promise<{app: App, files: string[]} > => {
let locale = this.settingsService.getLocale();
if (!['zh-CN', 'en-US', 'ja-JP'].includes(locale)) {
locale = 'en-US';
......@@ -1147,7 +1154,7 @@ export class AppsService {
}
}
async getChecksumFile (app: App): Promise<Map<string, string> > {
async getChecksumFile(app: App): Promise<Map<string, string> > {
let locale = this.settingsService.getLocale();
if (!['zh-CN', 'en-US', 'ja-JP'].includes(locale)) {
......
......@@ -284,12 +284,20 @@ export class CandyComponent implements OnInit, OnChanges {
Candy.Core.connect(this.jid, this.password, this.nickname);
// $(Candy).on('candy:core.chat.connection', (event: any, args: any) => {
// if (args.status === Strophe.Status.CONNECTED) {
// Candy.Core.Action.Jabber.Roster();
// Candy.Core.getConnection().send($iq({type: 'get'}).c('vCard', {xmlns: 'vcard-temp'}).tree());
// }
// $(Candy).on('candy:core:roster:loaded', (event: JQueryEventObject, data: any) => {
// this.roster = Object.values(data.roster.getAll());
// });
// $(Candy).on('candy:core:roster:fetched', (event: JQueryEventObject, data: any) => {
// this.roster = Object.values(data.roster.getAll());
// });
// $(Candy).on('candy:core:roster:removed', (event: JQueryEventObject, data: any) => {
// this.roster = Object.values(Candy.Core.getRoster().getAll());
// });
// $(Candy).on('candy:core:roster:added', (event: JQueryEventObject, data: any) => {
// this.roster = Object.values(Candy.Core.getRoster().getAll());
// });
// $(Candy).on('candy:core:roster:updated', (event: JQueryEventObject, data: any) => {
// this.roster = Object.values(Candy.Core.getRoster().getAll());
// });
}
......
......@@ -76,7 +76,7 @@
<div id="right">
<div id="main">
<app-detail class="scroll" *ngIf="currentApp" [currentApp]="currentApp"></app-detail>
<roster class="scroll"></roster>
<!--<roster class="scroll"></roster>-->
</div>
<div id="candy-wrapper" class="resize-wrapper resize-top" style="max-height: calc( 100% - 180px )">
......
#friend_list>ul>li>div>p{
font-size:12px;
padding:3px 5px;
margin:0;
cursor:default;
:host {
position: fixed;
top: 0;
right: 0;
background: white;
}
#friend_list>ul>li>img{
border-radius:25.5px;
}
#friend_list > ul > li > div > p {
font-size: 12px;
padding: 3px 5px;
margin: 0;
cursor: default;
}
#friend_list>ul>li{
padding:3px;
list-style-type:none;
position:relative;
#friend_list > ul > li > img {
border-radius: 25.5px;
}
#friend_list>ul>li:hover{
padding:3px;
list-style-type:none;
position:relative;
background:#aaa;
#friend_list > ul > li {
padding: 3px;
list-style-type: none;
position: relative;
}
#friend_list>ul>li>i{
position:absolute;
top:38px;
left:38px;
#friend_list > ul > li:hover {
padding: 3px;
list-style-type: none;
position: relative;
background: #aaa;
}
#friend_list>ul{
padding:0;
#friend_list > ul > li > i {
position: absolute;
top: 38px;
left: 38px;
}
.fl{float:left;}
#friend_list > ul {
padding: 0;
}
#friend_list i{font-size:10px;}
.fl {
float: left;
}
.red{color:red;}
#friend_list i {
font-size: 10px;
}
.red {
color: red;
}
.green_light {
color: #8f8;
}
.red_light {
color: #f88;
}
.grey {
color: grey;
}
.green_light{color:#8f8;}
.red_light{color:#f88;}
.grey{color:grey;}
.blue_light{color:#88f;}
\ No newline at end of file
.blue_light {
color: #88f;
}
\ No newline at end of file
<!--<link href="roster.component.css" type="text/css" rel="stylesheet">-->
<!--<link rel="stylesheet" href="../node_modules/font-awesome/css/font-awesome.min.css">-->
<!--<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.min.css">-->
<!--<script src="../node_modules/core-js/client/shim.min.js"></script>-->
<!--<link href="roster.component.css" type="text/css" rel="stylesheet">--><!--<link rel="stylesheet" href="../node_modules/font-awesome/css/font-awesome.min.css">--><!--<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.min.css">--><!--<script src="../node_modules/core-js/client/shim.min.js"></script>-->
<!--<script src="../node_modules/zone.js/dist/zone.js"></script>-->
<!--<script src="../node_modules/reflect-metadata/Reflect.js"></script>-->
<!--<script src="../node_modules/systemjs/dist/system.src.js"></script>-->
<!--<script src="../node_modules/zone.js/dist/zone.js"></script>--><!--<script src="../node_modules/reflect-metadata/Reflect.js"></script>--><!--<script src="../node_modules/systemjs/dist/system.src.js"></script>-->
<!--<script src="../systemjs.config.js"></script>-->
<div>
<div class="input-group" id="friend_search">
<div class="input-group ">
<i class="fa fa-search input-group-addon search" id="basic-addon1"></i>
<input type="text" class="form-control" aria-label="Amount (to the nearest dollar)">
<!--<span class="input-group-addon">+</span>-->
<button type="button" class="input-group-addon btn btn-sm btn-primary blue_light">+</button>
</div>
</div>
<!--<div>-->
<!--<div class="input-group" id="friend_search">-->
<!--<div class="input-group ">-->
<!--<i class="fa fa-search input-group-addon search" id="basic-addon1"></i>-->
<!--<input type="text" class="form-control" aria-label="Amount (to the nearest dollar)">-->
<!--&lt;!&ndash;<span class="input-group-addon">+</span>&ndash;&gt;-->
<!--<button type="button" class="input-group-addon btn btn-sm btn-primary blue_light">+</button>-->
<!--</div>-->
<!--</div>-->
<div id="friend_list">
<ul>
<li>
<img class="fl" src="https://ygobbs.com//letter_avatar_proxy/v2/letter/q/cdc98d/45.png">
<i class="fa fa-circle green_light"></i>
<div class="fl">
<p>我叫什么名来着</p>
<p>发呆ing</p>
</div>
<div style="clear: both"></div>
</li>
<!--<div id="friend_list">-->
<!--<ul>-->
<!--<li *ngFor="let contact of roster">-->
<!--<img class="fl" src="https://ygobbs.com//letter_avatar_proxy/v2/letter/q/cdc98d/45.png">-->
<!--<i class="fa fa-circle green_light"></i>-->
<!--<div class="fl">-->
<!--<p>{{contact.getName()}}</p>-->
<!--<p *ngIf="contact.getSubscription() != 'both'">等待确认</p>-->
<!--<p *ngIf="contact.getSubscription() == 'both'">{{contact.getStatus()}}</p>-->
<li>
<img class="fl" src="https://ygobbs.com/user_avatar/ygobbs.com/sky%E7%A5%9E%E6%99%BA/45/16501_1.png">
<i class="fa fa-play-circle red_light"></i>
<div class="fl">
<p>我叫什么名来着</p>
<p class="red">东方妖妖梦</p>
</div>
<div style="clear: both"></div>
</li>
<!--</div>-->
<!--<div style="clear: both"></div>-->
<!--</li>-->
<!--<li>-->
<!--<img class="fl" src="https://ygobbs.com//letter_avatar_proxy/v2/letter/q/cdc98d/45.png">-->
<!--<i class="fa fa-circle green_light"></i>-->
<!--<div class="fl">-->
<!--<p>我叫什么名来着</p>-->
<!--<p>发呆ing</p>-->
<!--</div>-->
<!--<div style="clear: both"></div>-->
<!--</li>-->
<li>
<img class="fl" src="https://ygobbs.com/user_avatar/ygobbs.com/%E6%98%9F%E5%85%89pokeboy/45/10237_1.png">
<i class="fa fa-question-circle blue_light"></i>
<div class="fl">
<p>我叫什么名来着</p>
<p>发呆ing</p>
</div>
<div style="clear: both"></div>
</li>
<!--<li>-->
<!--<img class="fl" src="https://ygobbs.com/user_avatar/ygobbs.com/sky%E7%A5%9E%E6%99%BA/45/16501_1.png">-->
<!--<i class="fa fa-play-circle red_light"></i>-->
<!--<div class="fl">-->
<!--<p>我叫什么名来着</p>-->
<!--<p class="red">东方妖妖梦</p>-->
<!--</div>-->
<!--<div style="clear: both"></div>-->
<!--</li>-->
<li>
<img class="fl" src="https://ygobbs.com//user_avatar/ygobbs.com/%E7%B1%B3%E7%B1%B3%E7%B1%B3%E5%BE%B7%E6%8B%89%E4%BB%80/45/17187_1.png">
<i class="fa fa-clock-o grey"></i>
<div class="fl">
<p>我叫什么名来着</p>
<p>发呆ing</p>
</div>
<div style="clear: both"></div>
</li>
</ul>
</div>
</div>
<!--<li>-->
<!--<img class="fl" src="https://ygobbs.com/user_avatar/ygobbs.com/%E6%98%9F%E5%85%89pokeboy/45/10237_1.png">-->
<!--<i class="fa fa-question-circle blue_light"></i>-->
<!--<div class="fl">-->
<!--<p>我叫什么名来着</p>-->
<!--<p>发呆ing</p>-->
<!--</div>-->
<!--<div style="clear: both"></div>-->
<!--</li>-->
<!--<li>-->
<!--<img class="fl" src="https://ygobbs.com//user_avatar/ygobbs.com/%E7%B1%B3%E7%B1%B3%E7%B1%B3%E5%BE%B7%E6%8B%89%E4%BB%80/45/17187_1.png">-->
<!--<i class="fa fa-clock-o grey"></i>-->
<!--<div class="fl">-->
<!--<p>我叫什么名来着</p>-->
<!--<p>发呆ing</p>-->
<!--</div>-->
<!--<div style="clear: both"></div>-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
<!--</div>-->
/**
* Created by zh99998 on 16/9/2.
*/
import {Component} from '@angular/core';
import {Component, Input, EventEmitter, Output, OnInit, OnChanges} from '@angular/core';
@Component({
moduleId: module.id,
selector: 'roster',
templateUrl: 'roster.component.html',
styleUrls: ['roster.component.css'],
})
export class RosterComponent {
export class RosterComponent implements OnInit, OnChanges {
@Input()
roster: any;
@Output()
chat = new EventEmitter<string>();
ngOnInit() {
console.log(this.roster);
}
ngOnChanges() {
console.log(this.roster);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment