ui fixes
This commit is contained in:
parent
6ba56f8f12
commit
67bbc70fe8
@ -85,6 +85,40 @@ export const computeGrowthSingleList = (data, actualList) => {
|
|||||||
return formattedTimeString;
|
return formattedTimeString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const groupScreenerRules = (allRows) => {
|
||||||
|
const categoryOrder = [
|
||||||
|
"Most Popular", "Price & Volume", "Valuation & Ratios", "Valuation & Price Targets",
|
||||||
|
"Technical Analysis", "Forecasts, Analysts & Price Targets", "Dividends", "Revenue / Sales", "Others"
|
||||||
|
];
|
||||||
|
|
||||||
|
// Group rows by category
|
||||||
|
const grouped = allRows.reduce((acc, row) => {
|
||||||
|
// Ensure category is an array if it's a single string
|
||||||
|
const categories = Array.isArray(row.category) ? row.category : [row.category || "Others"]; // Default to "Others" if no category is provided
|
||||||
|
|
||||||
|
categories.forEach((category) => {
|
||||||
|
if (!acc[category]) {
|
||||||
|
acc[category] = [];
|
||||||
|
}
|
||||||
|
acc[category].push(row);
|
||||||
|
});
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
// Sort categories based on the defined order
|
||||||
|
const orderedGroupedRules = Object.fromEntries(
|
||||||
|
Object.entries(grouped).sort(
|
||||||
|
([keyA], [keyB]) => categoryOrder.indexOf(keyA) - categoryOrder.indexOf(keyB)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return orderedGroupedRules;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const groupEarnings = (earnings) => {
|
export const groupEarnings = (earnings) => {
|
||||||
return Object?.entries(
|
return Object?.entries(
|
||||||
earnings
|
earnings
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
sectorList,
|
sectorList,
|
||||||
industryList,
|
industryList,
|
||||||
listOfRelevantCountries,
|
listOfRelevantCountries,
|
||||||
|
groupScreenerRules,
|
||||||
} from "$lib/utils";
|
} from "$lib/utils";
|
||||||
import * as DropdownMenu from "$lib/components/shadcn/dropdown-menu/index.js";
|
import * as DropdownMenu from "$lib/components/shadcn/dropdown-menu/index.js";
|
||||||
import { Button } from "$lib/components/shadcn/button/index.js";
|
import { Button } from "$lib/components/shadcn/button/index.js";
|
||||||
@ -69,7 +70,7 @@
|
|||||||
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: 0,
|
defaultValue: 0,
|
||||||
category: "Price & Volume",
|
category: ["Most Popular", "Price & Volume"],
|
||||||
},
|
},
|
||||||
volume: {
|
volume: {
|
||||||
label: "Volume",
|
label: "Volume",
|
||||||
@ -82,35 +83,35 @@
|
|||||||
rsi: {
|
rsi: {
|
||||||
label: "Relative Strength Index",
|
label: "Relative Strength Index",
|
||||||
step: [90, 80, 70, 60, 50, 40, 30, 20],
|
step: [90, 80, 70, 60, 50, 40, 30, 20],
|
||||||
category: "ta",
|
category: "Technical Analysis",
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: 40,
|
defaultValue: 40,
|
||||||
},
|
},
|
||||||
stochRSI: {
|
stochRSI: {
|
||||||
label: "Stochastic RSI Fast",
|
label: "Stochastic RSI Fast",
|
||||||
step: [90, 80, 70, 60, 50, 40, 30, 20],
|
step: [90, 80, 70, 60, 50, 40, 30, 20],
|
||||||
category: "ta",
|
category: "Technical Analysis",
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: 40,
|
defaultValue: 40,
|
||||||
},
|
},
|
||||||
mfi: {
|
mfi: {
|
||||||
label: "Money Flow Index",
|
label: "Money Flow Index",
|
||||||
step: [90, 80, 70, 60, 50, 40, 30, 20],
|
step: [90, 80, 70, 60, 50, 40, 30, 20],
|
||||||
category: "ta",
|
category: "Technical Analysis",
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: 40,
|
defaultValue: 40,
|
||||||
},
|
},
|
||||||
cci: {
|
cci: {
|
||||||
label: "Commodity Channel Index",
|
label: "Commodity Channel Index",
|
||||||
step: [250, 200, 100, 50, 20, 0, -20, -50, -100, -200, -250],
|
step: [250, 200, 100, 50, 20, 0, -20, -50, -100, -200, -250],
|
||||||
category: "ta",
|
category: "Technical Analysis",
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: 0,
|
defaultValue: 0,
|
||||||
},
|
},
|
||||||
atr: {
|
atr: {
|
||||||
label: "Average True Range",
|
label: "Average True Range",
|
||||||
step: [20, 15, 10, 5, 3, 1],
|
step: [20, 15, 10, 5, 3, 1],
|
||||||
category: "ta",
|
category: "Technical Analysis",
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: 10,
|
defaultValue: 10,
|
||||||
},
|
},
|
||||||
@ -122,7 +123,7 @@
|
|||||||
"SMA20 > SMA100",
|
"SMA20 > SMA100",
|
||||||
"SMA20 > SMA200",
|
"SMA20 > SMA200",
|
||||||
],
|
],
|
||||||
category: "ta",
|
category: "Technical Analysis",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
},
|
},
|
||||||
sma50: {
|
sma50: {
|
||||||
@ -133,7 +134,7 @@
|
|||||||
"SMA50 > SMA100",
|
"SMA50 > SMA100",
|
||||||
"SMA50 > SMA200",
|
"SMA50 > SMA200",
|
||||||
],
|
],
|
||||||
category: "ta",
|
category: "Technical Analysis",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
},
|
},
|
||||||
sma100: {
|
sma100: {
|
||||||
@ -144,7 +145,7 @@
|
|||||||
"SMA100 > SMA50",
|
"SMA100 > SMA50",
|
||||||
"SMA100 > SMA200",
|
"SMA100 > SMA200",
|
||||||
],
|
],
|
||||||
category: "ta",
|
category: "Technical Analysis",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
},
|
},
|
||||||
sma200: {
|
sma200: {
|
||||||
@ -155,7 +156,7 @@
|
|||||||
"SMA200 > SMA50",
|
"SMA200 > SMA50",
|
||||||
"SMA200 > SMA100",
|
"SMA200 > SMA100",
|
||||||
],
|
],
|
||||||
category: "ta",
|
category: "Technical Analysis",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
},
|
},
|
||||||
ema20: {
|
ema20: {
|
||||||
@ -166,7 +167,7 @@
|
|||||||
"EMA20 > EMA100",
|
"EMA20 > EMA100",
|
||||||
"EMA20 > EMA200",
|
"EMA20 > EMA200",
|
||||||
],
|
],
|
||||||
category: "ta",
|
category: "Technical Analysis",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
},
|
},
|
||||||
ema50: {
|
ema50: {
|
||||||
@ -177,7 +178,7 @@
|
|||||||
"EMA50 > EMA100",
|
"EMA50 > EMA100",
|
||||||
"EMA50 > EMA200",
|
"EMA50 > EMA200",
|
||||||
],
|
],
|
||||||
category: "ta",
|
category: "Technical Analysis",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
},
|
},
|
||||||
ema100: {
|
ema100: {
|
||||||
@ -188,7 +189,7 @@
|
|||||||
"EMA100 > EMA50",
|
"EMA100 > EMA50",
|
||||||
"EMA100 > EMA200",
|
"EMA100 > EMA200",
|
||||||
],
|
],
|
||||||
category: "ta",
|
category: "Technical Analysis",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
},
|
},
|
||||||
ema200: {
|
ema200: {
|
||||||
@ -199,7 +200,7 @@
|
|||||||
"EMA200 > EMA50",
|
"EMA200 > EMA50",
|
||||||
"EMA200 > EMA100",
|
"EMA200 > EMA100",
|
||||||
],
|
],
|
||||||
category: "ta",
|
category: "Technical Analysis",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
},
|
},
|
||||||
grahamNumber: {
|
grahamNumber: {
|
||||||
@ -213,12 +214,12 @@
|
|||||||
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: 10,
|
defaultValue: 10,
|
||||||
|
category: "Price & Volume",
|
||||||
},
|
},
|
||||||
|
|
||||||
change1W: {
|
change1W: {
|
||||||
label: "Price Change 1W",
|
label: "Price Change 1W",
|
||||||
step: ["20%", "10%", "5%", "1%", "-1%", "-5%", "-10%", "-20%"],
|
step: ["20%", "10%", "5%", "1%", "-1%", "-5%", "-10%", "-20%"],
|
||||||
category: "ta",
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
},
|
},
|
||||||
@ -237,7 +238,6 @@
|
|||||||
"-20%",
|
"-20%",
|
||||||
"-50%",
|
"-50%",
|
||||||
],
|
],
|
||||||
category: "ta",
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
},
|
},
|
||||||
@ -256,7 +256,6 @@
|
|||||||
"-20%",
|
"-20%",
|
||||||
"-50%",
|
"-50%",
|
||||||
],
|
],
|
||||||
category: "ta",
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
},
|
},
|
||||||
@ -275,7 +274,6 @@
|
|||||||
"-20%",
|
"-20%",
|
||||||
"-50%",
|
"-50%",
|
||||||
],
|
],
|
||||||
category: "ta",
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
},
|
},
|
||||||
@ -294,7 +292,6 @@
|
|||||||
"-20%",
|
"-20%",
|
||||||
"-50%",
|
"-50%",
|
||||||
],
|
],
|
||||||
category: "ta",
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
},
|
},
|
||||||
@ -313,7 +310,6 @@
|
|||||||
"-20%",
|
"-20%",
|
||||||
"-50%",
|
"-50%",
|
||||||
],
|
],
|
||||||
category: "ta",
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
},
|
},
|
||||||
@ -323,6 +319,7 @@
|
|||||||
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "10M",
|
defaultValue: "10M",
|
||||||
|
category: ["Most Popular", "Valuation & Ratios"],
|
||||||
},
|
},
|
||||||
workingCapital: {
|
workingCapital: {
|
||||||
label: "Working Capital",
|
label: "Working Capital",
|
||||||
@ -351,6 +348,7 @@
|
|||||||
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "10M",
|
defaultValue: "10M",
|
||||||
|
category: "Revenue / Sales",
|
||||||
},
|
},
|
||||||
revenueGrowthYears: {
|
revenueGrowthYears: {
|
||||||
label: "Revenue Growth Years",
|
label: "Revenue Growth Years",
|
||||||
@ -358,6 +356,7 @@
|
|||||||
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
|
category: "Revenue / Sales",
|
||||||
},
|
},
|
||||||
epsGrowthYears: {
|
epsGrowthYears: {
|
||||||
label: "EPS Growth Years",
|
label: "EPS Growth Years",
|
||||||
@ -386,6 +385,7 @@
|
|||||||
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "1%",
|
defaultValue: "1%",
|
||||||
|
category: ["Most Popular", "Revenue / Sales"],
|
||||||
},
|
},
|
||||||
costOfRevenue: {
|
costOfRevenue: {
|
||||||
label: "Cost of Revenue",
|
label: "Cost of Revenue",
|
||||||
@ -470,6 +470,7 @@
|
|||||||
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "1%",
|
defaultValue: "1%",
|
||||||
|
category: ["Most Popular", "Dividends"],
|
||||||
},
|
},
|
||||||
annualDividend: {
|
annualDividend: {
|
||||||
label: "Annual Dividend",
|
label: "Annual Dividend",
|
||||||
@ -611,6 +612,7 @@
|
|||||||
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "1%",
|
defaultValue: "1%",
|
||||||
|
category: "Revenue / Sales",
|
||||||
},
|
},
|
||||||
cagr5YearRevenue: {
|
cagr5YearRevenue: {
|
||||||
label: "Revenue CAGR 5Y",
|
label: "Revenue CAGR 5Y",
|
||||||
@ -618,6 +620,7 @@
|
|||||||
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "1%",
|
defaultValue: "1%",
|
||||||
|
category: "Revenue / Sales",
|
||||||
},
|
},
|
||||||
cagr3YearEPS: {
|
cagr3YearEPS: {
|
||||||
label: "EPS CAGR 3Y",
|
label: "EPS CAGR 3Y",
|
||||||
@ -646,6 +649,7 @@
|
|||||||
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "50%",
|
defaultValue: "50%",
|
||||||
|
category: "Price & Volume",
|
||||||
},
|
},
|
||||||
institutionalOwnership: {
|
institutionalOwnership: {
|
||||||
label: "Institutional Ownership",
|
label: "Institutional Ownership",
|
||||||
@ -701,6 +705,7 @@
|
|||||||
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: 1,
|
defaultValue: 1,
|
||||||
|
category: "Price & Volume",
|
||||||
},
|
},
|
||||||
ebitda: {
|
ebitda: {
|
||||||
label: "EBITDA",
|
label: "EBITDA",
|
||||||
@ -998,6 +1003,7 @@
|
|||||||
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "0",
|
defaultValue: "0",
|
||||||
|
category: ["Most Popular", "Valuation & Ratios"],
|
||||||
},
|
},
|
||||||
priceEarningsToGrowthRatio: {
|
priceEarningsToGrowthRatio: {
|
||||||
label: "Price / Earnings Growth",
|
label: "Price / Earnings Growth",
|
||||||
@ -1188,6 +1194,7 @@
|
|||||||
|
|
||||||
defaultCondition: "",
|
defaultCondition: "",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
|
category: ["Most Popular", "Forecasts, Analysts & Price Targets"],
|
||||||
},
|
},
|
||||||
analystCounter: {
|
analystCounter: {
|
||||||
label: "Analyst Count",
|
label: "Analyst Count",
|
||||||
@ -1195,6 +1202,7 @@
|
|||||||
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
|
category: "Forecasts, Analysts & Price Targets",
|
||||||
},
|
},
|
||||||
priceTarget: {
|
priceTarget: {
|
||||||
label: "Price Target",
|
label: "Price Target",
|
||||||
@ -1202,6 +1210,7 @@
|
|||||||
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
|
category: "Forecasts, Analysts & Price Targets",
|
||||||
},
|
},
|
||||||
upside: {
|
upside: {
|
||||||
label: "Price Target Upside [%]",
|
label: "Price Target Upside [%]",
|
||||||
@ -1209,6 +1218,7 @@
|
|||||||
|
|
||||||
defaultCondition: "over",
|
defaultCondition: "over",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
|
category: "Forecasts, Analysts & Price Targets",
|
||||||
},
|
},
|
||||||
|
|
||||||
halalStocks: {
|
halalStocks: {
|
||||||
@ -1223,6 +1233,7 @@
|
|||||||
|
|
||||||
defaultCondition: "",
|
defaultCondition: "",
|
||||||
defaultValue: "any",
|
defaultValue: "any",
|
||||||
|
category: ["Most Popular", "Forecasts, Analysts & Price Targets"],
|
||||||
},
|
},
|
||||||
sector: {
|
sector: {
|
||||||
label: "Sector",
|
label: "Sector",
|
||||||
@ -1683,14 +1694,7 @@ const handleKeyDown = (event) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
groupedRules = allRows.reduce((acc, row) => {
|
groupedRules = groupScreenerRules(allRows);
|
||||||
const category = row.category || "Others"; // Fallback to "Others" if no category is defined
|
|
||||||
if (!acc[category]) {
|
|
||||||
acc[category] = [];
|
|
||||||
}
|
|
||||||
acc[category].push(row);
|
|
||||||
return acc;
|
|
||||||
}, {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
@ -3143,7 +3147,7 @@ const handleKeyDown = (event) => {
|
|||||||
></label>
|
></label>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="modal-box relative z-50 mx-2 max-h-[80vh] rounded bg-default opacity-100 border border-gray-600 bp:mx-3 sm:mx-4 w-full max-w-3xl"
|
class="modal-box relative z-50 mx-2 max-h-[80vh] rounded bg-default opacity-100 border border-gray-600 bp:mx-3 sm:mx-4 w-full max-w-6xl"
|
||||||
>
|
>
|
||||||
<div class="flex flex-col w-full">
|
<div class="flex flex-col w-full">
|
||||||
<div class="flex flex-row items-center justify-between mb-2">
|
<div class="flex flex-row items-center justify-between mb-2">
|
||||||
@ -3207,8 +3211,8 @@ const handleKeyDown = (event) => {
|
|||||||
<!-- End Search bar-->
|
<!-- End Search bar-->
|
||||||
<div class="border-t border-gray-600 mt-6 mb-3" />
|
<div class="border-t border-gray-600 mt-6 mb-3" />
|
||||||
<div class="text-white">
|
<div class="text-white">
|
||||||
{#each Object.entries(groupedRules) as [category, rules]}
|
{#each Object?.entries(groupedRules) as [category, rules]}
|
||||||
<h4 class="mb-0.5 font-semibold text-lg">{category}</h4>
|
<h4 class="mb-1 font-semibold text-lg mt-5">{category}</h4>
|
||||||
<div class="flex flex-wrap">
|
<div class="flex flex-wrap">
|
||||||
{#each rules as row}
|
{#each rules as row}
|
||||||
<div
|
<div
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user