Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cde create visualization page #340

Merged
merged 40 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
7252449
Make initial page outline
edlu77 Apr 1, 2024
9754423
Styling and fonts
edlu77 Apr 2, 2024
adaf132
Fix build targets
edlu77 Apr 2, 2024
aa3f7db
Merge branch 'cell-distance-explorer' of https://github.com/hubmapcon…
edlu77 Apr 2, 2024
27dfb9e
Edit output path
edlu77 Apr 2, 2024
d155d74
Switch to browser-esbuild
edlu77 Apr 2, 2024
156a685
Merge branch 'cell-distance-explorer' of https://github.com/hubmapcon…
edlu77 Apr 2, 2024
38c7932
Set up link to create visualization page
edlu77 Apr 2, 2024
74e420d
Fix issues and update logic
edlu77 Apr 3, 2024
d810ef9
Merge branch 'cell-distance-explorer' of https://github.com/hubmapcon…
edlu77 Apr 3, 2024
8e3de2f
Update package-lock.json
edlu77 Apr 3, 2024
38fed02
Improvements
edlu77 Apr 4, 2024
50c295c
Merge branch 'cell-distance-explorer' of https://github.com/hubmapcon…
edlu77 Apr 4, 2024
0c74468
Update package-lock.json
edlu77 Apr 4, 2024
87a9e59
Use reactive form controls
edlu77 Apr 4, 2024
bb25173
Move redirects file
edlu77 Apr 5, 2024
52a157f
Add cell type data service
edlu77 Apr 5, 2024
e387421
Check if data is uploaded when submitting
edlu77 Apr 5, 2024
4d8e542
Merge branch 'cell-distance-explorer' of https://github.com/hubmapcon…
edlu77 Apr 5, 2024
6200201
More changes
edlu77 Apr 12, 2024
e642958
Clean up and requested changes
edlu77 Apr 12, 2024
e6e8bf8
Merge branch 'cell-distance-explorer' of https://github.com/hubmapcon…
edlu77 Apr 12, 2024
b348eac
Use signals for file upload service
edlu77 Apr 12, 2024
149810a
Some tweaks
edlu77 Apr 12, 2024
8c65cc4
Use formBuilder to create and validate form
edlu77 Apr 15, 2024
bc74142
create file upload component
bhushankhope Apr 17, 2024
aa48d95
Merge branch 'cell-distance-explorer' into cde-create-visualization-page
axdanbol Apr 17, 2024
95ddf87
update form and its css
bhushankhope Apr 19, 2024
e1ba83d
create theme and modify cards
bhushankhope Apr 24, 2024
eef7ed0
add states to form field
bhushankhope Apr 25, 2024
dde2ecc
update background size
bhushankhope Apr 26, 2024
f2bf822
add tests for csv loader
bhushankhope May 7, 2024
139a43c
add tests for create vis page
bhushankhope May 9, 2024
392f975
add tests for form control directive
bhushankhope May 9, 2024
8e04576
Merge branch 'cell-distance-explorer' into cde-create-visualization-page
axdanbol May 10, 2024
ff7e3c6
build(cde): :wrench: Increase style files max size
axdanbol May 10, 2024
ad9090c
Merge branch 'cell-distance-explorer' of https://github.com/hubmapcon…
axdanbol May 16, 2024
42d145a
refactor(cde): :recycle: Post merge fixes
axdanbol May 16, 2024
635bc7a
docs(cde): :memo: Increase code doc coverage
axdanbol May 16, 2024
06847ff
refactor(cde): Fix import
axdanbol May 16, 2024
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
8 changes: 6 additions & 2 deletions apps/cde-ui/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
"tsConfig": "apps/cde-ui/tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": ["apps/cde-ui/src/favicon.ico", "apps/cde-ui/src/assets"],
"styles": ["apps/cde-ui/src/styles.scss"],
"styles": ["apps/cde-ui/src/styles.scss", "apps/cde-ui/src/assets/fonts/fonts.scss"],
edlu77 marked this conversation as resolved.
Show resolved Hide resolved
"stylePreprocessorOptions": {
"includePaths": ["node_modules/", "libs/shared/theming/src/lib/styles"]
},
"scripts": []
},
"configurations": {
Expand Down Expand Up @@ -80,5 +83,6 @@
"staticFilePath": "dist/apps/cde-ui/browser"
}
}
}
},
"implicitDependencies": ["shared-theming"]
}
2 changes: 1 addition & 1 deletion apps/cde-ui/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<cde-nx-welcome></cde-nx-welcome>
<cde-create-visualization-page></cde-create-visualization-page>
4 changes: 2 additions & 2 deletions apps/cde-ui/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Component } from '@angular/core';
import { NxWelcomeComponent } from './nx-welcome.component';
import { CreateVisualizationPageComponent } from './pages/create-visualization-page/create-visualization-page.component';

@Component({
standalone: true,
imports: [NxWelcomeComponent],
imports: [CreateVisualizationPageComponent],
selector: 'cde-root',
templateUrl: './app.component.html',
styleUrl: './app.component.scss',
Expand Down
3 changes: 2 additions & 1 deletion apps/cde-ui/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ApplicationConfig } from '@angular/core';
import { provideAnimations } from '@angular/platform-browser/animations';

export const appConfig: ApplicationConfig = {
providers: [],
providers: [provideAnimations()],
};
edlu77 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<img class="img-bg" src="assets/background.png" />
axdanbol marked this conversation as resolved.
Show resolved Hide resolved

<div class="content">
<span class="title">Create a Cell Distance Visualization</span>
edlu77 marked this conversation as resolved.
Show resolved Hide resolved

<mat-card class="creation-step">
<mat-card-header>
<mat-card-title>Format and Upload Data</mat-card-title>
</mat-card-header>
<mat-card-content> </mat-card-content>
<mat-card-actions>
<button mat-button *ngIf="!dataUploaded" (click)="upload()">Upload CSV</button>
axdanbol marked this conversation as resolved.
Show resolved Hide resolved
<button mat-button *ngIf="dataUploaded" (click)="removeCSV()">Upload CSV</button>
</mat-card-actions>
</mat-card>

<mat-card class="creation-step">
<mat-card-header>
<mat-card-title>Optional: Select Anchor Cell type</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-form-field>
<mat-select [(value)]="cellTypes[0].value" (selectionChange)="updateAnchorCellType($event.value)">
axdanbol marked this conversation as resolved.
Show resolved Hide resolved
@for (cell of cellTypes; track cell) {
<mat-option [value]="cell.value">{{ cell.viewValue }}</mat-option>
}
</mat-select>
</mat-form-field>
</mat-card-content>
</mat-card>

<mat-card class="creation-step metadata">
<mat-card-header>
<mat-card-title>Add Metadata</mat-card-title>
</mat-card-header>
<mat-card-content>
<div class="row-1">
Copy link
Contributor

Choose a reason for hiding this comment

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

Use grid layout

Copy link
Contributor

Choose a reason for hiding this comment

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

Use a hidden element after age input on larger breakpoints

Copy link
Contributor

Choose a reason for hiding this comment

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

Use flex with flex-wrap

<div>
<span>Visualization Title</span>
<mat-form-field>
<input matInput placeholder="Title" value="" />
</mat-form-field>
</div>
<div>
<span>Imaging Technology</span>
<mat-form-field>
<input matInput placeholder="Title" value="" />
</mat-form-field>
</div>
<div>
<span>Organ</span>
<mat-form-field>
<mat-select [(value)]="cellTypes[0].value" (selectionChange)="updateAnchorCellType($event.value)">
@for (cell of cellTypes; track cell) {
<mat-option [value]="cell.value">{{ cell.viewValue }}</mat-option>
}
</mat-select>
</mat-form-field>
</div>
</div>

<div class="row-2">
<div>
<span>Sex</span>
<mat-form-field>
<mat-select [(value)]="cellTypes[0].value" (selectionChange)="updateAnchorCellType($event.value)">
@for (cell of cellTypes; track cell) {
<mat-option [value]="cell.value">{{ cell.viewValue }}</mat-option>
}
</mat-select>
</mat-form-field>
</div>
<div>
<span>Age</span>
<mat-form-field>
<input matInput placeholder="Age" value="" />
</mat-form-field>
</div>
<div></div>
</div>

<div class="row-3">
<div>
<span>Thickness (um)</span>
<mat-form-field>
<input matInput placeholder="Thickness" value="" />
</mat-form-field>
</div>
<div>
<span>Pixel size (um/pixel)</span>
<mat-form-field>
<input matInput placeholder="Pixel size" value="" />
</mat-form-field>
</div>
<div></div>
</div>
</mat-card-content>
</mat-card>

<mat-card class="creation-step">
<mat-card-header>
<mat-card-title>Optional: Configure Color Map</mat-card-title>
</mat-card-header>
<mat-card-actions>
<mat-button-toggle-group aria-label="Font Style">
<mat-button-toggle value="default">Use Default Colors</mat-button-toggle>
<mat-button-toggle value="custom">Upload Custom Color Map</mat-button-toggle>
</mat-button-toggle-group>
</mat-card-actions>
</mat-card>

<mat-card class="creation-step">
<mat-card-header>
<mat-card-title>Visualize Cell Distance Data</mat-card-title>
</mat-card-header>
<mat-card-actions>
<button mat-button (click)="visualize.emit(settings)">Visualize</button>
</mat-card-actions>
</mat-card>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
:host {
Copy link
Contributor

Choose a reason for hiding this comment

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

Try to remove as many of the custom variables as possible since typography and theming has been merged

Copy link
Contributor

Choose a reason for hiding this comment

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

Prefer rem as the unit instead of px

--mat-card-title-text-font: 'Metropolis';
--mat-card-title-text-size: 42px;
--mat-card-title-text-line-height: 52.5px;
--mat-form-field-container-text-font: 'Metropolis';
--mat-select-trigger-text-font: 'Metropolis';
--mat-option-label-text-font: 'Metropolis';

display: flex;
flex-direction: column;
align-items: center;
gap: 5rem;
height: 100%;

.img-bg {
opacity: 0.45;
position: fixed;
width: 100%;
height: 100%;
object-fit: cover;
}

.content {
display: flex;
flex-direction: column;
gap: 5rem;
max-width: 72rem;

.title {
font-size: 72px;
font-weight: 500;
letter-spacing: -0.05em;
}

mat-card {
padding: 56px 64px;

mat-card-header {
padding: 0 0 3rem;
}

mat-card-content {
display: flex;
padding: 0;
}

mat-card-actions {
padding: 0;
}
}

.metadata {
mat-card-content {
flex-direction: column;
gap: 3rem;

.row-1,
.row-2,
.row-3 {
display: flex;
justify-content: space-between;

div {
display: flex;
flex-direction: column;
width: 288px;
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CreateVisualizationPageComponent } from './create-visualization-page.component';

describe('CreateVisualizationPageComponent', () => {
let component: CreateVisualizationPageComponent;
let fixture: ComponentFixture<CreateVisualizationPageComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [CreateVisualizationPageComponent],
}).compileComponents();

fixture = TestBed.createComponent(CreateVisualizationPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
edlu77 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import { CommonModule } from '@angular/common';
import { ChangeDetectionStrategy, Component, EventEmitter, Output } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { MatCardModule } from '@angular/material/card';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatSelectModule } from '@angular/material/select';

export interface VisualizationSettings {
axdanbol marked this conversation as resolved.
Show resolved Hide resolved
data: CellTypeTableData;
anchorCellType?: string;
metadata: MetaData;
colorMap: Color[];
}

export interface CellTypeTableData {
x: number;
y: number;
cellType: string;
z?: number;
ontologyId?: string;
}

export interface MetaData {
title?: string;
sex?: string;
thickness?: number;
technology?: string;
age?: number;
pixelSize?: number;
organ?: string;
}

export interface Color {
cellType: number[];
}

export interface CellTypeOption {
value: string;
default?: boolean;
viewValue: string;
}

const defaultSettings: VisualizationSettings = {
data: {
x: 0,
y: 0,
cellType: '',
},
metadata: {},
colorMap: [],
};

@Component({
selector: 'cde-create-visualization-page',
standalone: true,
imports: [
CommonModule,
MatCardModule,
MatButtonToggleModule,
MatButtonModule,
MatFormFieldModule,
MatSelectModule,
MatInputModule,
FormsModule,
],
templateUrl: './create-visualization-page.component.html',
styleUrl: './create-visualization-page.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CreateVisualizationPageComponent {
settings: VisualizationSettings = defaultSettings;

dataUploaded = false;

@Output() readonly visualize = new EventEmitter<VisualizationSettings>();

selectedValue: string = 'a';

cellTypes: CellTypeOption[] = [
{ value: 'a', viewValue: 'Endothelial', default: true },
{ value: 'b', viewValue: 'B' },
{ value: 'c', viewValue: 'C' },
];

upload() {
this.dataUploaded = true;
//load the data
edlu77 marked this conversation as resolved.
Show resolved Hide resolved
}

removeCSV() {
this.dataUploaded = false;
this.settings.data = {
axdanbol marked this conversation as resolved.
Show resolved Hide resolved
x: 0,
y: 0,
cellType: '',
};
}

updateAnchorCellType(value: string) {
this.settings = { ...this.settings, anchorCellType: value };
}
}
Binary file added apps/cde-ui/src/assets/background.png
axdanbol marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
axdanbol marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
13 changes: 13 additions & 0 deletions apps/cde-ui/src/assets/fonts/fonts.scss
edlu77 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@font-face {
font-family: 'Metropolis';
font-style: normal;
font-weight: 400;
src: url('./metropolis.regular.otf') format('truetype');
}

@font-face {
font-family: 'Metropolis';
font-style: bold;
font-weight: 500;
src: url('./metropolis.medium.otf') format('truetype');
}
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions apps/cde-ui/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500&display=swap" rel="stylesheet" />
axdanbol marked this conversation as resolved.
Show resolved Hide resolved
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
</head>
<body>
<cde-root></cde-root>
Expand Down
Loading
Loading