mirror of
https://github.com/dylanbenzi/yellowbird.git
synced 2026-11-27 09:17:00 +00:00
added first rev of docs table
This commit is contained in:
@@ -997,6 +997,13 @@ export const earningsCalendar = [
|
||||
// { "value": 1, "day": "2024-04-14" },
|
||||
];
|
||||
|
||||
export type documentsDataType = {
|
||||
symbol: string;
|
||||
title: string;
|
||||
type: string;
|
||||
date: string;
|
||||
};
|
||||
|
||||
export const documentsList = [
|
||||
{
|
||||
"symbol": "AAPL",
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
ColumnDef,
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
} from "@tanstack/react-table";
|
||||
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
|
||||
interface DocumentsTableProps<TData, TValue> {
|
||||
columns: ColumnDef<TData, TValue>[];
|
||||
data: TData[];
|
||||
}
|
||||
|
||||
export function DocumentsTable<TData, TValue>({
|
||||
columns,
|
||||
data,
|
||||
}: DocumentsTableProps<TData, TValue>) {
|
||||
const table = useReactTable({
|
||||
data,
|
||||
columns,
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="h-full">
|
||||
<Table className="h-full no-scrollbar">
|
||||
<TableBody>
|
||||
{table.getRowModel().rows?.length ? (
|
||||
table.getRowModel().rows.map((row) => (
|
||||
<TableRow
|
||||
key={row.id}
|
||||
data-state={row.getIsSelected() && "selected"}
|
||||
className="text-sm text-white 2xl:text-base border-neutral-700"
|
||||
>
|
||||
{row.getVisibleCells().map((cell) => (
|
||||
<TableCell key={cell.id} className="p-1 pl-4 overflow-hidden">
|
||||
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
||||
</TableCell>
|
||||
))}
|
||||
</TableRow>
|
||||
))
|
||||
) : (
|
||||
<TableRow>
|
||||
<TableCell colSpan={columns.length} className="h-24 text-center">
|
||||
No results.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
"use client";
|
||||
|
||||
import { ColumnDef } from "@tanstack/react-table";
|
||||
import { documentsDataType } from "@/app/MockData/MockData";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
|
||||
export const documentsColumns: ColumnDef<documentsDataType>[] = [
|
||||
{
|
||||
accessorKey: "symbol",
|
||||
header: "Symbol",
|
||||
cell: ({ row }) => {
|
||||
const symbol: string = row.getValue("symbol");
|
||||
|
||||
return <Badge variant={"secondary"}>{symbol}</Badge>;
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "title",
|
||||
header: "Document",
|
||||
},
|
||||
{
|
||||
accessorKey: "type",
|
||||
header: "Filing",
|
||||
},
|
||||
{
|
||||
accessorKey: "date",
|
||||
header: "Date",
|
||||
},
|
||||
];
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
loserMovers,
|
||||
markets,
|
||||
earningsCalendar,
|
||||
documentsList,
|
||||
} from "@/app/MockData/MockData";
|
||||
import HomepageModule from "./HomepageModuleCard";
|
||||
import PortfolioChart, {
|
||||
@@ -41,6 +42,8 @@ import { useState } from "react";
|
||||
import { Badge } from "../ui/badge";
|
||||
import { ResponsiveTimeRange } from "@nivo/calendar";
|
||||
import CalendarSquares from "../charts/CalendarSquares";
|
||||
import { DocumentsTable } from "../charts/documents/DocumentsTable";
|
||||
import { documentsColumns } from "../charts/documents/documentsColumns";
|
||||
|
||||
export const PortfolioModule = () => {
|
||||
const portfolioLine: LineSeriesPartialOptionsWithData = {
|
||||
@@ -245,7 +248,11 @@ export const EarningsModule = () => {
|
||||
};
|
||||
|
||||
export const DocumentsModule = () => {
|
||||
return <HomepageModule title="Documents"></HomepageModule>;
|
||||
return (
|
||||
<HomepageModule title="Documents">
|
||||
<DocumentsTable data={documentsList} columns={documentsColumns} />
|
||||
</HomepageModule>
|
||||
);
|
||||
};
|
||||
|
||||
export const IndicatorsModule = () => {
|
||||
|
||||
Reference in New Issue
Block a user