Skip to content

Commit c465f4d

Browse files
committed
💄 add UI for specific folder
1 parent e0ef9b5 commit c465f4d

20 files changed

+296
-15
lines changed

src/app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { FeaturesModule } from './features/features.module';
99

1010
@NgModule({
1111
declarations: [
12-
AppComponent
12+
AppComponent,
1313
],
1414
imports: [
1515
BrowserModule,

src/app/core/interfaces/response.interface.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ export interface IFolderCreated {
1515
folder: Folder;
1616
msg: string;
1717
}
18+
19+
export interface IFolderResponse {
20+
ok: boolean,
21+
folder: Folder,
22+
}

src/app/core/services/folder.service.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ import { HttpClient } from '@angular/common/http';
22
import { EventEmitter, Injectable } from '@angular/core';
33
import { environment } from 'environments/environment';
44

5+
import { Observable, map } from 'rxjs';
6+
57
import { Folder } from '@models/folder.model';
68

7-
import { IFolderCreated } from '@interfaces/response.interface';
9+
import { IFolderCreated, IFolderResponse } from '@interfaces/response.interface';
810

911
import Storage from '@utils/storage.util';
1012

@@ -36,4 +38,9 @@ export class FolderService {
3638
}
3739
});
3840
}
41+
42+
getFolder(folderID: string): Observable<Folder> {
43+
const url = `${base_url}/folder/${folderID}`;
44+
return this.http.get<IFolderResponse>(url, this.headers).pipe(map(resp => resp.folder));
45+
}
3946
}

src/app/core/utils/mongo.util.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const MONGO_ID = /^[0-9a-fA-F]{24}$/;
2+
3+
export const isMongoId = (id: string): boolean => MONGO_ID.test(id);

src/app/features/features.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { RouterModule } from '@angular/router';
55
import { ComponentsModule } from '@components/components.module';
66

77
import { FeaturesComponent } from './features.component';
8+
import { FolderModule } from './folder/folder.module';
89
import { HomeModule } from './home/home.module';
910

1011
@NgModule({
@@ -15,7 +16,8 @@ import { HomeModule } from './home/home.module';
1516
CommonModule,
1617
RouterModule,
1718
ComponentsModule,
18-
HomeModule
19+
HomeModule,
20+
FolderModule
1921
]
2022
})
2123
export class FeaturesModule { }

src/app/features/features.routing.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ const routes: Routes = [
1313
loadChildren: () => import('./home/home.routing')
1414
.then(m => m.HomeRoutingModule),
1515
},
16+
{
17+
path: 'folder',
18+
component: FeaturesComponent,
19+
canActivate: [AuthGuard],
20+
loadChildren: () => import('./folder/folder.routing')
21+
.then(m => m.FolderRoutingModule)
22+
}
1623
];
1724

1825
@NgModule({
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { CommonModule } from '@angular/common';
2+
import { NgModule } from '@angular/core';
3+
4+
import { TableFilesComponent } from './table-files/table-files.component';
5+
6+
@NgModule({
7+
declarations: [
8+
TableFilesComponent
9+
],
10+
imports: [
11+
CommonModule
12+
],
13+
exports: [
14+
TableFilesComponent,
15+
]
16+
})
17+
export class ComponentsModule { }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<div class="items">
2+
<div class="item">
3+
<div class="icon">
4+
<i class="bx bx-file"></i>
5+
</div>
6+
<div class="name">
7+
<span>Ejemplo de dock</span>
8+
</div>
9+
<div class="type">
10+
<span>mp4</span>
11+
</div>
12+
<div class="size">
13+
<span>7 mb</span>
14+
</div>
15+
<div class="actions">
16+
...
17+
</div>
18+
</div>
19+
</div>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
@import 'settings/_colors.scss';
2+
@import 'settings/_typography.scss';
3+
4+
.items {
5+
display: flex;
6+
flex-direction: column;
7+
8+
& .item {
9+
display: flex;
10+
flex-direction: row;
11+
align-items: center;
12+
height: 3.2rem;
13+
padding: 0 0.5rem;
14+
gap: 1rem;
15+
border-radius: 1rem;
16+
transition: 0.3s ease;
17+
cursor: pointer;
18+
19+
&:hover {
20+
background: var(--bg-hover-2);
21+
}
22+
23+
& .icon {
24+
@include fs-3;
25+
width: 2.5rem;
26+
height: 2.5rem;
27+
border-radius: 50%;
28+
background: var(--bg-2);
29+
display: flex;
30+
align-items: center;
31+
justify-content: center;
32+
}
33+
34+
& .name, & .type, & .size {
35+
overflow: hidden;
36+
text-overflow: ellipsis;
37+
white-space: nowrap;
38+
}
39+
40+
& .name {
41+
@include fs-5;
42+
@include fw-400;
43+
flex: 2;
44+
color: var(--fc-primary);
45+
}
46+
47+
& .type, & .size {
48+
@include fs-6;
49+
flex: 1;
50+
color: var(--fc-secondary);
51+
text-align: center;
52+
}
53+
54+
& .actions {
55+
flex: 1;
56+
text-align: center;
57+
}
58+
}
59+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { TableFilesComponent } from './table-files.component';
4+
5+
describe('TableFilesComponent', () => {
6+
let component: TableFilesComponent;
7+
let fixture: ComponentFixture<TableFilesComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [ TableFilesComponent ]
12+
})
13+
.compileComponents();
14+
});
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(TableFilesComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});

0 commit comments

Comments
 (0)