Skip to content

Commit

Permalink
- Removed references to Quasar CLI from README.md and package.json.
Browse files Browse the repository at this point in the history
- Added more info about the project in README.md.
- Migrated to Tauri v2-rc
- Added support for displaying data from fbindex.se (Fastighetsbolagsindex)
- Added new component CompanyDetails, which replaces ComponentIbindexCompanyEvents, ComponentIbindexCompanyHoldings and ComponentIbindexRebatePremium.
- Added support for displaying company holding being public or not.
- Fixed Tauri fetch() related issues in FI component.
- Updated Cargo dependencies
  • Loading branch information
PeterBlenessy committed Sep 29, 2024
1 parent 11599fb commit b258200
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 87 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### [PATCH]
- Fix: refresh does not seem to propagate to child components on ibindex pages
- Fix: dashboard refreshed when alarm trigger is saved and refresh success notification is shown
- Fix: toggle dark/light mode takes 2 clicks the first time
- Refactor watchlist solution to include watched items from Ibindex, Fbindex, and FI
- Update dependencies: @intlify/unplugin-vue-i18n 4.0.0 -> 5.2.0 - major update

### [FUTURE]
- Change: change from localforage -> Dexie
- Refactor watchlist solution to include watched items from Ibindex, Fbindex, and FI

## [IN-PROGRESS]

## [UNRELEASED]

## v1.1.0 - 2024-09-29
- Removed references to Quasar CLI from README.md and package.json.
- Added more info about the project in README.md.
- Migrated to Tauri v2-rc
- Added support for displaying data from fbindex.se (Fastighetsbolagsindex)
- Added new component CompanyDetails, which replaces ComponentIbindexCompanyEvents, ComponentIbindexCompanyHoldings and ComponentIbindexRebatePremium.
- Added support for displaying company holding being public or not.
- Fixed Tauri fetch() related issues in FI component.
- Updated Cargo dependencies

## v1.0.3 - 2024-08-01
- Added persistence of visible columns in local storage.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stoqster",
"version": "1.0.4",
"version": "1.1.0",
"productName": "Stoqster",
"author": "Péter Blénessy",
"private": true,
Expand Down
27 changes: 18 additions & 9 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "stoqster"
version = "0.1.0"
version = "0.1.1"
description = "A Tauri App"
authors = ["Péter Blénessy"]
edition = "2021"
Expand Down
30 changes: 1 addition & 29 deletions src/api/fiAPI.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,4 @@
// Get color based on value being negative or positive
const setStyle = (number, ifNegative = "red", ifPositive = "green") => {
if (number != 0) {
return number < 0 ? "color:" + ifNegative : "color:" + ifPositive;
}
};

// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat
//const locale = new Intl.locale("se-SV", { language: 'sv'});
const formatter = new Intl.NumberFormat("sv-SE", {
// style: 'currency',
// currency: 'SEK',
// currencyDisplay: 'code',
//notation: 'compact',
//compactDisplay: 'short',
// These options are needed to round to whole numbers if that's what you want.
//minimumFractionDigits: 0, // (this suffices for whole numbers, but will print 2500.10 as $2,500.1)
maximumFractionDigits: 0, // (causes 2500.99 to be printed as $2,501)
});

const isValidNumber = (val) => {
return (
val != 0 &&
val != "" &&
val != " " &&
typeof Number.parseFloat(val) === "number" &&
isFinite(val)
);
};
import { setStyle, formatter, isValidNumber } from "./helpers.js";

const baseUrl = "https://www.fi.se";

Expand Down
12 changes: 11 additions & 1 deletion src/api/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,14 @@ const formatter = new Intl.NumberFormat("sv-SE", {
maximumFractionDigits: 0, // (causes 2500.99 to be printed as $2,501)
});

export { setStyle, formatter };
const isValidNumber = (val) => {
return (
val != 0 &&
val != "" &&
val != " " &&
typeof Number.parseFloat(val) === "number" &&
isFinite(val)
);
};

export { setStyle, formatter, isValidNumber };
5 changes: 1 addition & 4 deletions src/components/ComponentFbindex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,7 @@ export default {
`Error - fetch() status code: ${response.status}`,
);
}
let data = response.json();
console.log(data);
return data;
return response.json();
})
.then((data) => {
rows.value = [...data];
Expand Down
99 changes: 65 additions & 34 deletions src/components/ComponentFundHoldings.vue
Original file line number Diff line number Diff line change
@@ -1,59 +1,91 @@
<template>
<q-table dense flat color="primary" :title="title" :columns="columns" :rows="rows" :visible-columns="visibleColumns"
:filter="filter" row-key="index" binary-state-sort class="my-sticky-header-table-expanded" wrap-cells
virtual-scroll virtual-scroll-slice-size="100" virtual-scroll-slice-ratio-before="2"
virtual-scroll-slice-ratio-after="2" virtual-scroll-sticky-size-start="49" virtual-scroll-item-size="33"
virtual-scroll-sticky-size-end="33" v-model:pagination="pagination" :rows-per-page-options="[0]">

<q-table
dense
flat
color="primary"
:title="title"
:columns="columns"
:rows="rows"
:visible-columns="visibleColumns"
:filter="filter"
row-key="index"
binary-state-sort
class="my-sticky-header-table-expanded"
wrap-cells
virtual-scroll
virtual-scroll-slice-size="100"
virtual-scroll-slice-ratio-before="2"
virtual-scroll-slice-ratio-after="2"
virtual-scroll-sticky-size-start="49"
virtual-scroll-item-size="33"
virtual-scroll-sticky-size-end="33"
:rows-per-page-options="[0]"
>
<!-- Configure top-right part of the data table component -->
<template v-slot:top-right>
<!-- Search input -->
<q-input dense debounce="300" v-model="filter" placeholder="Sök i listan" style="width: 500px">
<q-input
dense
debounce="300"
v-model="filter"
placeholder="Sök i listan"
style="width: 500px"
>
<template v-slot:append>
<q-icon name="mdi-filter-variant" />
</template>
</q-input>
</template>

</q-table>
</template>

<script>
import { ref, toRef, onMounted } from 'vue';
import { fundHoldings } from '../api/fiAPI.js';
import localforage from 'localforage';
import { ref, toRef, onMounted } from "vue";
import { fundHoldings } from "../api/fiAPI.js";
import localforage from "localforage";
export default {
name: 'ComponentFundHoldings',
name: "ComponentFundHoldings",
props: {
fundName: { type: String, required: true }
fundName: { type: String, required: true },
},
setup(props) {
const title = fundHoldings.title;
const columns = fundHoldings.qTableConfig.columns;
const visibleColumns = ref(fundHoldings.qTableConfig.visibleColumns);
const fundName = toRef(props, 'fundName');
const fundName = toRef(props, "fundName");
const rows = toRef([]);
const loading = ref(false);
const fundHoldingsStore = localforage.createInstance({ name: 'stoqster', storeName: fundHoldings.localForageConfig.storeName });
const fundHoldingsStore = localforage.createInstance({
name: "stoqster",
storeName: fundHoldings.localForageConfig.storeName,
});
async function loadData() {
console.time(`loadHoldingsFromDB(): ${fundName.value}`);
loading.value = true;
fundHoldingsStore.getItem(fundName.value).then(holdings => {
if (holdings === undefined || holdings === null || holdings === '') {
console.error(`No holdings for: ${fundName.value}. Should have skipped import!`);
} else {
rows.value = holdings;
// Make sure we have a unique index for each row in the table
rows.value.forEach((row, index) => {
rows.value.index = index;
});
}
})
.catch(error => console.log(error))
fundHoldingsStore
.getItem(fundName.value)
.then((holdings) => {
if (
holdings === undefined ||
holdings === null ||
holdings === ""
) {
console.error(
`No holdings for: ${fundName.value}. Should have skipped import!`,
);
} else {
rows.value = holdings;
// Make sure we have a unique index for each row in the table
rows.value.forEach((row, index) => {
rows.value.index = index;
});
}
})
.catch((error) => console.log(error))
.finally(() => {
loading.value = false;
console.timeEnd(`loadHoldingsFromDB(): ${fundName.value}`);
Expand All @@ -69,11 +101,11 @@ export default {
rows,
columns,
visibleColumns,
filter: ref(''),
loading
}
}
}
filter: ref(""),
loading,
};
},
};
</script>

<style lang="sass">
Expand All @@ -95,12 +127,11 @@ export default {
z-index: 1
text-transform: uppercase
&.q-table--dark
&.q-table--dark
.q-table__top,
.q-table__middle,
.q-table__bottom,
thead tr:first-child th
/* bg color is important for th; just specify one */
background-color: #2e2e2e
</style>
Loading

0 comments on commit b258200

Please sign in to comment.