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