Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ <h2 mat-dialog-title>Create form field</h2>
<mat-label>Field name</mat-label>
<input formControlName="label" matInput required />
</mat-form-field>
@if(type === 'select'){
<p>Options for the select field</p>
@for(option of options.controls; track option; let i = $index){
<div class="flex gap-2">
<mat-form-field>
<mat-label>Option {{ i + 1 }}</mat-label>
<input matInput [formControlName]="i" required />
</mat-form-field>
<button mat-icon-button (click)="options.removeAt(i)">
<mat-icon svgIcon="icon-delete-forever"></mat-icon>
@if (type === 'select') {
<p>Options for the select field</p>
@for (option of options.controls; track option; let i = $index) {
<div class="flex gap-2">
<mat-form-field>
<mat-label>Option {{ i + 1 }}</mat-label>
<input matInput [formControlName]="i" required />
</mat-form-field>
<button mat-icon-button (click)="options.removeAt(i)">
<mat-icon svgIcon="icon-delete-forever"></mat-icon>
</button>
</div>
}
<button mat-button (click)="addOption()">
<mat-icon svgIcon="icon-add"></mat-icon>Add option
</button>
</div>
}
<button mat-button (click)="addOption()">
<mat-icon svgIcon="icon-add"></mat-icon>Add option
</button>
}
</form>
</mat-dialog-content>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
@for (field of formFields();track field) {
<div class="flex mb-4 gap-6 items-center">
<div class="flex flex-col">
<div class="flex gap-2">
<p>{{ field.label }}</p>
<p
class="rounded-md whitespace-nowrap mt-0.5 px-1.5 py-0.5 text-xs font-medium ring-1 ring-inset text-gray-600 bg-gray-50 ring-gray-500/10"
>
{{ field.type }}
</p>
</div>
@if (field.type === 'select') {
<div class="flex gap-2">
<p>Available options:</p>
<div class="flex flex-wrap gap-2">
@for (option of field.options;track option) {
<p>{{ option }}</p>
}
@for (field of formFields(); track field) {
<div class="flex mb-4 gap-6 items-center">
<div class="flex flex-col">
<div class="flex gap-2">
<p>{{ field.label }}</p>
<p
class="rounded-md whitespace-nowrap mt-0.5 px-1.5 py-0.5 text-xs font-medium ring-1 ring-inset text-gray-600 bg-gray-50 ring-gray-500/10"
>
{{ field.type }}
</p>
</div>
@if (field.type === 'select') {
<div class="flex gap-2">
<p>Available options:</p>
<div class="flex flex-wrap gap-2">
@for (option of field.options; track option) {
<p>{{ option }}</p>
}
</div>
</div>
}
</div>
}
<button mat-flat-button (click)="removeField(field.label)">
<mat-icon svgIcon="icon-delete-forever"></mat-icon>
Delete field
</button>
</div>
<button mat-flat-button (click)="removeField(field.label)">
<mat-icon svgIcon="icon-delete-forever"></mat-icon>
Delete field
</button>
</div>
} @empty {
<p class="mb-2">
You have not added any fields to this form, add one to get started
</p>
<button mat-raised-button (click)="addField()" class="mr-4">
<mat-icon svgIcon="icon-add"></mat-icon>
Add new field
</button>
} @if (formFields().length) {
<button mat-stroked-button (click)="addField()" class="mr-4">
<mat-icon svgIcon="icon-add"></mat-icon>
Add new field
</button>
<p class="mb-2">
You have not added any fields to this form, add one to get started
</p>
<button mat-raised-button (click)="addField()" class="mr-4">
<mat-icon svgIcon="icon-add"></mat-icon>
Add new field
</button>
}
@if (formFields().length) {
<button mat-stroked-button (click)="addField()" class="mr-4">
<mat-icon svgIcon="icon-add"></mat-icon>
Add new field
</button>
}
<button
(click)="fieldChange.emit(formFields())"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
<div [formGroup]="form" class="mt-6 grid lg:grid-cols-2 gap-4">
@for (field of formConfig;track field) { @switch (field.type) { @case ('text')
{
<mat-form-field>
<mat-label>{{ field.label }}</mat-label>
<input matInput [formControlName]="field.label" />
<mat-error>This field is required</mat-error>
</mat-form-field>
} @case ('select') {
<mat-form-field>
<mat-label>{{ field.label }}</mat-label>
<mat-select [formControlName]="field.label">
@for (option of field.options;track option) {
<mat-option [value]="option">
{{ option }}
</mat-option>
@for (field of formConfig; track field) {
@switch (field.type) {
@case ('text') {
<mat-form-field>
<mat-label>{{ field.label }}</mat-label>
<input matInput [formControlName]="field.label" />
<mat-error>This field is required</mat-error>
</mat-form-field>
}
</mat-select>
<mat-error>This field is required</mat-error>
</mat-form-field>
} } }
@case ('select') {
<mat-form-field>
<mat-label>{{ field.label }}</mat-label>
<mat-select [formControlName]="field.label">
@for (option of field.options; track option) {
<mat-option [value]="option">
{{ option }}
</mat-option>
}
</mat-select>
<mat-error>This field is required</mat-error>
</mat-form-field>
}
}
}
</div>
121 changes: 65 additions & 56 deletions src/app/components/navigation/navigation.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,66 @@
data-testid="navigation"
(click)="preventProp($event)"
>
@if (tenantInfo$ | async;as tenant) { @if
(tenant?.settings?.brandIconUrl?.length) {
<a
matRipple
class="mb-4 hidden h-[64px] min-h-[64px] w-full items-center bg-indigo-700 sm:flex"
routerLink="/events"
>
<img
class="p-4"
width="192"
height="192"
[ngSrc]="tenant.settings.brandIconUrl ?? ''"
alt="ESN Star"
/>
</a>
} @else {

<a
matRipple
class="mb-4 hidden h-[64px] min-h-[64px] w-full items-center bg-indigo-700 sm:flex"
routerLink="/events"
>
<img
class="p-9 w-auto h-auto"
ngSrc="/assets/logos/star-white.svg"
alt="ESN Star"
height="16"
width="16"
/>
</a>

} }
@if (tenantInfo$ | async; as tenant) {
@if (tenant?.settings?.brandIconUrl?.length) {
<a
matRipple
class="mb-4 hidden h-[64px] min-h-[64px] w-full items-center bg-indigo-700 sm:flex"
routerLink="/events"
>
<img
class="p-4"
width="192"
height="192"
[ngSrc]="tenant.settings.brandIconUrl ?? ''"
alt="ESN Star"
/>
</a>
} @else {
<a
matRipple
class="mb-4 hidden h-[64px] min-h-[64px] w-full items-center bg-indigo-700 sm:flex"
routerLink="/events"
>
<img
class="p-9 w-auto h-auto"
ngSrc="/assets/logos/star-white.svg"
alt="ESN Star"
height="16"
width="16"
/>
</a>
}
}
<div
class="flex h-full flex-1 flex-row items-center gap-0 sm:mx-2 sm:flex-col sm:gap-3"
>
@if (tenantInfo$ | async;as tenant) { @switch (tenant.homePageStrategy) {
@case (HomePageStrategy.Static) {
<a class="nav-item" routerLink="home" routerLinkActive="active">
<mat-icon svgIcon="icon-home" matRipple></mat-icon>
<span>Home</span>
</a>
} @case (HomePageStrategy.Markdown) {
<a class="nav-item" routerLink="/page/about" routerLinkActive="active">
<mat-icon svgIcon="icon-home" matRipple></mat-icon>
<span>Home</span>
</a>
} @case (HomePageStrategy.Link) {
<a class="nav-item" [href]="tenant.homePageLink" target="_blank">
<mat-icon svgIcon="icon-home" matRipple></mat-icon>
<span>Home</span>
</a>
} } }
@if (tenantInfo$ | async; as tenant) {
@switch (tenant.homePageStrategy) {
@case (HomePageStrategy.Static) {
<a class="nav-item" routerLink="home" routerLinkActive="active">
<mat-icon svgIcon="icon-home" matRipple></mat-icon>
<span>Home</span>
</a>
}
@case (HomePageStrategy.Markdown) {
<a
class="nav-item"
routerLink="/page/about"
routerLinkActive="active"
>
<mat-icon svgIcon="icon-home" matRipple></mat-icon>
<span>Home</span>
</a>
}
@case (HomePageStrategy.Link) {
<a class="nav-item" [href]="tenant.homePageLink" target="_blank">
<mat-icon svgIcon="icon-home" matRipple></mat-icon>
<span>Home</span>
</a>
}
}
}
<a
class="nav-item"
routerLink="events"
Expand Down Expand Up @@ -104,13 +112,14 @@
<mat-icon svgIcon="icon-maintenance" matRipple></mat-icon>
<span>Settings</span>
</a>
@if ((tenantInfo$ | async)?.settings?.showPWAInstall) { @if (installEvent$ |
async;as event) {
<button class="nav-item" (click)="event.prompt()">
<mat-icon svgIcon="icon-software-installer" matRipple></mat-icon>
<span>Install the app</span>
</button>
} }
@if ((tenantInfo$ | async)?.settings?.showPWAInstall) {
@if (installEvent$ | async; as event) {
<button class="nav-item" (click)="event.prompt()">
<mat-icon svgIcon="icon-software-installer" matRipple></mat-icon>
<span>Install the app</span>
</button>
}
}

<div class="hidden flex-1 sm:block"></div>
<a
Expand Down
Loading