diff --git a/src/queries/all-equipment/index.ts b/src/queries/all-equipment/index.ts
index 8849fd8..780e595 100644
--- a/src/queries/all-equipment/index.ts
+++ b/src/queries/all-equipment/index.ts
@@ -2,7 +2,6 @@ import {pipe} from 'fp-ts/lib/function';
import * as TE from 'fp-ts/TaskEither';
import {render} from './render';
import {Query} from '../query';
-import {HttpResponse} from '../../types';
import {eq} from 'drizzle-orm';
import {SharedReadModel} from '../../read-models/shared-state';
import {
@@ -13,6 +12,7 @@ import {
} from '../../read-models/shared-state/state';
import {ViewModel} from './view-model';
import * as RA from 'fp-ts/ReadonlyArray';
+import {safe, toLoggedInContent} from '../../types/html';
const getAreas = (db: SharedReadModel['db']): ViewModel['areas'] => {
return pipe(
@@ -47,5 +47,5 @@ export const allEquipment: Query = deps => user =>
TE.of,
TE.let('areas', () => getAreas(deps.sharedReadModel.db)),
TE.map(render),
- TE.map(HttpResponse.CompleteHtmlPage)
+ TE.map(toLoggedInContent(safe('Equipment of Makespace')))
);
diff --git a/src/queries/all-equipment/render.ts b/src/queries/all-equipment/render.ts
index 918efd9..b16c7f1 100644
--- a/src/queries/all-equipment/render.ts
+++ b/src/queries/all-equipment/render.ts
@@ -8,7 +8,6 @@ import {
} from '../../types/html';
import * as RA from 'fp-ts/ReadonlyArray';
import {ViewModel} from './view-model';
-import {pageTemplate} from '../../templates';
const renderEquipment = (equipment: ViewModel['areas'][number]['equipment']) =>
pipe(
@@ -39,13 +38,9 @@ const renderArea = (area: ViewModel['areas'][number]) => html`
const renderAreas = (areas: ViewModel['areas']) =>
pipe(areas, RA.map(renderArea), joinHtml);
-export const render = (viewModel: ViewModel) =>
- pipe(
- html`
-
-
Equipment of Makespace
-
${renderAreas(viewModel.areas)}
-
- `,
- pageTemplate(safe('Equipment'), viewModel.user)
- );
+export const render = (viewModel: ViewModel) => html`
+
+
Equipment of Makespace
+
${renderAreas(viewModel.areas)}
+
+`;
diff --git a/src/queries/areas/index.ts b/src/queries/areas/index.ts
index 75b5cac..bdbd24b 100644
--- a/src/queries/areas/index.ts
+++ b/src/queries/areas/index.ts
@@ -2,7 +2,6 @@ import {pipe} from 'fp-ts/lib/function';
import * as TE from 'fp-ts/TaskEither';
import {render} from './render';
import {Query} from '../query';
-import {HttpResponse} from '../../types';
import {SharedReadModel} from '../../read-models/shared-state';
import {ViewModel} from './view-model';
import {
@@ -13,6 +12,7 @@ import {
} from '../../read-models/shared-state/state';
import * as RA from 'fp-ts/ReadonlyArray';
import {eq} from 'drizzle-orm';
+import {safe, toLoggedInContent} from '../../types/html';
const getAreas = (db: SharedReadModel['db']): ViewModel['areas'] => {
return pipe(
@@ -48,5 +48,5 @@ export const areas: Query = deps => user =>
TE.let('user', () => user),
TE.let('areas', () => getAreas(deps.sharedReadModel.db)),
TE.map(render),
- TE.map(HttpResponse.CompleteHtmlPage)
+ TE.map(toLoggedInContent(safe('Manage Areas and Owners')))
);
diff --git a/src/queries/areas/render.ts b/src/queries/areas/render.ts
index 7c5156f..9b5bb4e 100644
--- a/src/queries/areas/render.ts
+++ b/src/queries/areas/render.ts
@@ -8,7 +8,6 @@ import {
} from '../../types/html';
import * as RA from 'fp-ts/ReadonlyArray';
import {ViewModel} from './view-model';
-import {pageTemplate} from '../../templates';
import {renderMemberNumber} from '../../templates/member-number';
import * as O from 'fp-ts/Option';
import {displayDate} from '../../templates/display-date';
@@ -119,14 +118,10 @@ const addAreaCallToAction = html`
Add area of responsibility
`;
-export const render = (viewModel: ViewModel) =>
- pipe(
- html`
-
-
Manage Areas and Owners
-
${addAreaCallToAction}
-
${renderAreas(viewModel.areas)}
-
- `,
- pageTemplate(safe('Manage Areas and Owners'), viewModel.user)
- );
+export const render = (viewModel: ViewModel) => html`
+
+
Manage Areas and Owners
+
${addAreaCallToAction}
+
${renderAreas(viewModel.areas)}
+
+`;
diff --git a/src/queries/equipment/index.ts b/src/queries/equipment/index.ts
index c0afed6..f48942b 100644
--- a/src/queries/equipment/index.ts
+++ b/src/queries/equipment/index.ts
@@ -8,7 +8,6 @@ import {render} from './render';
import * as E from 'fp-ts/Either';
import {formatValidationErrors} from 'io-ts-reporters';
import {Query} from '../query';
-import {HttpResponse} from '../../types';
import {UUID} from 'io-ts-types';
const invalidParams = flow(
@@ -24,6 +23,5 @@ export const equipment: Query = deps => (user, params) =>
E.map(params => params.equipment),
TE.fromEither,
TE.chain(constructViewModel(deps, user)),
- TE.map(render),
- TE.map(HttpResponse.CompleteHtmlPage)
+ TE.map(render)
);
diff --git a/src/queries/equipment/render.ts b/src/queries/equipment/render.ts
index 845cc49..c595168 100644
--- a/src/queries/equipment/render.ts
+++ b/src/queries/equipment/render.ts
@@ -1,5 +1,4 @@
import {pipe} from 'fp-ts/lib/function';
-import {pageTemplate} from '../../templates';
import {displayDate} from '../../templates/display-date';
import {renderMemberNumber} from '../../templates/member-number';
import {
@@ -8,6 +7,7 @@ import {
joinHtml,
sanitizeOption,
sanitizeString,
+ toLoggedInContent,
} from '../../types/html';
import {ViewModel} from './view-model';
import * as O from 'fp-ts/Option';
@@ -313,5 +313,5 @@ export const render = (viewModel: ViewModel) =>
${isTrainerOrOwner(viewModel) ? trainingQuizResults(viewModel) : html``}
`,
- pageTemplate(sanitizeString(viewModel.equipment.name), viewModel.user)
+ toLoggedInContent(sanitizeString(viewModel.equipment.name))
);
diff --git a/src/queries/failed-imports/index.ts b/src/queries/failed-imports/index.ts
index e272d01..6fb3d81 100644
--- a/src/queries/failed-imports/index.ts
+++ b/src/queries/failed-imports/index.ts
@@ -3,12 +3,12 @@ import * as TE from 'fp-ts/TaskEither';
import {render} from './render';
import {constructViewModel} from './construct-view-model';
import {Query} from '../query';
-import {HttpResponse} from '../../types';
+import {safe, toLoggedInContent} from '../../types/html';
export const failedImports: Query = deps => user =>
pipe(
user,
constructViewModel(deps),
TE.map(render),
- TE.map(HttpResponse.CompleteHtmlPage)
+ TE.map(toLoggedInContent(safe('Failed Member Imports')))
);
diff --git a/src/queries/failed-imports/render.ts b/src/queries/failed-imports/render.ts
index 962e4be..0a26f8a 100644
--- a/src/queries/failed-imports/render.ts
+++ b/src/queries/failed-imports/render.ts
@@ -1,8 +1,7 @@
import {pipe} from 'fp-ts/lib/function';
-import {html, joinHtml, safe, sanitizeString} from '../../types/html';
+import {html, joinHtml, sanitizeString} from '../../types/html';
import {ViewModel} from './view-model';
import * as RA from 'fp-ts/ReadonlyArray';
-import {pageTemplate} from '../../templates';
const renderFailedLinkings = (failedImports: ViewModel['failedImports']) =>
pipe(
@@ -20,15 +19,11 @@ const renderFailedLinkings = (failedImports: ViewModel['failedImports']) =>
`
);
-export const render = (viewModel: ViewModel) =>
- pipe(
- html`
- Failed member imports
-
- During import from the legacy database the following members could not
- be imported because the email address is already used by another member.
-
- ${renderFailedLinkings(viewModel.failedImports)}
- `,
- pageTemplate(safe('Failed member imports'), viewModel.user)
- );
+export const render = (viewModel: ViewModel) => html`
+ Failed member imports
+
+ During import from the legacy database the following members could not be
+ imported because the email address is already used by another member.
+
+ ${renderFailedLinkings(viewModel.failedImports)}
+`;
diff --git a/src/queries/log/index.ts b/src/queries/log/index.ts
index 47b7b32..6234aa0 100644
--- a/src/queries/log/index.ts
+++ b/src/queries/log/index.ts
@@ -3,12 +3,12 @@ import * as TE from 'fp-ts/TaskEither';
import {render} from './render';
import {constructViewModel} from './construct-view-model';
import {Query} from '../query';
-import {HttpResponse} from '../../types';
+import {safe, toLoggedInContent} from '../../types/html';
export const log: Query = deps => user =>
pipe(
user,
constructViewModel(deps),
TE.map(render),
- TE.map(HttpResponse.CompleteHtmlPage)
+ TE.map(toLoggedInContent(safe('Event Log')))
);
diff --git a/src/queries/log/render.ts b/src/queries/log/render.ts
index dc1ce10..759dff5 100644
--- a/src/queries/log/render.ts
+++ b/src/queries/log/render.ts
@@ -1,11 +1,10 @@
import {pipe} from 'fp-ts/lib/function';
import * as RA from 'fp-ts/ReadonlyArray';
-import {html, joinHtml, safe, sanitizeString} from '../../types/html';
+import {html, joinHtml, sanitizeString} from '../../types/html';
import {ViewModel} from './view-model';
import {DomainEvent} from '../../types';
import {inspect} from 'node:util';
import {displayDate} from '../../templates/display-date';
-import {pageTemplate} from '../../templates';
import {DateTime} from 'luxon';
import {renderActor} from '../../types/actor';
@@ -41,12 +40,8 @@ const renderLog = (log: ViewModel['events']) =>
`
);
-export const render = (viewModel: ViewModel) =>
- pipe(
- html`
- Event log
- Most recent at top
- ${renderLog(viewModel.events)}
- `,
- pageTemplate(safe('Event Log'), viewModel.user)
- );
+export const render = (viewModel: ViewModel) => html`
+ Event log
+ Most recent at top
+ ${renderLog(viewModel.events)}
+`;
diff --git a/src/queries/member/index.ts b/src/queries/member/index.ts
index 342b130..0f3ebcf 100644
--- a/src/queries/member/index.ts
+++ b/src/queries/member/index.ts
@@ -9,7 +9,7 @@ import {failureWithStatus} from '../../types/failure-with-status';
import {StatusCodes} from 'http-status-codes';
import {formatValidationErrors} from 'io-ts-reporters';
import * as tt from 'io-ts-types';
-import {HttpResponse} from '../../types';
+import {safe, toLoggedInContent} from '../../types/html';
const invalidParams = flow(
formatValidationErrors,
@@ -25,6 +25,6 @@ export const member: Query = deps => (user, params) =>
E.map(constructViewModel(deps, user)),
E.flatten,
E.map(viewModel => render(viewModel)),
- E.map(HttpResponse.CompleteHtmlPage),
+ E.map(toLoggedInContent(safe('Member'))),
TE.fromEither
);
diff --git a/src/queries/member/render.ts b/src/queries/member/render.ts
index c792f02..21ac637 100644
--- a/src/queries/member/render.ts
+++ b/src/queries/member/render.ts
@@ -1,14 +1,6 @@
-import {pipe} from 'fp-ts/lib/function';
import {getGravatarProfile, getGravatarThumbnail} from '../../templates/avatar';
-import {
- Html,
- html,
- sanitizeOption,
- safe,
- sanitizeString,
-} from '../../types/html';
+import {Html, html, sanitizeOption, sanitizeString} from '../../types/html';
import {ViewModel} from './view-model';
-import {pageTemplate} from '../../templates';
import {renderMemberNumber} from '../../templates/member-number';
import {renderOwnerAgreementStatus} from '../shared-render/owner-agreement';
import {renderOwnerStatus} from '../shared-render/owner-status';
@@ -33,78 +25,74 @@ const editAvatar = () =>
const ifSelf = (viewModel: ViewModel, fragment: Html) =>
viewModel.isSelf ? fragment : '';
-export const render = (viewModel: ViewModel) =>
- pipe(
- html`
- ${ifSelf(viewModel, ownPageBanner)}
-
- ${getGravatarProfile(
- viewModel.member.gravatarHash,
- viewModel.member.memberNumber
- )}
-
-
-
- Details
-
-
-
- Member number |
- ${renderMemberNumber(viewModel.member.memberNumber)} |
-
-
- Email |
- ${sanitizeString(viewModel.member.emailAddress)} |
-
-
- Name |
+export const render = (viewModel: ViewModel) => html`
+ ${ifSelf(viewModel, ownPageBanner)}
+
+ ${getGravatarProfile(
+ viewModel.member.gravatarHash,
+ viewModel.member.memberNumber
+ )}
+
+
+
+ Details
+
+
+
+ Member number |
+ ${renderMemberNumber(viewModel.member.memberNumber)} |
+
+
+ Email |
+ ${sanitizeString(viewModel.member.emailAddress)} |
+
+
+ Name |
+
+ ${sanitizeOption(viewModel.member.name)}
+ ${ifSelf(viewModel, editName(viewModel))}
+ |
+
+
+ Pronouns |
+
+ ${sanitizeOption(viewModel.member.pronouns)}
+ ${ifSelf(viewModel, editPronouns(viewModel))}
+ |
+
+
+ Avatar |
+
+ ${getGravatarThumbnail(
+ viewModel.member.gravatarHash,
+ viewModel.member.memberNumber
+ )}
+ ${ifSelf(viewModel, editAvatar())}
+ |
+
+
+ Owner of |
+ ${renderOwnerStatus(viewModel.member.ownerOf, true)} |
+
+ ${viewModel.isSuperUser
+ ? html`
+ Owner agreement |
- ${sanitizeOption(viewModel.member.name)}
- ${ifSelf(viewModel, editName(viewModel))}
- |
-
-
- Pronouns |
-
- ${sanitizeOption(viewModel.member.pronouns)}
- ${ifSelf(viewModel, editPronouns(viewModel))}
- |
-
-
- Avatar |
-
- ${getGravatarThumbnail(
- viewModel.member.gravatarHash,
- viewModel.member.memberNumber
+ ${renderOwnerAgreementStatus(
+ viewModel.member.agreementSigned,
+ true
)}
- ${ifSelf(viewModel, editAvatar())}
|
-
-
- Owner of |
- ${renderOwnerStatus(viewModel.member.ownerOf, true)} |
-
- ${viewModel.isSuperUser
- ? html`
- Owner agreement |
-
- ${renderOwnerAgreementStatus(
- viewModel.member.agreementSigned,
- true
- )}
- |
-
`
- : html``}
-
- Trainer for |
- ${renderTrainerStatus(viewModel.member.trainerFor)} |
-
-
- Trained on |
- ${renderTrainingStatus(viewModel.member.trainedOn, true)} |
-
-
-
- `,
- pageTemplate(safe('Member'), viewModel.user)
- );
+
`
+ : html``}
+
+ Trainer for |
+ ${renderTrainerStatus(viewModel.member.trainerFor)} |
+
+
+ Trained on |
+ ${renderTrainingStatus(viewModel.member.trainedOn, true)} |
+
+
+
+`;
diff --git a/src/queries/members/index.ts b/src/queries/members/index.ts
index 347ca1b..a106155 100644
--- a/src/queries/members/index.ts
+++ b/src/queries/members/index.ts
@@ -3,12 +3,12 @@ import * as TE from 'fp-ts/TaskEither';
import {render} from './render';
import {constructViewModel} from './construct-view-model';
import {Query} from '../query';
-import {HttpResponse} from '../../types';
+import {safe, toLoggedInContent} from '../../types/html';
export const members: Query = deps => user =>
pipe(
user,
constructViewModel(deps),
TE.map(render),
- TE.map(HttpResponse.CompleteHtmlPage)
+ TE.map(toLoggedInContent(safe('Members')))
);
diff --git a/src/queries/members/render.ts b/src/queries/members/render.ts
index b6b6c67..f13813d 100644
--- a/src/queries/members/render.ts
+++ b/src/queries/members/render.ts
@@ -1,18 +1,11 @@
import {pipe} from 'fp-ts/lib/function';
-import {
- html,
- joinHtml,
- sanitizeOption,
- safe,
- sanitizeString,
-} from '../../types/html';
+import {html, joinHtml, sanitizeOption, sanitizeString} from '../../types/html';
import * as N from 'fp-ts/number';
import {contramap, Ord} from 'fp-ts/Ord';
import * as RA from 'fp-ts/ReadonlyArray';
import {ViewModel} from './view-model';
import {getGravatarThumbnail} from '../../templates/avatar';
import {renderMemberNumber} from '../../templates/member-number';
-import {pageTemplate} from '../../templates';
import {Member} from '../../read-models/members';
const ordByMemberNumber: Ord = pipe(
@@ -58,11 +51,7 @@ const renderMembers = (viewModel: ViewModel) =>
)
);
-export const render = (viewModel: ViewModel) =>
- pipe(
- html`
- Members of Makespace
- ${renderMembers(viewModel)}
- `,
- pageTemplate(safe('Members'), viewModel.user)
- );
+export const render = (viewModel: ViewModel) => html`
+ Members of Makespace
+ ${renderMembers(viewModel)}
+`;
diff --git a/src/queries/super-users/index.ts b/src/queries/super-users/index.ts
index 4326675..7cff7ed 100644
--- a/src/queries/super-users/index.ts
+++ b/src/queries/super-users/index.ts
@@ -3,12 +3,12 @@ import * as TE from 'fp-ts/TaskEither';
import {render} from './render';
import {constructViewModel} from './construct-view-model';
import {Query} from '../query';
-import {HttpResponse} from '../../types';
+import {safe, toLoggedInContent} from '../../types/html';
export const superUsers: Query = deps => user =>
pipe(
user,
constructViewModel(deps),
TE.map(render),
- TE.map(HttpResponse.CompleteHtmlPage)
+ TE.map(toLoggedInContent(safe('Super Users')))
);
diff --git a/src/queries/super-users/render.ts b/src/queries/super-users/render.ts
index d3793ae..97a22e2 100644
--- a/src/queries/super-users/render.ts
+++ b/src/queries/super-users/render.ts
@@ -1,9 +1,8 @@
import {pipe} from 'fp-ts/lib/function';
-import {html, joinHtml, safe} from '../../types/html';
+import {html, joinHtml} from '../../types/html';
import * as RA from 'fp-ts/ReadonlyArray';
import {ViewModel} from './view-model';
import {displayDate} from '../../templates/display-date';
-import {pageTemplate} from '../../templates';
import {renderMemberNumber} from '../../templates/member-number';
import {DateTime} from 'luxon';
@@ -38,13 +37,9 @@ const renderSuperUsers = (superUsers: ViewModel['superUsers']) =>
)
);
-export const render = (viewModel: ViewModel) =>
- pipe(
- html`
+export const render = (viewModel: ViewModel) => html`
Super-users
Declare a member to be a super-user
${renderSuperUsers(viewModel.superUsers)}
- `,
- pageTemplate(safe('Super users'), viewModel.user)
- );
+ `;