Skip to content

Commit

Permalink
Merge branch 'main' into 1-code-area
Browse files Browse the repository at this point in the history
  • Loading branch information
IPdotSetAF committed Oct 27, 2024
2 parents f83dfd3 + d43ff87 commit ef0ddf9
Show file tree
Hide file tree
Showing 15 changed files with 236 additions and 60 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build-publish.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
on:
push:
branches:
- "main" # change to the branch you wish to deploy from
tags:
- "v*"

permissions:
contents: read
pages: write
id-token: write

jobs:
tests:
uses: ./.github/workflows/main.yml
deploy:
needs: [tests]
environment:
name: "github-pages"
url: ${{ steps.build-publish.outputs.page_url }}
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

name: Build and Test

on:
pull_request:
branches:
- main
workflow_call:

jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 20 ]

name: Node ${{ matrix.node }} sample
steps:
- uses: actions/checkout@v3
- name: Building rules and tests
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: npm ci
- run: npm run build
- run: npm run test-ci
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"test-ci": "ng test --no-watch --no-progress --browsers=ChromeHeadless",
"serve:ssr:CodeChef": "node dist/code-chef/server/server.mjs"
},
"private": true,
Expand Down
15 changes: 15 additions & 0 deletions src/app/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import { TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { ActivatedRoute } from '@angular/router';

describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AppComponent],
providers: [
{
provide: ActivatedRoute,
useValue: {
snapshot: {
url: ["home"]
}
}
},
]
}).compileComponents();
});

Expand All @@ -13,4 +24,8 @@ describe('AppComponent', () => {
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});

it('should have application version', () =>{
expect(AppComponent.version).toBeTruthy();
});
});
65 changes: 65 additions & 0 deletions src/app/cs2ts/cs2ts.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,69 @@ <h2>C# to TS Converter</h2>
<button class="btn btn-success" (click)="convert()">Convert <i class="bi bi-caret-right"></i></button>
</div>
</div>

<br />

<div class="row">
<div class="col-12">
<h3 class="row">Supports:</h3>
<ul class="row">
<li>Primary data types:
<ul>
<li>boolean</li>
<li>number:
<ul>
<li>byte</li>
<li>sbyte</li>
<li>short</li>
<li>ushort</li>
<li>int</li>
<li>uint</li>
<li>float</li>
<li>double</li>
<li>decimal</li>
</ul>
</li>
<li>bigint:
<ul>
<li>long</li>
<li>ulong</li>
</ul>
</li>
<li>string:
<ul>
<li>string</li>
<li>char</li>
</ul>
</li>
<li>Date:
<ul>
<li>DateTime</li>
<li>DateOnly</li>
<li>TimeOnly</li>
</ul>
</li>
<li>any:
<ul>
<li>object</li>
<li>dynamic</li>
</ul>
</li>
<li>void</li>
</ul>
</li>
<li>Custom data types</li>
<li>Arrays
<ul>
<li>[]</li>
<li>List&lt;&gt;</li>
<li>IEnumerable&lt;&gt;</li>
<li>ICollection&lt;&gt;</li>
</ul>
</li>
<li>Generics</li>
<li>Nullables</li>
</ul>
</div>
</div>
</div>
6 changes: 5 additions & 1 deletion src/app/cs2ts/cs2ts.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { Cs2tsComponent } from './cs2ts.component';
import { provideAnimations } from '@angular/platform-browser/animations';

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

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

Expand Down
37 changes: 29 additions & 8 deletions src/app/cs2ts/cs2ts.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class Cs2tsComponent implements AfterContentInit {
constructor(meta: Meta) {
meta.addTags([
{ name: "description", content: "Converts C# model to TS model, converts fields, types, arrays and generics." },
{ name: "keywords", content: "C#, TS, CSharp, TypeScript, script, type, generic, array, converter, model, fields, string, number, int, class, code, language, long, float, boolean, bool" },
{ name: "keywords", content: "C#, TS, CSharp, TypeScript, script, type, generic, array, converter, model, DTO, DataTransferObject, POCO, fields, string, number, int, class, code, language, long, float, boolean, bool" },
]);
}

Expand Down Expand Up @@ -88,19 +88,40 @@ export class Cs2tsComponent implements AfterContentInit {
return code;
}

private static convertTypes(a: string | undefined): string | undefined {
if (a === "bool")
return "boolean";
private static convertTypes(t: string | undefined): string | undefined {
if (!t)
return t;

switch (a) {
switch (t!.toLowerCase()) {
case "bool":
return "boolean";
case "byte":
case "sbyte":
case "short":
case "ushort":
case "int":
case "uint":
case "float":
case "double":
case "decimal":
case "long":
return "number";
case "long":
case "ulong":
return "bigint";
case "char":
case "string":
return "string";
case "datetime":
case "dateonly":
case "timeonly":
return "Date";
case "object":
case "dynamic":
return "any";
case "void":
return "void";
default:
return t;
}

return a;
}
}
13 changes: 6 additions & 7 deletions src/app/footer/footer.component.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#footer-base {
height: 5px;
background: linear-gradient(135deg, #ff0340 0%, 57.99%, #163af7 100%);
background-size: 200% 200%;
animation: gradient-move 30s ease infinite;
}

a {
Expand All @@ -18,8 +15,10 @@ a {
height: 20px;
}

@keyframes gradient-move {
0%{background-position:0% 50%}
50%{background-position:100% 50%}
100%{background-position:0% 50%}
.fs-md{
font-size: smaller;
}

.fs-sm{
font-size: small;
}
41 changes: 26 additions & 15 deletions src/app/footer/footer.component.html
Original file line number Diff line number Diff line change
@@ -1,33 +1,44 @@
<div class="container-fluid border-1 border-top border-secondary">
<div class="w-100 divider"></div>
<div class="container-fluid">
<div class="col-12">
<div class="row p-2 gap-2">
<div class="col-12 text-secondary">
<div class="d-flex align-items-center gap-2 mb-1">
<img id="logo" src="code-chef.svg" />
<h3 class="fs-5 m-0">CodeChef v{{version}}</h3>
<h3 class="fs-6 m-0">CodeChef v{{version}}</h3>
</div>
<p>
<p class="fs-md">
<a href="https://github.com/IPdotSetAF/CodeChef">Open-source</a> developer utility website. Made to
help software developers skip repetetive and boring tasks and automate what could be automated.
<br />
Everyone is welcome to contribute, give feedback or report bugs.
</p>
</div>
<div class="col-12 border-1 border-top border-secondary"></div>
<div class="col-12 divider"></div>
<div class="col-12 text-secondary">
<div class="d-flex gap-2">
<label>© 2024 <a href="https://ipdotsetaf.ir">IPdotSetAF</a>. Licensed under the GPL-3.0
License.</label>
<div class="flex-fill"></div>
<a class="btn-footer btn-circle btn-hover bi bi-telephone fs-5" title="Call Me" href="tel:+989387016860"></a>
<a class="btn-footer btn-circle btn-hover bi bi-globe2 fs-5" title="Website" href="https://ipdotsetaf.ir"></a>
<a class="btn-footer btn-circle btn-hover bi bi-telegram fs-5" title="Telegram" href="https://t.me/IPdotSetAF"></a>
<a class="btn-footer btn-circle btn-hover bi bi-discord fs-5" title="Discord" href="https://discord.com/invite/BTZDf7fs"></a>
<a class="btn-footer btn-circle btn-hover bi bi-linkedin fs-5" title="Linkedin" href="https://linkedin.com/in/ipaf"></a>
<a class="btn-footer btn-circle btn-hover bi bi-github fs-5" title="Github" href="https://github.com/IPdotSetAF"></a>
<div class="row">
<div class="col-md-6 d-flex justify-content-center justify-content-md-start">
<label class="fs-sm">© 2024 <a href="https://ipdotsetaf.ir">IPdotSetAF</a>. Licensed under the
GPL-3.0
License.</label>
</div>
<div class="col-md-6 d-flex justify-content-center justify-content-md-end gap-2">
<a class="btn-footer btn-circle btn-hover bi bi-telephone fs-5" title="Call Me"
href="tel:+989387016860"></a>
<a class="btn-footer btn-circle btn-hover bi bi-globe2 fs-5" title="Website"
href="https://ipdotsetaf.ir"></a>
<a class="btn-footer btn-circle btn-hover bi bi-telegram fs-5" title="Telegram"
href="https://t.me/IPdotSetAF"></a>
<a class="btn-footer btn-circle btn-hover bi bi-discord fs-5" title="Discord"
href="https://discord.com/invite/BTZDf7fs"></a>
<a class="btn-footer btn-circle btn-hover bi bi-linkedin fs-5" title="Linkedin"
href="https://linkedin.com/in/ipaf"></a>
<a class="btn-footer btn-circle btn-hover bi bi-github fs-5" title="Github"
href="https://github.com/IPdotSetAF"></a>
</div>
</div>
</div>
</div>
<div id="footer-base" class="row"></div>
<div id="footer-base" class="divider row"></div>
</div>
</div>
1 change: 0 additions & 1 deletion src/app/header/header.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
height: var(--height);
background-color: #212529b0;
backdrop-filter: blur(2px);
border-bottom: #FFFFFF30 1px solid;
}

img {
Expand Down
34 changes: 19 additions & 15 deletions src/app/header/header.component.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
<div id="header" class="d-flex">
<div class="col-4 h-100">
<a class="w-100 h-100 d-flex justify-content-start gap-2 align-items-center ps-2" [routerLink]="['/','home']">
<img src="code-chef.svg" />
<h1 class="fs-3 m-0">CodeChef</h1>
</a>
</div>
<div class="col-4 h-100 d-flex justify-content-center">
<div id="header">
<div class="d-flex h-100">
<div class="col-4 h-100">
<a class="w-100 h-100 d-flex justify-content-start gap-2 align-items-center ps-2"
[routerLink]="['/','home']">
<img src="code-chef.svg" />
<h1 class="fs-3 m-0">CodeChef</h1>
</a>
</div>
<div class="col-4 h-100 d-flex justify-content-center">

</div>
<div class="col-4 h-100 d-flex align-items-center justify-content-end pe-2">
<a class="btn-header-round btn-hover btn-circle" href="https://ipdotsetaf.ir" title="IPdotSetAF">
<img id="ipaf" src="ipaf.svg" />
</a>
<a class="bi bi-github fs-2 btn-header-round btn-hover btn-circle"
href="https://github.com/IPdotSetAF/CodeChef" title="CodeChef Github"></a>
</div>
</div>
<div class="col-4 h-100 d-flex align-items-center justify-content-end pe-2">
<a class="btn-header-round btn-hover btn-circle" href="https://ipdotsetaf.ir" title="IPdotSetAF">
<img id="ipaf" src="ipaf.svg" />
</a>
<a class="bi bi-github fs-2 btn-header-round btn-hover btn-circle"
href="https://github.com/IPdotSetAF/CodeChef" title="CodeChef Github"></a>
</div>
<div class="col-12 divider"></div>
</div>
13 changes: 12 additions & 1 deletion src/app/header/header.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { HeaderComponent } from './header.component';
import { ActivatedRoute } from '@angular/router';

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

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HeaderComponent]
imports: [HeaderComponent],
providers: [
{
provide: ActivatedRoute,
useValue: {
snapshot: {
url: ["home"]
}
}
},
]
})
.compileComponents();

Expand Down
Loading

0 comments on commit ef0ddf9

Please sign in to comment.