Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
chinonso098 committed Aug 5, 2024
1 parent a065d6b commit d0bfec8
Show file tree
Hide file tree
Showing 15 changed files with 2,032 additions and 2,969 deletions.
4,694 changes: 1,790 additions & 2,904 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "cheetah-os",
"version": "0.0.0",
"version": "2.8.5",
"description": "Desktop environment in the browser",
"author": "CM",
"license": "GNU 3.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down Expand Up @@ -43,8 +43,8 @@
"html-to-image": "^1.11.11",
"ini": "^2.0.0",
"js-dos": "^7.4.7",
"monaco-editor": "^0.49.0",
"ngx-monaco-editor-v2": "^18.0.1",
"monaco-editor": "0.49.0",
"ngx-monaco-editor-v2": "18.0.1",
"notyf": "^3.10.0",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
Expand Down
6 changes: 5 additions & 1 deletion src/app/shared/system-component/menu/menu.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ span.dm-tail{
padding-left: 4px;
}

.dm-dsktp-mid{
.dm-dsktp-mid, .dm-dsktp-mid-disabled{
min-width: 50%;
padding: 0 4px;
color: black; /* Black text color */
Expand All @@ -238,6 +238,10 @@ span.dm-tail{
font-weight: normal;
}

.dm-dsktp-mid-disabled{
color: #969696c6;
}

.dm-dsktp-tail{
max-width: 25%;
padding-left: 62px;
Expand Down
25 changes: 20 additions & 5 deletions src/app/shared/system-component/menu/menu.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<span class="span dm-tail"> <figure class="dm-fig-cntxt-menu"> </figure> </span>
</div>

<div class="dm-empty-line-container" *ngIf="i === 2 || i === 4"></div>
<div class="dm-line-container" *ngIf="i === 2 || i === 4"><div class="dm-line"></div></div>
<div class="dm-empty-line-container" *ngIf="i === 2 || i === 4"></div>
<div class="dm-empty-line-container" *ngIf="i === 2 || i === 4 || i === 6"></div>
<div class="dm-line-container" *ngIf="i === 2 || i === 4 || i === 6"><div class="dm-line"></div></div>
<div class="dm-empty-line-container" *ngIf="i === 2 || i === 4 || i === 6"></div>
</div>

<div class="dm-empty-line-container"></div>
Expand Down Expand Up @@ -44,17 +44,32 @@
<div class="dm-dsktp-empty-line-container"></div>

<div class="dm-dsktp-vertical-sub-menu" *ngFor="let menuItem of desktopMenu" >
<div class="dm-dsktp-vertical-menu-item" (click)="onMenuItemClick(menuItem.action)">

<div *ngIf="menuItem.label !== paste" class="dm-dsktp-vertical-menu-item" (click)="onMenuItemClick(menuItem.action)">
<div class="dm-dsktp-head"><figure class="dm-dsktp-figure"><img *ngIf="menuItem.icon1" class="dm-dsktp-img" [src]="menuItem.icon1"/></figure></div>
<div class="dm-dsktp-mid"><p class="dm-dsktp-p"> {{menuItem.label}}</p></div>
<div class="dm-dsktp-tail"><figure class="dm-dsktp-figure"> <img *ngIf="menuItem.icon2" class="dm-dsktp-img" [src]="menuItem.icon2"/></figure></div>
</div>

<div *ngIf="menuItem.label === paste && isPasteActive" class="dm-dsktp-vertical-menu-item" (click)="onMenuItemClick(menuItem.action)">
<div class="dm-dsktp-head"><figure class="dm-dsktp-figure"><img *ngIf="menuItem.icon1" class="dm-dsktp-img" [src]="menuItem.icon1"/></figure></div>
<div class="dm-dsktp-mid"><p class="dm-dsktp-p"> {{menuItem.label}}</p></div>
<div class="dm-dsktp-tail"><figure class="dm-dsktp-figure"> <img *ngIf="menuItem.icon2" class="dm-dsktp-img" [src]="menuItem.icon2"/></figure></div>
</div>


<div *ngIf="menuItem.label === paste && !isPasteActive" class="dm-dsktp-vertical-menu-item turnOffHoverEffect ">
<div class="dm-dsktp-head"><figure class="dm-dsktp-figure"><img *ngIf="menuItem.icon1" class="dm-dsktp-img" [src]="menuItem.icon1"/></figure></div>
<div class="dm-dsktp-mid-disabled"><p class="dm-dsktp-p"> {{menuItem.label}}</p></div>
<div class="dm-dsktp-tail"><figure class="dm-dsktp-figure"> <img *ngIf="menuItem.icon2" class="dm-dsktp-img" [src]="menuItem.icon2"/></figure></div>
</div>


<div *ngIf="menuItem.nest.length" class="dm-dsktp-vertical-sub-menu-content" >
<div class="dm-dsktp-empty-line-container"></div>
<div *ngFor="let item of menuItem.nest" (click)="onMenuItemClick(item.action)">
<div class="dm-dsktp-vertical-menu-item">
<div class="dm-dsktp-head"><figure [ngClass]=" item.styleOption === 'A' ?'dm-dsktp-figure-alt' : 'dm-dsktp-figure-alt2'">

<img *ngIf="item.variables" [ngClass]=" item.styleOption === 'A' ?'dm-dsktp-img-alt' : 'dm-dsktp-img-alt2' " [src]="item.icon"/>
</figure>
</div>
Expand Down
35 changes: 31 additions & 4 deletions src/app/shared/system-component/menu/menu.component.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,47 @@
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { Component, Input, OnChanges, SimpleChanges, OnDestroy } from '@angular/core';
import {DesktopMenu, GeneralMenu } from './menu.item';
import { MenuService } from '../../system-service/menu.services';
import { Subscription } from 'rxjs';

@Component({
selector: 'cos-menu',
templateUrl: './menu.component.html',
styleUrls: ['./menu.component.css']
})
export class MenuComponent implements OnChanges {
export class MenuComponent implements OnChanges, OnDestroy{

@Input() generalMenu: GeneralMenu[] = [];

@Input() desktopMenu: DesktopMenu[] = [];

@Input() menuType = '';

private _menuService:MenuService;
private _storeDataSub!:Subscription;

menuOption = '';
fileExplrMngrMenuOption = "file-explorer-file-manager-menu";
tskBarMenuOption = "taskbar-menu";
deskTopMenuOption = "desktop-menu";
keys: string[] = [];
data = 'NOPATH';
paste = 'Paste';
actions:string[]=[];

isPasteActive = false;

constructor(menuService:MenuService) {
this._menuService = menuService;
this._storeDataSub = this._menuService.storeData.subscribe(p => {
this.data = p[0];
p.shift();
this.actions = [...p]

this.isPasteActive = this.activatePaste();
})
}

ngOnDestroy(): void {
this._storeDataSub?.unsubscribe();
}

ngOnChanges(changes: SimpleChanges):void{
this.menuOption = this.menuType;
Expand All @@ -32,4 +55,8 @@ export class MenuComponent implements OnChanges {
this.keys = Object.keys(obj);
}

activatePaste():boolean{
return (this.data === 'NOPATH')? false: true;
}

}
62 changes: 62 additions & 0 deletions src/app/shared/system-service/file.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,17 @@ export class FileService{

if(!extension){
const sc = await this.setFolderValuesAsync(path) as ShortCut;
const fileMetaData = await this.getExtraFileMetaDataAsync(path) as FileMetaData;

this._fileInfo.setIconPath = this.changeFolderIcon(sc.geFileName,sc.getIconPath);
this._fileInfo.setCurrentPath = path;
this._fileInfo.setFileType = sc.getFileType;
this._fileInfo.setFileName = sc.geFileName;
this._fileInfo.setOpensWith = sc.getOpensWith;
this._fileInfo.setIsFile = false;
this._fileInfo.setDateModified = fileMetaData.getModifiedDate;
this._fileInfo.setSize = fileMetaData.getSize;
this._fileInfo.setMode = fileMetaData.getMode;
}
else{

Expand Down Expand Up @@ -635,6 +640,63 @@ export class FileService{

}

//virtual filesystem, use copy and then delete
public async moveAsync(currentPath:string, newPath:string, isFile:boolean): Promise<boolean> {

return new Promise<boolean>((resolve, reject) =>{
let rename = ''; let type = ''
if(isFile){
const fileName = this.getFileName(currentPath)
rename = `${newPath}/${fileName}`; type = 'file';
}else{
const fileName = this.getFileName(currentPath)
rename = `${newPath}/${fileName}`; type = 'folder';
}


console.log(`currentPath: ${currentPath}`);
console.log(`newPath: ${newPath}`);
console.log(`rename:${rename}`);

this._fileSystem.readFile(currentPath, (err, contents = Buffer.from('')) =>{
if(err){
console.log('getFile in moveAsync error:',err)
reject(false)
}else{
this._fileSystem.writeFile(`${rename}`, contents,(err)=>{
if(err){
console.log('writeFile in moveAsync error:',err);
reject(false);
}else{
if(isFile){
this._fileSystem.unlink(currentPath,(err) =>{
if(err){
console.log('unlink file error:',err)
reject(err)
}
console.log('successfully unlinked')
resolve(true);
});
}else{
this._fileSystem.rmdir(currentPath,(err) =>{
if(err){
console.log('moveAsync Error: folder delete failed',err);
reject(false);
}
console.log('successfully deleted')
resolve(true);
});
}
console.log('successfully renamed')
resolve(true);
}
});
console.log('successfully fetched')
resolve(true);
}
});
});
}

public iterateFileName(path:string):string{
const extension = extname(path);
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/system-service/menu.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export class MenuService{
hideTaskBarMenu: Subject<void> = new Subject<void>();
keepTaskBarMenu: Subject<void> = new Subject<void>();
hideContextMenus: Subject<void> = new Subject<void>();
storeData: Subject<string[]> = new Subject<string[]>();

}
6 changes: 3 additions & 3 deletions src/app/system-apps/clock/clock.component.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.date-and-time-cntnr{
display: flex;
height: 100%;
width: 80px;
width: 70px;
place-content: center;
place-items: center;
position: absolute;
Expand All @@ -13,13 +13,13 @@
font-weight: 300;
top: 5px;
position: absolute;
color: rgba(255, 255, 255, 0.8);
color: rgba(255, 255, 255);
}

.date-cntnr{
font-size: 11px;
font-weight: 300;
top: 22px;
position: absolute;
color: rgba(255, 255, 255, 0.8);
color: rgba(255, 255, 255);
}
2 changes: 1 addition & 1 deletion src/app/system-apps/clock/clock.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class ClockComponent implements AfterViewInit,OnDestroy {
private oberserableDate():void{
this._dateSubscription = timer(50, 360000).subscribe(() => {
const dateTime = new Date();
this.subscribeDate = `${dateTime.getMonth() + 1}/${this.padSingleDigits(dateTime.getDate())}/${dateTime.getFullYear()}`;
this.subscribeDate = `${dateTime.getMonth() + 1}/${dateTime.getDate()}/${dateTime.getFullYear()}`;
});
}

Expand Down
1 change: 1 addition & 0 deletions src/app/system-apps/desktop/desktop.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ export class DesktopComponent implements OnInit, OnDestroy, AfterViewInit{
{icon1:'', icon2: 'osdrive/icons/arrow_next.png', label:'View', nest:this.buildViewByMenu(), action: ()=> console.log(), emptyline:false},
{icon1:'', icon2:'osdrive/icons/arrow_next.png', label:'Sort by', nest:this.buildSortByMenu(), action: ()=> console.log(), emptyline:false},
{icon1:'', icon2:'', label: 'Refresh', nest:[], action:this.refresh.bind(this), emptyline:true},
{icon1:'', icon2:'', label: 'Paste', nest:[], action: () => console.log('Paste!! Paste!!'), emptyline:false},
{icon1:'/osdrive/icons/terminal_48.png', icon2:'', label:'Open in Terminal', nest:[], action: this.openTerminal.bind(this), emptyline:false},
{icon1:'/osdrive/icons/camera_48.png', icon2:'', label:'Screen Shot', nest:[], action: this.captureComponentImg.bind(this), emptyline:false},
{icon1:'', icon2:'', label:'Next Background', nest:[], action: this.nextBackground.bind(this), emptyline:false},
Expand Down
Loading

0 comments on commit d0bfec8

Please sign in to comment.