Skip to content

Commit

Permalink
Ui updates
Browse files Browse the repository at this point in the history
  • Loading branch information
AppsusUK committed Sep 21, 2021
1 parent a3d06e7 commit cf7fb28
Show file tree
Hide file tree
Showing 9 changed files with 247 additions and 43 deletions.
68 changes: 42 additions & 26 deletions src/app/home/home.component.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
<div style="padding: 64px 8vw" fxLayout="column" fxLayoutAlign="start start" fxLayoutGap="64px">
<div style="padding: 64px 8vw" fxLayout="column" fxLayoutAlign="start center" fxLayoutGap="64px">

<div fxLayout="row" fxLayoutAlign="start start" fxLayoutGap="64px">

<div class="raised" style="padding: 16px; background-color: white; ">
<h3>Config</h3>
<div class="raised config-container" fxLayout="column" fxLayoutGap="12px" fxLaoyoutAlign="start start">

<span class="light-text" style=" font-weight: 600; font-size: 16px;">Config</span>

<div fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="16px">

<button mat-stroked-button (click)="loadNftFolderStructure()">Load Input Folder</button>
<!-- <button mat-stroked-button (click)="loadNftFolderStructure()">Load Input Folder</button> -->

<app-main-button
buttonText="Select Input Folder"
(customClick)="loadNftFolderStructure()"
[disabled]="generating"
matTooltip="Select input folder with image layer folders"
style="padding-bottom: 15px;"
></app-main-button>

<div style="font-size: 12px;">
<mat-form-field appearance="fill">
Expand All @@ -32,16 +42,16 @@ <h3>Config</h3>
<mat-option value="ethereum">Ethereum</mat-option>
<mat-option value="solana">Solana</mat-option>
</mat-select>
<mat-hint align="end">Used for metadata generation</mat-hint>
<mat-hint align="end" style="color:#adadad">Used for metadata generation</mat-hint>
</mat-form-field>
</div>
</div>
</div>


<div fxLayout="column" fxLayoutGap="12px">
<button mat-raised-button color="primary" [disabled]="layers.length <= 0 || layerRarityFormGroup?.invalid || itemRarityFolderRarityFormGroup?.invalid || generating" (click)="generateNfts()">Generate NFTS</button>
<button mat-raised-button color="primary" [disabled]="!generating" (click)="stopGeneration()">Stop</button>
<div fxLayout="column" fxLayoutGap="12px" style="height: 120px">
<button mat-raised-button color="blueGrad" [disabled]="layers.length <= 0 || layerRarityFormGroup?.invalid || itemRarityFolderRarityFormGroup?.invalid || generating" (click)="generateNfts()">Generate NFTS</button>
<button mat-raised-button color="warn" [disabled]="!generating" (click)="stopGeneration()">Stop</button>

<mat-progress-bar
*ngIf="generating"
Expand All @@ -50,7 +60,8 @@ <h3>Config</h3>
[value]="(currentNftImage/generationLimitControl.value)*100">
</mat-progress-bar>

<span *ngIf="generating" >Current: {{currentNftImage}} out of {{generationLimitControl.value}}</span>
<span *ngIf="generating" class="light-text">Current: {{currentNftImage}} out of {{generationLimitControl.value}}</span>

</div>
</div>

Expand All @@ -71,26 +82,26 @@ <h3>Config</h3>

<div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start center">

<strong style="padding-bottom: 1em; font-size: 1.17em;">Layer Order</strong>
<strong class="light-text" style="padding-bottom: 1em; font-size: 1.17em;">Layer Order</strong>

<mat-icon style="font-size: 12px; cursor: default;" matTooltip='Give an order to your layers. "1" will be placed first and "5" will be last in the image.'>help_outline</mat-icon>
<mat-icon style="font-size: 12px; cursor: default; color: #adadad" matTooltip='Give an order to your layers. "1" will be placed first and "5" will be last in the image.'>help_outline</mat-icon>

</div>



<div cdkDropList class="example-list" *ngIf="nftDirectory?.layers" fxLayout='column' fxLayoutGap='6px' (cdkDropListDropped)="drop($event)">
<div *ngFor="let layer of layers;let i = index;" fxLayout='row' fxLayoutGap='12px' cdkDrag class="example-box" [cdkDragDisabled]="generating">
<div *ngFor="let layer of layers;let i = index;" fxLayout="row" fxLayoutGap='12px' fxLayoutAlign="space-between center" cdkDrag class="example-box" [cdkDragDisabled]="generating">


<span>{{i+1}}</span>
<span class="light-text" style="font-weight: 600; font-size: 1rem; padding-bottom: 15px;">{{i+1}}</span>


<div style="font-size: 12px;">
<mat-form-field appearance="fill" >
<mat-form-field appearance="fill" [style.width.px]=150>
<mat-label>{{layer.split('_').join(' ') | titlecase}}</mat-label>
<input matInput placeholder="5" type="number" [formControlName]="layer" required min="0" max="100" (change)="setNftFolderRarities()">
<span matSuffix>%</span>
<span matSuffix class="light-text">%</span>
</mat-form-field>
</div>

Expand All @@ -107,28 +118,26 @@ <h3>Config</h3>
<div [formGroup]="itemRarityFolderRarityFormGroup" *ngIf="itemRarityFolderRarityFormGroup" class="layer-weighting">


<!-- <h3 style="margin-top: 0;">Rarity Probability </h3> -->

<div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start center">

<strong style="padding-bottom: 1em; font-size: 1.17em;">Rarity Percentage </strong>
<strong class="light-text" style="padding-bottom: 1em; font-size: 1.17em;">Rarity Percentage </strong>

<mat-icon style="font-size: 12px; cursor: default;" matTooltip="Rarity probabilities must add up to 100%">help_outline</mat-icon>
<mat-icon style="font-size: 12px; cursor: default; color:#adadad" matTooltip="Rarity probabilities must add up to 100%">help_outline</mat-icon>

</div>


<div *ngIf="commonItemRarityFolders" fxLayout='column' fxLayoutGap='24px' class="example-list" style="width: 164px;">

<div *ngFor="let rarityFolder of commonItemRarityFolders;" fxLayout='row' fxLayoutGap='12px' class="example-box" style="cursor: default;">
<!-- <div>{{rarityFolder}}</div>
<input type="number" name="layer-weighting" [formControlName]="rarityFolder" min="0" max="100">% -->
<div *ngFor="let rarityFolder of commonItemRarityFolders;" fxLayout="row" fxLayoutAlign="center center" fxLayoutGap='12px' class="example-box" style="cursor: default;">


<div style="font-size: 12px;">
<mat-form-field appearance="fill" [style.width.px]=150>
<mat-label>{{rarityFolder.split('_').join(' ') | titlecase}}</mat-label>
<input matInput placeholder="5" type="number" [formControlName]="rarityFolder" required min="0" max="100" (change)="setNftFolderRarities()">
<span matSuffix>%</span>
<span matSuffix class="light-text">%</span>
</mat-form-field>
</div>

Expand All @@ -139,14 +148,21 @@ <h3>Config</h3>



<div fxLayout="column" fxLayoutGap="32px" *ngIf="layerRarityFormGroup && itemRarityFolderRarityFormGroup" style="max-width: 500px;">
<div fxLayout="column" fxLayoutGap="32px" *ngIf="layerRarityFormGroup && itemRarityFolderRarityFormGroup" style="max-width: 500px;">

<strong class="light-text" style="margin-top: 0; font-size: 1.17em;">Preview: {{NftBaseName.value}}{{currentNftImage}}</strong>

<strong style="margin-top: 0; font-size: 1.17em;">Preview: {{NftBaseName.value}}{{currentNftImage}}</strong>
<img [src]="randomImageUrl" style="background-color: #1C1922; height: 500px; width: 500px; border-radius: 15px;">

<img [src]="randomImageUrl" style="background-color: white; height: 500px; width: 500px; border-radius: 15px;">
<app-main-button
buttonText="Random"
(customClick)="populateRandomImage()"
[disabled]="generating"
matTooltip="Generate a random preview image (does not save image)"
></app-main-button>


<button mat-raised-button color="accent" (click)="populateRandomImage()" [disabled]="generating" matTooltip="Generate a random preview image (does not save image).">Random</button>
<!-- <button mat-raised-button color="accent" (click)="populateRandomImage()" [disabled]="generating" matTooltip="Generate a random preview image (does not save image).">Random</button> -->
</div>

</div>
Expand Down
29 changes: 16 additions & 13 deletions src/app/home/home.component.scss
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
.container{
// background-color: #181818;
height: 100%;

$darkest-blue: #1C1922;
$gray-blue: #2F3250;
$light-blue: #6fbbee;
$main-blue: #047ef0;


.config-container{
background-color: $gray-blue;
padding: 16px;
}


.example-list {
width: 240px;
max-width: 100%;
border: solid 1px #ccc;
// border: solid 1px $main-blue;
// min-height: 60px;
display: block;
background: white;
background: #2f3240;
border-radius: 15px;
overflow: hidden;
}

.example-box {
padding: 12px 6px;
border-bottom: solid 1px #ccc;
padding: 12px 24px;
border-bottom: solid 1px $main-blue;
color: rgba(0, 0, 0, 0.87);
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
cursor: move;
background: white;
// background: $darkest-blue;
background: #2f3240;
font-size: 14px;
}

Expand Down
1 change: 1 addition & 0 deletions src/app/shared/components/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './page-not-found/page-not-found.component';
export * from './main-button/main-button.component';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- <div matRipple class="btn" fxLayout="row" fxLayoutAlign="center center">{{buttonText}}</div> -->

<button mat-button class="btn" (click)="onClick()" [disabled]="disabled">
<span style="padding: 10px 20px">{{buttonText}}</span>
</button>
70 changes: 70 additions & 0 deletions src/app/shared/components/main-button/main-button.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
.btn {
background: linear-gradient(to right, #6fbbee 0%, #047ef0 100%);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
color: transparent;
font-weight: 600;
border-radius: 40px;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
font-size: 0.9rem;
margin: 0 auto;
outline: none;
position: relative;
z-index: 0;
text-decoration: none;
cursor: pointer;
user-select: none;
}

button {
outline:none;
border: none;
}



.btn::before {
content:"";
position:absolute;
z-index:-1;
top:0;
left:0;
right:0;
bottom:0;
border-radius: 40px;
border: 2px solid transparent;
border-radius: 40px;
background: inherit;
background-origin:border-box;
background-clip:border-box;
-webkit-mask:
linear-gradient(#fff 0 0) padding-box,
linear-gradient(#fff 0 0);
-webkit-mask-composite:destination-out;
mask-composite: exclude;
-webkit-mask-repeat:no-repeat;
}
/**/
.btn:hover:enabled {
color: #fff;
-webkit-text-fill-color: #fff;
-webkit-background-clip: border-box;
background-clip: border-box;
}

.btn:disabled {
color: gray;
border: 2px solid gray;
background: transparent;
-webkit-text-fill-color: gray;
-webkit-background-clip: border-box;
background-clip: border-box;
}

.btn:hover::before {
-webkit-mask:none;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { MainButtonComponent } from './main-button.component';

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

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ MainButtonComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(MainButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
22 changes: 22 additions & 0 deletions src/app/shared/components/main-button/main-button.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';

@Component({
selector: 'app-main-button',
templateUrl: './main-button.component.html',
styleUrls: ['./main-button.component.scss']
})
export class MainButtonComponent implements OnInit {
@Input() buttonText: string = "";
@Input() disabled: boolean = false;
@Output() customClick = new EventEmitter();

constructor() { }

ngOnInit(): void {
}

onClick() {
this.customClick.emit();
}

}
16 changes: 13 additions & 3 deletions src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import {MatSelectModule} from '@angular/material/select';
import {MatProgressBarModule} from '@angular/material/progress-bar';
import {MatTooltipModule} from '@angular/material/tooltip';
import {MatIconModule} from '@angular/material/icon';
import { MainButtonComponent } from './components/main-button/main-button.component';
import {MatRippleModule} from '@angular/material/core';

const modules = [
CommonModule,
Expand All @@ -33,14 +35,22 @@ const modules = [
MatSelectModule,
MatProgressBarModule,
MatTooltipModule,
MatIconModule
MatIconModule,
MatRippleModule

]

const components = [
PageNotFoundComponent,
WebviewDirective,
MainButtonComponent
]


@NgModule({
declarations: [PageNotFoundComponent, WebviewDirective],
declarations: [...components],
imports: [...modules],
exports: [...modules],
exports: [...modules, ...components],
providers: [TitleCasePipe]
})
export class SharedModule {}
Loading

0 comments on commit cf7fb28

Please sign in to comment.