update market-flow page

This commit is contained in:
MuslemRahimi 2024-12-28 16:57:34 +01:00
parent daac53e5c6
commit 662e2fcf56
2 changed files with 186 additions and 178 deletions

View File

@ -10,8 +10,8 @@ export const load = async ({ locals }) => {
}, },
}); });
const output = await response?.json(); let output = await response?.json();
//output = user?.tier !== "Pro" ? output?.slice(0, 6) : output; output.sectorData = user?.tier !== "Pro" ? output?.sectorData?.slice(0, 3) : output?.sectorData;
return output; return output;
}; };

View File

@ -8,6 +8,7 @@
sectorNavigation, sectorNavigation,
} from "$lib/utils"; } from "$lib/utils";
import InfoModal from "$lib/components/InfoModal.svelte"; import InfoModal from "$lib/components/InfoModal.svelte";
import UpgradeToPro from "$lib/components/UpgradeToPro.svelte";
import * as HoverCard from "$lib/components/shadcn/hover-card/index.js"; import * as HoverCard from "$lib/components/shadcn/hover-card/index.js";
import * as DropdownMenu from "$lib/components/shadcn/dropdown-menu/index.js"; import * as DropdownMenu from "$lib/components/shadcn/dropdown-menu/index.js";
@ -504,6 +505,7 @@
</div> </div>
<div class="w-full m-auto"> <div class="w-full m-auto">
{#if optionsData !== null && data?.user?.tier === "Pro"}
<div class="flex flex-row items-center mb-3"> <div class="flex flex-row items-center mb-3">
<label <label
for="marketTideInfo" for="marketTideInfo"
@ -512,12 +514,11 @@
Market Tide Market Tide
</label> </label>
<InfoModal <InfoModal
title={"Sector Flow"} title={"Market Tide"}
content={"Market Tide evaluates the balance between advancing and declining stocks by analyzing SPY price movements, net call premiums, and net put premiums, providing a real-time snapshot of market sentiment and momentum."} content={"Market Tide evaluates the balance between advancing and declining stocks by analyzing SPY price movements, net call premiums, and net put premiums, providing a real-time snapshot of market sentiment and momentum."}
id={"marketTideInfo"} id={"marketTideInfo"}
/> />
</div> </div>
{#if optionsData !== null}
<div <div
class="pb-8 sm:pb-2 rounded-md bg-table border border-gray-800" class="pb-8 sm:pb-2 rounded-md bg-table border border-gray-800"
> >
@ -565,9 +566,13 @@
<TableHeader {columns} {sortOrders} {sortData} /> <TableHeader {columns} {sortOrders} {sortData} />
</thead> </thead>
<tbody> <tbody>
{#each stockList as item} {#each stockList as item, index}
<tr <tr
class="sm:hover:bg-[#245073] border-b border-gray-800 sm:hover:bg-opacity-[0.2] odd:bg-odd" class="sm:hover:bg-[#245073] border-b border-gray-800 sm:hover:bg-opacity-[0.2] odd:bg-odd {index +
1 ===
originalData?.length && data?.user?.tier !== 'Pro'
? 'opacity-[0.1]'
: ''}"
> >
<td <td
class="text-sm sm:text-[1rem] text-start whitespace-nowrap" class="text-sm sm:text-[1rem] text-start whitespace-nowrap"
@ -718,8 +723,9 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<UpgradeToPro {data} />
</div> </div>
{#if data?.user?.tier === "Pro"}
<div class="w-full m-auto mt-10"> <div class="w-full m-auto mt-10">
<div <div
class="flex flex-wrap sm:flex-row items-center sm:justify-between mb-4" class="flex flex-wrap sm:flex-row items-center sm:justify-between mb-4"
@ -748,7 +754,8 @@
builders={[builder]} builders={[builder]}
class="w-full border-gray-600 border bg-default sm:hover:bg-primary ease-out flex flex-row justify-between items-center px-3 py-2 text-white rounded-md truncate" class="w-full border-gray-600 border bg-default sm:hover:bg-primary ease-out flex flex-row justify-between items-center px-3 py-2 text-white rounded-md truncate"
> >
<span class="truncate text-white">{selectedSector}</span <span class="truncate text-white"
>{selectedSector}</span
> >
<svg <svg
class="-mr-1 ml-1 h-5 w-5 xs:ml-2 inline-block" class="-mr-1 ml-1 h-5 w-5 xs:ml-2 inline-block"
@ -891,6 +898,7 @@
</table> </table>
</div> </div>
</div> </div>
{/if}
</main> </main>
</div> </div>
</div> </div>