forked from online-go/online-go.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial achievement list display widget
- Loading branch information
Showing
5 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (C) 2012-2020 Online-Go.com | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
.AchievementList { | ||
|
||
} | ||
|
||
.AchievementEntry { | ||
display: flex; | ||
padding-left: 2rem; | ||
|
||
.icon { | ||
flex-grow: 0; | ||
flex-shrink: 0; | ||
display: inline-block; | ||
width: 3rem; | ||
height: 3rem; | ||
background-size: cover; | ||
} | ||
|
||
.achievement-info { | ||
display: flex; | ||
flex-direction: column; | ||
margin-left: 1rem; | ||
|
||
.title { | ||
font-weight: bold; | ||
} | ||
.description { | ||
font-size: smaller; | ||
} | ||
} | ||
|
||
&.wdc2021 { | ||
.icon { | ||
background-image: url('/achievements/wdc2021.png'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (C) 2012-2020 Online-Go.com | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import * as React from "react"; | ||
import { _, pgettext, interpolate } from "translate"; | ||
//import * as preferences from "preferences"; | ||
|
||
interface AchievementEntry { | ||
name: string; | ||
nth_time_awarded: number; | ||
timestamp: string; | ||
completed: boolean; | ||
progress: number; | ||
} | ||
|
||
|
||
interface AchievementListProps { | ||
list: Array<AchievementEntry>; | ||
} | ||
|
||
export function AchievementList({list}:AchievementListProps): JSX.Element { | ||
return ( | ||
<div className='AchievementList'> | ||
{list.map(render_achievement_entry)} | ||
</div> | ||
); | ||
} | ||
|
||
function render_achievement_entry(entry:AchievementEntry): JSX.Element { | ||
var title = ''; | ||
var description = ''; | ||
|
||
switch (entry.name) { | ||
case 'wdc2021': | ||
title = 'Western Dan Challenge Contender'; | ||
description = 'Played 100 or more games during the 2021 Western Dan Challenge'; | ||
break; | ||
} | ||
|
||
return ( | ||
<div key={entry.name + '-' + entry.nth_time_awarded} className={'AchievementEntry ' + entry.name}> | ||
<span className='icon' /> | ||
<div className='achievement-info'> | ||
<div className='title'>{title}</div> | ||
<div className='description'>{description}</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (C) 2012-2020 Online-Go.com | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
export * from "./AchievementList"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters