ui fix
This commit is contained in:
parent
7ed179421e
commit
fef62e56d1
94
src/routes/stocks/[tickerID]/profile/+layout.svelte
Normal file
94
src/routes/stocks/[tickerID]/profile/+layout.svelte
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { stockTicker } from "$lib/store";
|
||||||
|
import { page } from "$app/stores";
|
||||||
|
|
||||||
|
let displaySubSection = "overview";
|
||||||
|
|
||||||
|
function changeSubSection(state) {
|
||||||
|
const subSectionMap = {
|
||||||
|
employees: "/profile/employees",
|
||||||
|
};
|
||||||
|
|
||||||
|
if (state !== "overview" && subSectionMap[state]) {
|
||||||
|
displaySubSection = state;
|
||||||
|
} else {
|
||||||
|
displaySubSection = state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$: {
|
||||||
|
if ($page?.url?.pathname) {
|
||||||
|
const parts = $page?.url?.pathname.split("/");
|
||||||
|
const sectionMap = {
|
||||||
|
employees: "employees",
|
||||||
|
};
|
||||||
|
|
||||||
|
const foundSection = parts?.find((part) =>
|
||||||
|
Object?.values(sectionMap)?.includes(part),
|
||||||
|
);
|
||||||
|
|
||||||
|
displaySubSection =
|
||||||
|
Object?.keys(sectionMap)?.find(
|
||||||
|
(key) => sectionMap[key] === foundSection,
|
||||||
|
) || "overview";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<section class="w-auto bg-default overflow-hidden text-black h-full">
|
||||||
|
<div class="m-auto h-full overflow-hidden">
|
||||||
|
<main class="w-full">
|
||||||
|
<div class="m-auto">
|
||||||
|
<nav
|
||||||
|
class="sm:ml-4 pt-1 overflow-x-scroll text-sm sm:text-[1rem] whitespace-nowrap"
|
||||||
|
>
|
||||||
|
<ul class="flex flex-row items-center w-full text-white">
|
||||||
|
<a
|
||||||
|
href={`/stocks/${$stockTicker}/profile`}
|
||||||
|
on:click={() => changeSubSection("overview")}
|
||||||
|
class="p-2 px-5 cursor-pointer {displaySubSection === 'overview'
|
||||||
|
? 'text-white bg-primary sm:hover:bg-opacity-[0.95]'
|
||||||
|
: 'text-gray-400 sm:hover:text-white sm:hover:bg-primary sm:hover:bg-opacity-[0.95]'}"
|
||||||
|
>
|
||||||
|
Overview
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a
|
||||||
|
href={`/stocks/${$stockTicker}/profile/employees`}
|
||||||
|
on:click={() => changeSubSection("employees")}
|
||||||
|
class="p-2 px-5 cursor-pointer {displaySubSection === 'employees'
|
||||||
|
? 'text-white bg-primary sm:hover:bg-opacity-[0.95]'
|
||||||
|
: 'text-gray-400 sm:hover:text-white sm:hover:bg-primary sm:hover:bg-opacity-[0.95]'}"
|
||||||
|
>
|
||||||
|
Employees
|
||||||
|
</a>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.scrollbar {
|
||||||
|
display: grid;
|
||||||
|
grid-gap: 18px;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
|
||||||
|
grid-auto-flow: column;
|
||||||
|
overflow-x: auto;
|
||||||
|
scrollbar-width: thin; /* Hide the default scrollbar in Firefox */
|
||||||
|
scrollbar-color: transparent transparent; /* Hide the default scrollbar in Firefox */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Custom scrollbar for Webkit (Chrome, Safari) */
|
||||||
|
.scrollbar::-webkit-scrollbar {
|
||||||
|
width: 0; /* Hide the width of the scrollbar */
|
||||||
|
height: 0; /* Hide the height of the scrollbar */
|
||||||
|
}
|
||||||
|
|
||||||
|
.scrollbar::-webkit-scrollbar-thumb {
|
||||||
|
background: transparent; /* Make the thumb transparent */
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,9 +1,16 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { stockTicker } from "$lib/store";
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
const similarStocks = data?.getSimilarStocks?.sort(
|
let similarStocks;
|
||||||
|
|
||||||
|
$: {
|
||||||
|
if ($stockTicker) {
|
||||||
|
similarStocks = data?.getSimilarStocks?.sort(
|
||||||
(a, b) => b?.employees - a?.employees,
|
(a, b) => b?.employees - a?.employees,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section class="w-full overflow-hidden">
|
<section class="w-full overflow-hidden">
|
||||||
@ -44,7 +51,7 @@
|
|||||||
: ''}"
|
: ''}"
|
||||||
><td class="text-left"
|
><td class="text-left"
|
||||||
><a
|
><a
|
||||||
href={`/stocks/${item?.symbol}/statistics/employees`}
|
href={`/stocks/${item?.symbol}/profile/employees`}
|
||||||
class="text-[1rem] sm:hover:text-white text-blue-400"
|
class="text-[1rem] sm:hover:text-white text-blue-400"
|
||||||
>{item?.name?.length > 30
|
>{item?.name?.length > 30
|
||||||
? item?.name?.slice(0, 30) + "..."
|
? item?.name?.slice(0, 30) + "..."
|
||||||
@ -377,11 +377,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
if (
|
if (employeeHistory?.length > 0 && $stockTicker) {
|
||||||
employeeHistory?.length > 0 &&
|
|
||||||
$stockTicker &&
|
|
||||||
typeof window !== "undefined"
|
|
||||||
) {
|
|
||||||
employeeHistory = data?.getHistoryEmployee ?? [];
|
employeeHistory = data?.getHistoryEmployee ?? [];
|
||||||
historyList = sortByDate(employeeHistory);
|
historyList = sortByDate(employeeHistory);
|
||||||
|
|
||||||
@ -409,7 +405,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let htmlOutput;
|
let htmlOutput = generateEmployeeInfoHTML();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
@ -8,7 +8,6 @@
|
|||||||
const subSectionMap = {
|
const subSectionMap = {
|
||||||
"market-cap": "/statistics/market-cap",
|
"market-cap": "/statistics/market-cap",
|
||||||
"price-reaction": "/statistics/price-reaction",
|
"price-reaction": "/statistics/price-reaction",
|
||||||
employees: "/statistics/employees",
|
|
||||||
"fail-to-deliver": "/statistics/fail-to-deliver",
|
"fail-to-deliver": "/statistics/fail-to-deliver",
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -25,7 +24,6 @@
|
|||||||
const sectionMap = {
|
const sectionMap = {
|
||||||
"market-cap": "market-cap",
|
"market-cap": "market-cap",
|
||||||
"price-reaction": "price-reaction",
|
"price-reaction": "price-reaction",
|
||||||
employees: "employees",
|
|
||||||
"fail-to-deliver": "fail-to-deliver",
|
"fail-to-deliver": "fail-to-deliver",
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -78,15 +76,6 @@
|
|||||||
>
|
>
|
||||||
Price Reaction
|
Price Reaction
|
||||||
</a>
|
</a>
|
||||||
<a
|
|
||||||
href={`/stocks/${$stockTicker}/statistics/employees`}
|
|
||||||
on:click={() => changeSubSection("employees")}
|
|
||||||
class="p-2 px-5 cursor-pointer {displaySubSection === 'employees'
|
|
||||||
? 'text-white bg-primary sm:hover:bg-opacity-[0.95]'
|
|
||||||
: 'text-gray-400 sm:hover:text-white sm:hover:bg-primary sm:hover:bg-opacity-[0.95]'}"
|
|
||||||
>
|
|
||||||
Employees
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a
|
<a
|
||||||
href={`/stocks/${$stockTicker}/statistics/fail-to-deliver`}
|
href={`/stocks/${$stockTicker}/statistics/fail-to-deliver`}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user