aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionCardDeckView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-05-18 23:15:49 -0400
committerbobzel <zzzman@gmail.com>2024-05-18 23:15:49 -0400
commit9badfc489f00afd10489f0dde0a3b9e21817feb5 (patch)
treeb69d90fb3525d0bfca4a107ec1640e4706c0dfb6 /src/client/views/collections/CollectionCardDeckView.tsx
parent38d2d361aa723917b5721e2635933d2d8b9f483a (diff)
more cardView cleanup
Diffstat (limited to 'src/client/views/collections/CollectionCardDeckView.tsx')
-rw-r--r--src/client/views/collections/CollectionCardDeckView.tsx20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/client/views/collections/CollectionCardDeckView.tsx b/src/client/views/collections/CollectionCardDeckView.tsx
index 9e5668ffa..5f8ddd5c1 100644
--- a/src/client/views/collections/CollectionCardDeckView.tsx
+++ b/src/client/views/collections/CollectionCardDeckView.tsx
@@ -75,7 +75,7 @@ export class CollectionCardView extends CollectionSubView() {
componentDidMount(): void {
this._disposers.sort = reaction(
- () => ({ cardSort: this.cardSort, field: this.customSortField }),
+ () => ({ cardSort: this.cardSort, field: this.cardSort_customField }),
({ cardSort, field }) => (cardSort === cardSortings.Custom && field === 'chat' ? this.openChatPopup() : GPTPopup.Instance.setVisible(false))
);
}
@@ -85,8 +85,8 @@ export class CollectionCardView extends CollectionSubView() {
this._dropDisposer?.();
}
- @computed get customSortField() {
- return StrCast(this.Document.customSortField) as any as 'chat' | 'star' | 'idea' | 'like';
+ @computed get cardSort_customField() {
+ return StrCast(this.Document.cardSort_customField) as any as 'chat' | 'star' | 'idea' | 'like';
}
@computed get cardSort() {
@@ -115,12 +115,12 @@ export class CollectionCardView extends CollectionSubView() {
*/
@computed get childDocsWithoutLinks() {
const regularDocs = this.childDocs.filter(l => l.type !== DocumentType.LINK);
- const activeGroups = NumListCast(this.Document.visibleGroupNumbers);
+ const activeGroups = NumListCast(this.Document.cardSort_visibleSortGroups);
if (activeGroups.length > 0 && this.cardSort === cardSortings.Custom) {
return regularDocs.filter(doc => {
// Get the group number for the current index
- const groupNumber = CollectionCardView.getButtonGroup(this.customSortField, doc);
+ const groupNumber = CollectionCardView.getButtonGroup(this.cardSort_customField, doc);
// Check if the group number is in the active groups
return groupNumber !== undefined && activeGroups.includes(groupNumber);
});
@@ -245,8 +245,8 @@ export class CollectionCardView extends CollectionSubView() {
return [DashColor(StrCast(docA.backgroundColor)).hsv().toString(), // If docA.type is undefined, use an empty string
DashColor(StrCast(docB.backgroundColor)).hsv().toString()]; // If docB.type is undefined, use an empty string
case cardSortings.Custom:
- return [CollectionCardView.getButtonGroup(this.customSortField, docA)??0,
- CollectionCardView.getButtonGroup(this.customSortField, docB)??0];
+ return [CollectionCardView.getButtonGroup(this.cardSort_customField, docA)??0,
+ CollectionCardView.getButtonGroup(this.cardSort_customField, docB)??0];
default: return [StrCast(docA.type), // If docA.type is undefined, use an empty string
StrCast(docB.type)]; // If docB.type is undefined, use an empty string
} // prettier-ignore
@@ -335,7 +335,7 @@ export class CollectionCardView extends CollectionSubView() {
* @param buttonID
* @param doc
*/
- toggleButton = undoable((buttonID: number, doc: Doc) => this.customSortField && (doc[this.customSortField] = buttonID), 'toggle custom button');
+ toggleButton = undoable((buttonID: number, doc: Doc) => this.cardSort_customField && (doc[this.cardSort_customField] = buttonID), 'toggle custom button');
/**
* A list of the text content of all the child docs. RTF documents will have just their text and pdf documents will have the first 50 words.
@@ -422,8 +422,8 @@ export class CollectionCardView extends CollectionSubView() {
*/
renderButtons = (doc: Doc, cardSort: cardSortings) => {
if (cardSort !== cardSortings.Custom) return '';
- const amButtons = Math.max(4, this.childDocs?.reduce((set, doc) => this.customSortField && set.add(NumCast(doc[this.customSortField])), new Set<number>()).size ?? 0);
- const activeButtonIndex = CollectionCardView.getButtonGroup(this.customSortField, doc);
+ const amButtons = Math.max(4, this.childDocs?.reduce((set, doc) => this.cardSort_customField && set.add(NumCast(doc[this.cardSort_customField])), new Set<number>()).size ?? 0);
+ const activeButtonIndex = CollectionCardView.getButtonGroup(this.cardSort_customField, doc);
const totalWidth = amButtons * 35 + amButtons * 2 * 5 + 6;
return (
<div className="card-button-container" style={{ width: `${totalWidth}px` }}>