Skip to content

BOS-63: Changed/added/refactored frontend data classes#72

Open
robpatterson13 wants to merge 1 commit intomainfrom
rob-63-create-modify-frontend-classes
Open

BOS-63: Changed/added/refactored frontend data classes#72
robpatterson13 wants to merge 1 commit intomainfrom
rob-63-create-modify-frontend-classes

Conversation

@robpatterson13
Copy link

ℹ️ Issue

Closes #63

📝 Description

Added Genre, InventoryLocation, Theme, Author, and Story interfaces, added Library class, and refactored Anthology interface to a) be a class, and b) pull author, genre, and theme information from fields instead of being hardcoded as part of the Anthology class.

Additionally, refactored parts of the frontend logic to match the new structure of the objects and ensure that object data is loaded correctly (ex. authors show on publication card, genres/themes show as tags and info, etc.)

Finally, updated static anthologies to use new structures.

✔️ Verification

The static data can be found in apps/frontend/src/utils/mock-data.ts.

Screenshot 2026-01-25 at 3 41 04 PM Screenshot 2026-01-25 at 3 40 57 PM Screenshot 2026-01-25 at 3 40 46 PM Screenshot 2026-01-25 at 3 40 36 PM

🏕️ Future Work / Notes

Some visual problems with the tags being displayed: for example, having a large number of tags for a certain anthology will cause them to run off screen. Additionally, inventory information (names and num_copies) are close together, causing name of inventory locations to wrap when they should be displayed in a single line.

Copy link
Collaborator

@GauriRajesh733 GauriRajesh733 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks really good!! just added comments on small changes we made to the backend entities after the client meeting that would be nice to have reflected in the frontend interfaces too!

PERFECT_BOUND = 'PerfectBound',
SIGNATURE = 'Signature',
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the client meeting we made some changes to the anthology backend entity so that general book info and additional metadata such as production info are stored separately. For Anthology, the only fields needed are id, title, description, published_year, programs, status, pub_level, photo_url, isbn, and shopify_url. For the other production related information, I would create an additional interface called ProductionInfo that stores id, anthology_id, design_files_link, cover_image_file_link, binding_type, dimensions, printing_cost, print_run, weight_in_grams, page_count, and printed_by. You can see more details on the updated backend entities in our ticket notes for this week!

@@ -0,0 +1,5 @@
export interface InventoryLocation {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now have an inventory-holding join table in the backend that has an id, inventory_id, anthology_id, and num_copies. However since we only have to display this info on the frontend it might be convenient to just store id, inventory_name, anthology_name, and num_copies in InventoryLocation.

import { Author } from './author';
import { Genre } from './genre';
import { Theme } from './theme';

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After client meeting added an additional draft_status field (see checkbox columns in Document Tracker tab for stories in an anthology in OMCHAI Tracker). I will check with Josie about this but I think draft_status should be DraftStatus[] where DraftStatus is an enum that can be (Submission1, Submission2, Submission3, AuthorApproval, FileConsent, AuthorBio, InManuscript, CopyEdit1, CopyEdit2, PubTeamProofread, ContactInfo). This is definitely something I did not think of when we were writing this ticket initially so if you think there's a better way to keep track of these checks for a stories I'm open to ideas!!

SIGNATURE = 'Signature',
}

export class Anthology {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change Anthology to an interface and make the methods free-standing getters since a publication will need be edited in the tracker view!

export interface Story {
id: number;
title: string;
anthology_id: number;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

author can be Author instead of Author[]

id: number;
title: string;
anthology_id: number;
authors: Author[];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

genres and themes can both be changed to string[]!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create/modify frontend data classes : dev [medium time length]

3 participants