fix shadows + lp diff accounts
This commit is contained in:
parent
64f37d0fd1
commit
af161537d7
|
|
@ -79,7 +79,7 @@ export default function Lobby ( { player }: { player: string } )
|
|||
></div>
|
||||
|
||||
<div className="grid grid-rows-2 flex-grow mx-4 min-w-0">
|
||||
<div className="name font-semibold text-white text-sm text-shadow-lg text-shadow-black truncate">
|
||||
<div className="name font-semibold text-white text-sm text-shadow-sm text-shadow-black truncate">
|
||||
{ player.tag ? `${ player.tag } ${ player.name }` : player.name }
|
||||
</div>
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ export default function Lobby ( { player }: { player: string } )
|
|||
backgroundImage: `url(${ player.positionIcon })`,
|
||||
} }
|
||||
></div>
|
||||
<div className="wr font-bold text-white text-shadow-lg text-shadow-black text-xs ml-1 pt-1">
|
||||
<div className="wr font-bold text-white text-shadow-sm text-shadow-black text-xs ml-1 pt-1">
|
||||
{ player.wr }%
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ export default function Ranked ( { name, tag }: { name: string; tag: string } )
|
|||
return (
|
||||
<div className="font-sans">
|
||||
<div className="text flex flex-row font-bold tracking-wide">
|
||||
<div className="elo basis-2/3 pr-4 mb-3 text-white text-shadow-lg text-shadow-black">
|
||||
<div className="elo basis-2/3 pr-4 mb-3 text-white text-shadow-sm text-shadow-black">
|
||||
{ [ "MASTER", "GRANDMASTER", "CHALLENGER" ].includes( data.tier ) ? (
|
||||
<div className="league basis-1/2 text-4xl ">
|
||||
{ data.tier } { data.lp } LP
|
||||
|
|
@ -68,9 +68,9 @@ export default function Ranked ( { name, tag }: { name: string; tag: string } )
|
|||
</div>
|
||||
|
||||
<div className="stats basis-1/3 flex flex-row justify-end text-3xl tracking-tighter">
|
||||
<div className="wins px-2 text-sky-600 ">{ data.wins }W</div>
|
||||
<div className="losses px-2 text-red-600 ">{ data.losses }L</div>
|
||||
<div className="winrate pl-3 text-white text-shadow-lg text-shadow-black">
|
||||
<div className="wins px-2 text-sky-600 text-shadow-sm text-shadow-black">{ data.wins }W</div>
|
||||
<div className="losses px-2 text-red-600 text-shadow-sm text-shadow-black">{ data.losses }L</div>
|
||||
<div className="winrate pl-3 text-white text-shadow-sm text-shadow-black">
|
||||
{ data.winrate }%
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -92,7 +92,7 @@ export default function Ranked ( { name, tag }: { name: string; tag: string } )
|
|||
style={ { backgroundImage: `url('${ match.championImg }')` } }
|
||||
/>
|
||||
</div>
|
||||
<div className="kda text-center text-xl font-semilight text-gray-200 tracking-tight ">
|
||||
<div className="kda text-center text-xl font-semilight text-gray-200 tracking-tight text-shadow-sm text-shadow-black">
|
||||
{ match.kills }/{ match.deaths }/{ match.assists }
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -69,15 +69,15 @@ export default function Session ( { name, tag }: { name: string; tag: string } )
|
|||
|
||||
<div className="session mt-5">
|
||||
<div className="kda text-center px-2">
|
||||
<span className="text-3xl text-white text-shadow-lg text-shadow-black">
|
||||
<span className="text-3xl text-white text-shadow-sm text-shadow-black">
|
||||
{ data.kills }
|
||||
</span>
|
||||
<span className="text-2xl text-gray-300 ">/</span>
|
||||
<span className="text-3xl text-red-600 ">
|
||||
<span className="text-2xl text-gray-300 text-shadow-sm text-shadow-black">/</span>
|
||||
<span className="text-3xl text-red-600 text-shadow-sm text-shadow-black">
|
||||
{ data.deaths }
|
||||
</span>
|
||||
<span className="text-2xl text-gray-300 ">/</span>
|
||||
<span className="text-3xl text-white text-shadow-lg text-shadow-black">
|
||||
<span className="text-2xl text-gray-300 text-shadow-sm text-shadow-black">/</span>
|
||||
<span className="text-3xl text-white text-shadow-sm text-shadow-black">
|
||||
{ data.assists }
|
||||
</span>
|
||||
</div>
|
||||
|
|
@ -86,17 +86,17 @@ export default function Session ( { name, tag }: { name: string; tag: string } )
|
|||
<div className={ `absolute top-0 w-full ${ data.lpGain !== 0 ? "slide-box" : ""
|
||||
}` }>
|
||||
<div className="wl flex flex-row justify-center">
|
||||
<div className="wins text-3xl text-center text-sky-600 px-1 ">
|
||||
<div className="wins text-3xl text-center text-sky-600 px-1 text-shadow-sm text-shadow-black">
|
||||
{ data.wins }W
|
||||
</div>
|
||||
<div className="losses text-3xl text-center text-red-600 px-1 ">
|
||||
<div className="losses text-3xl text-center text-red-600 px-1 text-shadow-sm text-shadow-black">
|
||||
{ data.losses }L
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{ typeof data.lpGain === "number" && data.lpGain !== 0 && (
|
||||
<div
|
||||
className={ `lp text-3xl text-center px-1 ${ data.lpGain > 0
|
||||
className={ `lp text-3xl text-center px-1 text-shadow-sm text-shadow-black ${ data.lpGain > 0
|
||||
? "text-sky-600"
|
||||
: data.lpGain < 0
|
||||
? "text-red-600"
|
||||
|
|
|
|||
|
|
@ -83,7 +83,6 @@ body {
|
|||
transform: scale(0.5);
|
||||
}
|
||||
|
||||
|
||||
.slide-animation {
|
||||
animation: slideInOut 30s ease-in-out forwards;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -224,27 +224,44 @@ export async function getSessionData ( name: string, tag: string )
|
|||
let initialLP = currentLP;
|
||||
const now = Date.now();
|
||||
|
||||
let shouldResetSession = false;
|
||||
|
||||
if ( sessionCookie )
|
||||
{
|
||||
try
|
||||
{
|
||||
const sessionData = JSON.parse( sessionCookie.value );
|
||||
const sessionTime = sessionData.timestamp;
|
||||
const sessionPuuid = sessionData.puuid;
|
||||
|
||||
if ( now - sessionTime < TWELVE_HOURS_IN_MS )
|
||||
if ( sessionPuuid !== account.puuid )
|
||||
{
|
||||
shouldResetSession = true;
|
||||
} else if ( now - sessionTime < TWELVE_HOURS_IN_MS )
|
||||
{
|
||||
initialLP = sessionData.initialLP;
|
||||
lpGain = currentLP - initialLP;
|
||||
} else
|
||||
{
|
||||
shouldResetSession = true;
|
||||
}
|
||||
} catch {
|
||||
shouldResetSession = true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
shouldResetSession = true;
|
||||
}
|
||||
|
||||
if ( !sessionCookie || lpGain === 0 )
|
||||
if ( shouldResetSession )
|
||||
{
|
||||
( await cookieStore ).set(
|
||||
"lpSession",
|
||||
JSON.stringify( { initialLP: currentLP, timestamp: now } ),
|
||||
JSON.stringify( {
|
||||
initialLP: currentLP,
|
||||
timestamp: now,
|
||||
puuid: account.puuid,
|
||||
} ),
|
||||
{
|
||||
path: "/",
|
||||
maxAge: TWELVE_HOURS_IN_MS / 1000,
|
||||
|
|
|
|||
Loading…
Reference in New Issue