Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poestack-dawn & networth plugin improvements #94

Closed
wants to merge 70 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
593500a
Add errorboundary with reset
C3ntraX Jan 6, 2024
6ca5030
Rework priced items
C3ntraX Jan 6, 2024
eece1c9
Show skeleton if plugin is not initiated
C3ntraX Jan 6, 2024
7b9415e
Show skeleton if plugin is not initiated
C3ntraX Jan 6, 2024
8cfb5f8
Merge branch 'PoeStack:main' into main
C3ntraX Feb 26, 2024
469ccb0
Merge branch 'forked/main'
C3ntraX Feb 26, 2024
fa1c1d8
feat: notifications
C3ntraX Feb 27, 2024
10d1f02
fix: request caching
C3ntraX Feb 29, 2024
a155a3e
feat: improvments to notifications
C3ntraX Feb 29, 2024
785288f
fix: request caching for my listings
C3ntraX Feb 29, 2024
1f361da
feat: improve notificationsystem
C3ntraX Feb 29, 2024
b720800
feat: improve notificationsystem
C3ntraX Mar 3, 2024
712f882
feat: added loading spinner for requests
C3ntraX Mar 3, 2024
cccaff3
feat: loading spinner for whisper improvments
C3ntraX Mar 3, 2024
a2c8897
feat: add errorboundary with reset
C3ntraX Mar 3, 2024
90f58b5
feat: errorhandling & migrations
C3ntraX Mar 3, 2024
ad963c1
fix: copy whisper spinner
C3ntraX Mar 3, 2024
bcd2154
feat: add animations to my offerings
C3ntraX Mar 5, 2024
48024aa
feat: column resize indicator on hover
C3ntraX Mar 5, 2024
b543242
feat: add notification settings
C3ntraX Mar 5, 2024
77f800c
refactor: navbar header
C3ntraX Mar 6, 2024
10c5c7a
refactor: navbar header
C3ntraX Mar 8, 2024
0e4671e
refactor: navbar header
C3ntraX Mar 8, 2024
0921a0b
feat: listingspage combobox as category select
C3ntraX Mar 9, 2024
7f18f97
feat: trade-filter improvements
C3ntraX Mar 9, 2024
53973f3
refactor: keyframes location
C3ntraX Mar 9, 2024
3a1cf77
feat: add subcategory support & persist listingmode per category
C3ntraX Mar 9, 2024
ab936fe
feat: support multiple subcategory to list
C3ntraX Mar 9, 2024
465f5ea
fix: copy whisper & loading
C3ntraX Mar 9, 2024
ba1b336
refactor: move discord link to the right
C3ntraX Mar 10, 2024
01d4777
fix: timestamp calculations
C3ntraX Mar 11, 2024
871c21c
refactor: notification settings dialog adjustments
C3ntraX Mar 11, 2024
ddfa440
refactor: category resolution
C3ntraX Mar 11, 2024
dd1812c
feat: subcategory autoselect & disable unselectable
C3ntraX Mar 11, 2024
24e8071
fix: autoselect loading
C3ntraX Mar 11, 2024
af42671
feat: remove unneccesrary shown league for character select
C3ntraX Mar 11, 2024
38991a4
refactor: simplyfy autofetching for notifications and listings
C3ntraX Mar 11, 2024
4bf627b
improve: autofetching for notifications and listings
C3ntraX Mar 11, 2024
a40b710
fix: correct distinction between leagues
C3ntraX Mar 11, 2024
27731db
feat: support count filter
C3ntraX Mar 11, 2024
409d974
feat: change multiplier handling to reset to 100
C3ntraX Mar 12, 2024
9402a74
refactor: extract columns and cells
C3ntraX Mar 12, 2024
17c3982
fix: my-offering animations twice
C3ntraX Mar 12, 2024
3741129
fix: remove sparkline for only 1 value
C3ntraX Mar 12, 2024
e374eef
refactor: unify tables
C3ntraX Mar 12, 2024
c89c20f
fix: table default max width too large
C3ntraX Mar 12, 2024
2eba966
feat: remember open offerings-panel
C3ntraX Mar 12, 2024
f067a85
feat: add my-offerings loading indicator
C3ntraX Mar 12, 2024
715b1e4
fix: improve incorrect loading indicators for stash items
C3ntraX Mar 12, 2024
7045384
fix: improve incorrect loading indicators for stash items
C3ntraX Mar 12, 2024
34e11e2
fix: sparkline totalchange math calc error value
C3ntraX Mar 12, 2024
8fffbae
feat: column visibility and ordering for offeringspage
C3ntraX Mar 13, 2024
f8daf11
deps: bump versions
C3ntraX Mar 13, 2024
4ec817c
feat: table column settings with persistence
C3ntraX Mar 13, 2024
0d80f90
refactor: image sizes
C3ntraX Mar 13, 2024
0ac05c4
feat: add language support
C3ntraX Mar 14, 2024
e110f16
feat: support multiple languages
C3ntraX Mar 14, 2024
5b04e3d
feat: support multiple languages
C3ntraX Mar 14, 2024
a9f2cd4
feat: support multiple languages
C3ntraX Mar 14, 2024
79d8774
fix: missing useTranslation hook
C3ntraX Mar 15, 2024
a4ebb14
feat: support spanish and lang changer
C3ntraX Mar 15, 2024
02e0de2
fix: blueprint grouping & some adjustments
C3ntraX Mar 15, 2024
52462df
feat: rework categories and subcategories
C3ntraX Mar 16, 2024
c2e7a64
fix: filter items not shown after subcategory select
C3ntraX Mar 16, 2024
17fa8b9
feat: add skeleton to trade filter
C3ntraX Mar 16, 2024
98d0a73
feat: add badges to trade filter
C3ntraX Mar 16, 2024
3f46834
temp: remove blueprint once they are fixed
C3ntraX Mar 16, 2024
f2eaff0
fix: summaries are not requestable for some tags
C3ntraX Mar 16, 2024
532f26a
feat: update languages for new categories
C3ntraX Mar 16, 2024
aaf0ca0
refactor: item group hashes for blueprints; contracts; logbooks
C3ntraX Mar 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/echo-app/package-lock.json

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

1 change: 1 addition & 0 deletions src/echo-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"pino-pretty": "^10.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.12",
"react-hook-form": "^7.49.2",
"react-i18next": "^13.5.0",
"rxjs": "^7.8.1",
Expand Down
13 changes: 13 additions & 0 deletions src/echo-plugins/networth-plugin/package-lock.json

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

1 change: 1 addition & 0 deletions src/echo-plugins/networth-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"object-hash": "^3.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.12",
"react-hook-form": "^7.49.2",
"react-i18next": "^13.4.1",
"rxjs": "^7.8.1",
Expand Down
134 changes: 47 additions & 87 deletions src/echo-plugins/networth-plugin/src/components/Columns/Columns.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ColumnDef, filterFns } from '@tanstack/react-table'
import { rarityColors, currencyChangeColors } from '../../assets/theme'
import { getRarity, parseTabNames } from '../../utils/item.utils'
import { getRarity, parseTabNames, parseUnsafeHashProps } from '../../utils/item.utils'
import { SageValuation, cn } from 'echo-common'
import { CurrencySwitch } from '../../store/settingStore'
import { IPricedItem } from '../../interfaces/priced-item.interface'
import { IDisplayedItem } from '../../interfaces/priced-item.interface'
import { observer } from 'mobx-react'
import { useStore } from '../../hooks/useStore'
import { TableColumnHeader } from './ColumnHeader'
Expand All @@ -14,18 +14,18 @@ import { formatValue } from '../../utils/currency.utils'
import * as Highcharts from 'highcharts'
import HighchartsReact from 'highcharts-react-official'
import { Badge } from 'echo-common/components-v1'
import { SageItemGroup } from 'sage-common'

type PricedItem = keyof IPricedItem | 'cumulative'
type DisplayedItem = keyof IDisplayedItem | keyof SageItemGroup | 'cumulative'

export function itemIcon(options: {
accessorKey: PricedItem
header: string
}): ColumnDef<IPricedItem> {
const { header, accessorKey } = options
export function itemIcon(): ColumnDef<IDisplayedItem> {
const key: DisplayedItem = 'icon'
const header = 'icon'

return {
header: ({ column }) => <TableColumnHeader column={column} title={header} align="left" />,
accessorKey,
accessorKey: key,
accessorFn: (val) => val.icon,
size: 65,
minSize: 52,
enableSorting: false,
Expand All @@ -34,21 +34,19 @@ export function itemIcon(options: {
headerWording: header
},
cell: ({ row }) => {
const value = row.getValue<string>(accessorKey)
const value = row.getValue<string>(key)
return <ItemIconCell value={value} frameType={row.original.frameType} />
}
}
}

export function itemName(options: {
accessorKey: PricedItem
header: string
}): ColumnDef<IPricedItem> {
const { header, accessorKey } = options
export function itemName(): ColumnDef<IDisplayedItem> {
const key: DisplayedItem = 'displayName'
const header = 'name'

return {
header: ({ column }) => <TableColumnHeader column={column} title={header} align="left" />,
accessorKey,
accessorKey: key,
enableSorting: true,
enableGlobalFilter: true,
size: 300,
Expand All @@ -57,21 +55,20 @@ export function itemName(options: {
headerWording: header
},
cell: ({ row }) => {
const value = row.getValue<string>(accessorKey)
const value = row.getValue<string>(key)
return <ItemNameCell value={value} frameType={row.original.frameType} />
}
}
}

export function itemTag(options: {
accessorKey: PricedItem
header: string
}): ColumnDef<IPricedItem> {
const { header, accessorKey } = options
export function itemTag(): ColumnDef<IDisplayedItem> {
const key: DisplayedItem = 'tag'
const header = 'tag'

return {
header: ({ column }) => <TableColumnHeader column={column} title={header} align="left" />,
accessorKey,
accessorKey: key,
accessorFn: (val) => val.group?.tag,
enableSorting: true,
enableGlobalFilter: true,
size: 65,
Expand All @@ -80,51 +77,20 @@ export function itemTag(options: {
headerWording: header
},
cell: ({ row }) => {
const value = row.getValue<string>(accessorKey)
const value = row.getValue<string>(key)
return <ItemTagCell value={value} />
}
}
}

export function itemProps(options: {
accessorKey: PricedItem
header: string
}): ColumnDef<IPricedItem> {
const { header, accessorKey } = options
export function itemProps(): ColumnDef<IDisplayedItem> {
const key: DisplayedItem = 'unsafeHashProperties'
const header = 'properties'

return {
header: ({ column }) => <TableColumnHeader column={column} title={header} align="left" />,
accessorKey,
accessorFn: (val) => {
const hashProps = Object.entries(val.unsafeHashProperties || {})
.filter(([name, value]) => {
const excludeNameByIncludes = (name: string) =>
!['mods', 'Mods'].some((key) => name.includes(key))

const excludeFalseValues = (value: any) => {
if (!value || value === '0') return false
return true
}
return excludeNameByIncludes(name) && excludeFalseValues(value)
})
.map(([name, value]) => {
let displayValue = `${name}: ${value}`
// Name only
if (value === true) {
displayValue = name
}
return { name, value, displayValue }
})

if (val.key && val.name.toLowerCase() !== val.key.toLowerCase()) {
// Used for contract or cluster jewels
hashProps.push({ name: val.name, value: val.key, displayValue: val.key })
}

hashProps.sort((a, b) => a.displayValue.length - b.displayValue.length)
// Filterfn does not work, when an object is returned
return hashProps.map((p) => `${p.name};;${p.displayValue}`).join(';;;')
},
accessorKey: key,
accessorFn: (val) => parseUnsafeHashProps(val),
enableSorting: true,
enableGlobalFilter: true,
size: 400,
Expand All @@ -133,47 +99,43 @@ export function itemProps(options: {
headerWording: header
},
cell: ({ row }) => {
const value = row.getValue<string>(accessorKey)
const value = row.getValue<string>(key)
return <ItemPropsCell value={value} />
}
}
}

export function itemTabs(options: {
accessorKey: PricedItem
header: string
}): ColumnDef<IPricedItem> {
const { header, accessorKey } = options
export function itemTabs(): ColumnDef<IDisplayedItem> {
const key: DisplayedItem = 'tab'
const header = 'tab'

return {
header: ({ column }) => <TableColumnHeader column={column} title={header} align="left" />,
accessorKey,
accessorKey: key,
accessorFn: (val) => parseTabNames(val.tab),
enableSorting: true,
enableGlobalFilter: true,
size: 180,
minSize: 75,
meta: {
headerWording: header
},
accessorFn: (val) =>
val.tab && typeof val.tab === 'object' ? parseTabNames(val.tab || []) : '',
cell: ({ row }) => {
const value = row.getValue<string>(accessorKey)
const value = row.getValue<string>(key)
return <ItemTabsCell value={value} />
}
}
}

export function itemQuantity(options: {
accessorKey: PricedItem
header: string
diff?: boolean
}): ColumnDef<IPricedItem> {
const { header, accessorKey, diff } = options
export function itemQuantity(options: { diff?: boolean }): ColumnDef<IDisplayedItem> {
const { diff } = options

const key: DisplayedItem = 'stackSize'
const header = 'quantity'

return {
header: ({ column }) => <TableColumnHeader column={column} title={header} align="right" />,
accessorKey,
accessorKey: key,
enableSorting: true,
enableGlobalFilter: false,
size: 110,
Expand All @@ -183,21 +145,19 @@ export function itemQuantity(options: {
},
// maxSize: 80,
cell: ({ row }) => {
const value = row.getValue<number>(accessorKey)
const value = row.getValue<number>(key)
return <ItemQuantityCell quantity={value} diff={diff} />
}
}
}

export function sparkLine(options: {
accessorKey: PricedItem
header: string
}): ColumnDef<IPricedItem> {
const { accessorKey, header } = options
export function sparkLine(): ColumnDef<IDisplayedItem> {
const key: DisplayedItem = 'valuation'
const header = 'priceLast24Hours'

return {
header: ({ column }) => <TableColumnHeader column={column} title={header} align="right" />,
accessorKey,
accessorKey: key,
accessorFn: (pricedItem) => {
const valuation = pricedItem.valuation
if (!valuation) return 0
Expand Down Expand Up @@ -225,20 +185,20 @@ export function sparkLine(options: {
},
cell: ({ row }) => {
const value = row.original.valuation
const totalChange = row.getValue<number>(accessorKey)
const totalChange = row.getValue<number>(key)
return <SparklineCell valuation={value} totalChange={totalChange} />
}
}
}

export function itemValue(options: {
accessorKey: PricedItem
accessorKey: DisplayedItem
header: string
cumulative?: boolean
showChange?: boolean
toCurrency?: 'chaos' | 'divine' | 'both'
enableSorting?: boolean
}): ColumnDef<IPricedItem> {
}): ColumnDef<IDisplayedItem> {
const { header, accessorKey, cumulative, showChange, toCurrency, enableSorting } = options

return {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { observer } from 'mobx-react-lite'
import React from 'react'
import { Button, Card } from 'echo-common/components-v1'
import { FallbackProps, useErrorBoundary } from 'react-error-boundary'
import { resetStore } from '../..'
import { resetAll } from '../../db'
import { app } from '@electron/remote'

const ErrorBoundaryFallback: React.FC<FallbackProps> = ({ error }) => {
// const { resetBoundary } = useErrorBoundary()

return (
<div className="flex justify-center w-full h-full items-center">
<Card className="max-w-[380px] w-full">
<Card.Header>
<Card.Title>Ouch.... the plugin crashed...</Card.Title>
<Card.Description>
The plugin creashed, please send us more information...
</Card.Description>
</Card.Header>
<Card.Content>
<p>
The plugin is probably corrupted. The only option currently is to reset the plugin. If
you know what this issue might be, please create an issue on Github{' '}
<a href="https://github.com/C3ntraX/poestack-sage/issues" className="underline">
here.
</a>
</p>
<span></span>
</Card.Content>
<Card.Footer>
<Button
className="w-full"
onClick={() => {
resetAll().then(() => {
app.relaunch()
app.quit()
// --- This following is somehow not working
// resetStore()
// resetBoundary()
})
}}
>
Reset & Restart app
</Button>
</Card.Footer>
</Card>
</div>
)
}

export default observer(ErrorBoundaryFallback)
Loading
Loading