Skip to content

Commit

Permalink
Encapsulate renderCountWithDescriptor within html-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
giorgiosironi committed May 15, 2024
1 parent d26b4a1 commit 02f420c
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { htmlEscape } from 'escape-goat';
import * as RA from 'fp-ts/ReadonlyArray';
import { flow, pipe } from 'fp-ts/function';
import { renderCountWithDescriptor } from '../../../../../shared-components/render-count-with-descriptor';
import { HtmlFragment, toHtmlFragment } from '../../../../../types/html-fragment';
import { renderListOfCards } from '../../../shared-components/list-of-cards';
import { renderPaginationControls } from '../../../shared-components/pagination';
import { renderCountWithDescriptor } from '../../../shared-components/render-count-with-descriptor';
import { ViewModel, UserCardViewModel } from '../view-model';

const renderUserCard = (userCard: UserCardViewModel): HtmlFragment => toHtmlFragment(`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { renderListOfListCardsWithFallback } from './render-list-of-list-cards-with-fallback';
import { renderCountWithDescriptor } from '../../../../../shared-components/render-count-with-descriptor';
import { HtmlFragment, toHtmlFragment } from '../../../../../types/html-fragment';
import { renderCountWithDescriptor } from '../../../shared-components/render-count-with-descriptor';
import { ViewModel } from '../view-model';

const renderListCount = (listCount: ViewModel['listCount']) => `<p>This group has ${renderCountWithDescriptor(listCount, 'list', 'lists')}.</p>`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { htmlEscape } from 'escape-goat';
import * as O from 'fp-ts/Option';
import { flow, pipe } from 'fp-ts/function';
import { GroupCardViewModel } from './view-model';
import { renderCountWithDescriptor } from '../../../../shared-components/render-count-with-descriptor';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import { templateDate } from '../date';
import { renderCountWithDescriptor } from '../render-count-with-descriptor';

const wrapInSpan = (text: string) => toHtmlFragment(`<span>${text}</span>`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { htmlEscape } from 'escape-goat';
import * as O from 'fp-ts/Option';
import { pipe } from 'fp-ts/function';
import { safelyRenderRawUserInput } from '../../../../shared-components/raw-user-input-renderers';
import { renderCountWithDescriptor } from '../../../../shared-components/render-count-with-descriptor';
import { renderListPageLinkHref } from '../../../../shared-components/render-list-page-link-href';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import { ListId } from '../../../../types/list-id';
import { RawUserInput } from '../../../raw-user-input';
import { templateDate } from '../date';
import { renderCountWithDescriptor } from '../render-count-with-descriptor';

type Curator = {
avatarSrc: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import * as O from 'fp-ts/Option';
import * as RA from 'fp-ts/ReadonlyArray';
import * as RNEA from 'fp-ts/ReadonlyNonEmptyArray';
import { constant, flow, pipe } from 'fp-ts/function';
import { renderCountWithDescriptor } from '../../../../shared-components/render-count-with-descriptor';
import { ArticleAuthors } from '../../../../types/article-authors';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import { renderCountWithDescriptor } from '../render-count-with-descriptor';

type RenderAuthors = (authors: ArticleAuthors) => HtmlFragment;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as RA from 'fp-ts/ReadonlyArray';
import { pipe } from 'fp-ts/function';
import { ViewModel } from './view-model';
import { renderCountWithDescriptor } from '../../../../shared-components/render-count-with-descriptor';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import { renderLangAttribute } from '../lang-attribute';
import { renderCountWithDescriptor } from '../render-count-with-descriptor';

export const renderCurationStatements = (curationStatementsTeasers: ViewModel['curationStatementsTeasers']): HtmlFragment => {
if (curationStatementsTeasers.length === 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as O from 'fp-ts/Option';
import { constant, flow, pipe } from 'fp-ts/function';
import { ViewModel } from './view-model';
import { renderCountWithDescriptor } from '../../../../shared-components/render-count-with-descriptor';
import { HtmlFragment, toHtmlFragment } from '../../../../types/html-fragment';
import { templateDate } from '../date';
import { renderCountWithDescriptor } from '../render-count-with-descriptor';

const wrapInSpan = (text: string) => toHtmlFragment(`<span>${text}</span>`);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { renderCountWithDescriptor } from '../../../../../shared-components/render-count-with-descriptor';
import { NotHtml } from '../../../html-page';
import { renderCountWithDescriptor } from '../../../shared-components/render-count-with-descriptor';
import { ViewModel } from '../view-model';

export const renderDescription = (viewmodel: ViewModel): NotHtml => `${renderCountWithDescriptor(viewmodel.listCount, 'list', 'lists')} | Following ${renderCountWithDescriptor(viewmodel.groupIds.length, 'group', 'groups')}` as NotHtml;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { renderCountWithDescriptor } from '../../../../../shared-components/render-count-with-descriptor';
import { NotHtml } from '../../../html-page';
import { renderCountWithDescriptor } from '../../../shared-components/render-count-with-descriptor';
import { ViewModel } from '../view-model';

export const renderDescription = (viewmodel: ViewModel): NotHtml => `${renderCountWithDescriptor(viewmodel.listCount, 'list', 'lists')} | Following ${renderCountWithDescriptor(viewmodel.groupIds.length, 'group', 'groups')}` as NotHtml;

0 comments on commit 02f420c

Please sign in to comment.