ts4nfdi / terminology-service-suite

The Terminology Service Suite project is a collection of interactive widgets designed to ease the integration of terminology service functions into third-party applications.
https://ts4nfdi.github.io/terminology-service-suite/comp/latest/
MIT License
16 stars 2 forks source link

TabWidget might be redundant #146

Open Pooya-Oladazimi opened 1 month ago

Pooya-Oladazimi commented 1 month ago

The TabWidget's use case is not entirely clear. It can be seen as a special case for the MetadataWidget. If we hide the term label, description, and iri in MetadataWidget, it becomes a TabWidget.

I noticed this during this issue implementation: https://github.com/ts4nfdi/terminology-service-suite/pull/145

Is there any usecase for having a standalone TabWidget?

jusa3 commented 3 weeks ago

No, I can't think of a use case yet. Same with the Synonym and CrossRef widgets. We created the MetadataWidget from the different components and it wasn't an additional effort to create a widget from each component. Once we had all these widgets, it seemed more efficient to use only the presentation components within the MetadataWidget, so we have the standalone TabWidget now. Why do you ask? Maybe there will be a use case in the future.

Pooya-Oladazimi commented 3 weeks ago

@jusa3

I was just slightly irritated by maintaining and double-implementing tab hide/show for it. I was wondering why am I doing the same thing in two places. Not urgent though.

export type TabWidgetProps = ApiObj & OptionalEntityTypeObj & OptionalOntologyIdObj & ForcedIriObj & TermParameterObj & UseLegacyObj & TabList;

export type MetadataWidgetProps = ApiObj &
    OptionalEntityTypeObj &
    OptionalOntologyIdObj &
    ForcedIriObj &
    TermParameterObj &
    UseLegacyObj &
    OnNavigateToOntology &
    TabList &
    {
        /**
         * The term backlink. User can use this to make the term's label a link. For example, a link to the term page on a terminology service.
         */
        termLink?: string;
    };
function TabWidget(props: TabWidgetProps) {
  const { iri, api, ontologyId, entityType, parameter, useLegacy, hierarchyTab, crossRefTab, terminologyInfoTab, altNamesTab, ...rest } = props;
.....

function MetadataWidget(props: MetadataWidgetProps) {
  const { iri, api, ontologyId, entityType, parameter, useLegacy, onNavigateToOntology, hierarchyTab, crossRefTab, terminologyInfoTab, altNamesTab, termLink } = props;

.....
jusa3 commented 3 weeks ago

Right, I see what you mean. This could definitely be optimised by implementing it as a special case for the MetadataWidget.