File tree Expand file tree Collapse file tree 5 files changed +45
-15
lines changed Expand file tree Collapse file tree 5 files changed +45
-15
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ export const lbaoPredictorApi = (
2727 ) =>
2828 users . map ( ( user , i ) => ( {
2929 ...user ,
30+ oldRating : data [ i ] ?. old_rating ,
3031 delta : data [ i ] ?. delta_rating ,
3132 newRating : data [ i ] ?. new_rating ,
3233 } ) )
Original file line number Diff line number Diff line change @@ -33,15 +33,17 @@ const App: FC = () => {
3333 const showPredictordelta = ! ! options ?. contestRankingPage . ratingPredictor
3434 const showLanguageIcon = ! ! options ?. contestRankingPage . languageIcon
3535 const showNewRating = ! ! options ?. contestRankingPage . showNewRating
36+ const showOldRating = ! ! options ?. contestRankingPage . showOldRating
3637
3738 return (
3839 < >
3940 { ( showPredictordelta || showNewRating ) && titleRoot && (
4041 < Portal container = { titleRoot } >
4142 < th >
4243 < Title
43- showNewRating = { showNewRating }
44+ showOldRating = { showOldRating }
4445 showPredictordelta = { showPredictordelta }
46+ showNewRating = { showNewRating }
4547 />
4648 </ th >
4749 </ Portal >
@@ -53,8 +55,9 @@ const App: FC = () => {
5355 < Item
5456 row = { i }
5557 hasMyRank = { hasMyRank }
56- showNewRating = { showNewRating }
58+ showOldRating = { showOldRating }
5759 showPredictordelta = { showPredictordelta }
60+ showNewRating = { showNewRating }
5861 />
5962 </ td >
6063 </ Portal >
Original file line number Diff line number Diff line change @@ -8,8 +8,9 @@ import { ParamType, useGetPredictionQuery } from './rankSlice'
88type ItmeType = {
99 row : number
1010 hasMyRank : boolean
11- showNewRating : boolean
11+ showOldRating : boolean
1212 showPredictordelta : boolean
13+ showNewRating : boolean
1314}
1415
1516function getParam ( ) : ParamType {
@@ -54,8 +55,9 @@ function useUrlChange() {
5455const Item : FC < ItmeType > = ( {
5556 row,
5657 hasMyRank,
57- showNewRating ,
58+ showOldRating ,
5859 showPredictordelta,
60+ showNewRating,
5961} ) => {
6062 const [ param ] = useUrlChange ( )
6163 const params : ParamType = { ...param }
@@ -71,9 +73,10 @@ const Item: FC<ItmeType> = ({
7173 }
7274
7375 const predictor : number | undefined = items ?. [ row ] ?. delta ?. toFixed ( 1 ) ,
74- newRating = items ?. [ row ] ?. newRating ?. toFixed ( 1 )
76+ newRating = items ?. [ row ] ?. newRating ?. toFixed ( 1 ) ,
77+ oldRating = items ?. [ row ] ?. oldRating ?. toFixed ( 1 )
7578
76- if ( ! predictor || ! newRating ) {
79+ if ( predictor === undefined ) {
7780 return < > </ >
7881 }
7982
@@ -83,6 +86,7 @@ const Item: FC<ItmeType> = ({
8386 display : flex;
8487 ` }
8588 >
89+ { showOldRating && < div style = { { width : 60 } } > { oldRating } </ div > }
8690 { showPredictordelta && (
8791 < div
8892 css = { css `
Original file line number Diff line number Diff line change @@ -51,26 +51,46 @@ const Help = () => {
5151}
5252
5353interface TitleProps {
54- showNewRating : boolean
54+ showOldRating : boolean
5555 showPredictordelta : boolean
56+ showNewRating : boolean
5657}
5758
58- const Title : FC < TitleProps > = ( { showNewRating, showPredictordelta } ) => {
59+ const Title : FC < TitleProps > = ( {
60+ showNewRating,
61+ showPredictordelta,
62+ showOldRating,
63+ } ) => {
5964 return (
6065 < >
6166 < div
6267 style = { {
6368 display : 'flex' ,
6469 } }
6570 >
71+ { showOldRating && (
72+ < div style = { { width : 60 } } >
73+ 旧分数{ ! showPredictordelta && ! showNewRating && < Help /> }
74+ </ div >
75+ ) }
6676 { showPredictordelta && (
67- < div style = { { width : 55 } } >
68- < span > 预测</ span >
69- < Help />
77+ < div
78+ style = { {
79+ width : 55 ,
80+ paddingLeft : showNewRating ? 10 : 0 ,
81+ } }
82+ >
83+ < span > { showNewRating ? 'Δ' : '预测' } </ span >
84+ { ! showNewRating && < Help /> }
7085 </ div >
7186 ) }
7287
73- { showNewRating && < div > 新分数{ ! showPredictordelta && < Help /> } </ div > }
88+ { showNewRating && (
89+ < div >
90+ 新分数
91+ < Help />
92+ </ div >
93+ ) }
7494 </ div >
7595 </ >
7696 )
Original file line number Diff line number Diff line change @@ -21,8 +21,9 @@ export const defaultOptions = {
2121 } ,
2222 contestRankingPage : {
2323 languageIcon : true ,
24+ showOldRating : false ,
2425 ratingPredictor : true ,
25- showNewRating : false ,
26+ showNewRating : true ,
2627 } ,
2728}
2829
@@ -50,6 +51,7 @@ export const labelMap: { [key: string]: string } = {
5051 fixBackNav : '修复返回导航' ,
5152 disableShortcutkey : '禁用快捷键' ,
5253 languageIcon : '语言图标' ,
53- ratingPredictor : '预测积分' ,
54- showNewRating : '预测新分数' ,
54+ showOldRating : '显示旧分数' ,
55+ ratingPredictor : '显示积分' ,
56+ showNewRating : '显示新分数' ,
5557}
You can’t perform that action at this time.
0 commit comments