Compare commits

...

2 Commits

Author SHA1 Message Date
Jasen Qin 4985c46814 autocommit 20-05-2024-08-23 2024-05-20 08:23:36 +10:00
Jasen Qin 60b916c4d8 autocommit 20-05-2024-08-17 2024-05-20 08:17:05 +10:00
6 changed files with 53 additions and 9 deletions

View File

@ -14,8 +14,9 @@ describe('DATABASE', () => {
}) })
it('create csv', () => { it('create csv', () => {
let res = create_csv_database('csv_db/x.csv', { "a_key": [], "a_value": [] }) let res = create_csv_database('csv_db/x.csv', { "a_key": ['initial'], "a_value": [''] })
print_head(res) print_head(res)
delete_row_by_key(res, "initial", "a_key")
add_row(res, { "a_key": ["x"], "a_value": ["y"] }) add_row(res, { "a_key": ["x"], "a_value": ["y"] })
print_head(res) print_head(res)

View File

@ -17,7 +17,7 @@ export function save_db(db: CSVDatabase) {
} }
export function add_row(db: CSVDatabase, row: any) { export function add_row(db: CSVDatabase, row: any) {
let d = DataFrame([row]) let d = DataFrame(row)
db.df = db.df.vstack(d) db.df = db.df.vstack(d)
} }

View File

@ -0,0 +1,49 @@
import { Container } from '@mantine/core'
import { Flex, Button } from '@mantine/core'
import React from "react"
const NavLink = (props: any) =>
<li className="nav-item">
<a className="nav-link" href={props.href}>
{props.children}
</a>
</li>
const Text = (props: any) =>
<p>{props.children}</p>
export default function InventoryPage() {
const demoProps = {
bg: 'var(--mantine-color-blue-light)',
h: 50,
mt: 'md',
}
return (
<>
<Container {...demoProps}>Default Container</Container>
<Container size="xs" {...demoProps}>
xs Container
</Container>
<Container px={0} size="30rem" {...demoProps}>
30rem Container without padding
</Container>
<Flex
mih={50}
bg="rgba(0, 0, 0, .3)"
gap="md"
justify="flex-start"
align="flex-start"
direction="row"
wrap="wrap"
>
<Button>Button 1</Button>
<Button>Button 2</Button>
<Button>Button 3</Button>
</Flex>
</>
)
}

View File

@ -42,7 +42,6 @@ export function create_inventory_dataframe(inventories: Inventory[]): CSVDatabas
return create_csv_database(filepath, inventories) return create_csv_database(filepath, inventories)
} }
function create_models() { function create_models() {
const items: Item[] = [ const items: Item[] = [
{ id: '1', name: 'Item 1', price: 100 }, { id: '1', name: 'Item 1', price: 100 },

View File

@ -1,6 +0,0 @@
module.exports = {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
],
}

View File

@ -1 +1,2 @@
a_key,a_value a_key,a_value
x,y

1 a_key a_value
2 x y