@@ -120,7 +120,28 @@ export function PokestopPopup({
120
120
< Divider light flexItem className = "popup-divider" />
121
121
) : null }
122
122
< RewardInfo { ...quest } />
123
- < QuestConditions { ...quest } />
123
+ < Grid
124
+ xs = { 9 }
125
+ style = { {
126
+ textAlign : 'center' ,
127
+ maxHeight : 150 ,
128
+ overflow : 'auto' ,
129
+ } }
130
+ >
131
+ < QuestConditions { ...quest } />
132
+ { quest . quest_shiny_probability && (
133
+ < >
134
+ < br />
135
+ < Typography variant = "caption" >
136
+ { t ( 'shiny_probability' , {
137
+ p : readableProbability (
138
+ quest . quest_shiny_probability ,
139
+ ) ,
140
+ } ) }
141
+ </ Typography >
142
+ </ >
143
+ ) }
144
+ </ Grid >
124
145
</ React . Fragment >
125
146
) ) }
126
147
{ hasLure && (
@@ -512,6 +533,15 @@ const RewardInfo = ({ with_ar, ...quest }) => {
512
533
)
513
534
}
514
535
536
+ const readableProbability = ( x ) => {
537
+ if ( x <= 0 ) return '🚫'
538
+ const x_1 = Math . round ( 1 / x )
539
+ const percent = Math . round ( x * 100 )
540
+ return Math . abs ( 1 / x_1 - x ) < Math . abs ( percent * 0.01 - x )
541
+ ? `1/${ x_1 } `
542
+ : `${ percent } %`
543
+ }
544
+
515
545
/**
516
546
*
517
547
* @param {Omit<import('@rm/types').Quest, 'key'> } props
@@ -528,22 +558,16 @@ const QuestConditions = ({
528
558
const madQuestText = useStorage ( ( s ) => s . userSettings . pokestops . madQuestText )
529
559
530
560
if ( madQuestText && quest_task ) {
531
- return (
532
- < Grid xs = { 9 } textAlign = "center" >
533
- < Typography variant = "caption" > { quest_task } </ Typography >
534
- </ Grid >
535
- )
561
+ return < Typography variant = "caption" > { quest_task } </ Typography >
536
562
}
537
563
538
564
if ( quest_title && ! quest_title . includes ( 'geotarget' ) ) {
539
565
const normalized = `quest_title_${ quest_title . toLowerCase ( ) } `
540
566
if ( i18n . exists ( normalized ) ) {
541
567
return (
542
- < Grid xs = { 9 } textAlign = "center" >
543
- < Typography variant = "caption" >
544
- < Trans i18nKey = { normalized } > { { amount_0 : quest_target } } </ Trans >
545
- </ Typography >
546
- </ Grid >
568
+ < Typography variant = "caption" >
569
+ < Trans i18nKey = { normalized } > { { amount_0 : quest_target } } </ Trans >
570
+ </ Typography >
547
571
)
548
572
}
549
573
}
@@ -615,10 +639,7 @@ const QuestConditions = ({
615
639
}
616
640
}
617
641
return (
618
- < Grid
619
- xs = { 9 }
620
- style = { { textAlign : 'center' , maxHeight : 150 , overflow : 'auto' } }
621
- >
642
+ < >
622
643
{ primaryCondition }
623
644
{ type1 && (
624
645
< >
@@ -636,7 +657,7 @@ const QuestConditions = ({
636
657
</ Typography >
637
658
</ >
638
659
) }
639
- </ Grid >
660
+ </ >
640
661
)
641
662
}
642
663
0 commit comments