diff --git a/src/app/app.html b/src/app/app.html index 757f721..0680b43 100644 --- a/src/app/app.html +++ b/src/app/app.html @@ -1,4 +1 @@ -

Hello, {{ title() }}

-

{{ doubleTitle() }}

- - + diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index dc39edb..b87bd52 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -1,3 +1,14 @@ import { Routes } from '@angular/router'; -export const routes: Routes = []; +export const routes: Routes = [ + { + path: '', + redirectTo: 'challenge-workspace', + pathMatch: 'full' + }, + { + path: 'challenge-workspace', + loadChildren: () => + import('./features/challenge-workspace/challenge-workspace').then(m => m.challengeWorkspaceRoutes) + } +]; diff --git a/src/app/app.ts b/src/app/app.ts index 89fc8ac..0d36b4d 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -2,11 +2,10 @@ import { Component, computed, signal, effect } from '@angular/core'; import { RouterOutlet } from '@angular/router'; import { ApplicationService } from './application'; -import { Button } from './components/button/button'; @Component({ selector: 'app-root', - imports: [RouterOutlet, Button], + imports: [RouterOutlet], templateUrl: './app.html', styleUrl: './app.css', }) diff --git a/src/app/application.spec.ts b/src/app/application.spec.ts index 4a2d79c..27a4a25 100644 --- a/src/app/application.spec.ts +++ b/src/app/application.spec.ts @@ -1,13 +1,13 @@ import { TestBed } from '@angular/core/testing'; -import { Application } from './application'; +import { ApplicationService } from './application'; describe('Application', () => { - let service: Application; + let service: ApplicationService; beforeEach(() => { TestBed.configureTestingModule({}); - service = TestBed.inject(Application); + service = TestBed.inject(ApplicationService); }); it('should be created', () => { diff --git a/src/app/features/challenge-workspace/challenge-workspace.routes.ts b/src/app/features/challenge-workspace/challenge-workspace.routes.ts new file mode 100644 index 0000000..b981be3 --- /dev/null +++ b/src/app/features/challenge-workspace/challenge-workspace.routes.ts @@ -0,0 +1,9 @@ +import { Routes } from '@angular/router'; +import { ChallengeWorkspaceContainer } from './containers/challenge-workspace/challenge-workspace'; + +export const challengeWorkspaceRoutes: Routes = [ + { + path: '', + component: ChallengeWorkspaceContainer + } +]; \ No newline at end of file diff --git a/src/app/features/challenge-workspace/challenge-workspace.ts b/src/app/features/challenge-workspace/challenge-workspace.ts new file mode 100644 index 0000000..8338725 --- /dev/null +++ b/src/app/features/challenge-workspace/challenge-workspace.ts @@ -0,0 +1,2 @@ +export { ChallengeWorkspaceContainer } from './containers/challenge-workspace/challenge-workspace'; +export { challengeWorkspaceRoutes } from './challenge-workspace.routes'; \ No newline at end of file diff --git a/src/app/features/challenge-workspace/containers/challenge-workspace/challenge-workspace.css b/src/app/features/challenge-workspace/containers/challenge-workspace/challenge-workspace.css new file mode 100644 index 0000000..ec9e3be --- /dev/null +++ b/src/app/features/challenge-workspace/containers/challenge-workspace/challenge-workspace.css @@ -0,0 +1,166 @@ +:host { + display: block; + min-height: 100vh; + background: #0f0f10; + color: #f3f3f3; + font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; +} + +* { + box-sizing: border-box; +} + +.workspace-layout { + min-height: 100dvh; + display: grid; + grid-template-rows: 56px 48px 1fr 56px; + overflow: hidden; +} + +.top-header, +.workspace-toolbar, +.workspace-footer { + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 16px; + background: #17171a; + border-color: #2a2a2a; +} + +.top-header, +.workspace-toolbar { + border-bottom: 1px solid #2a2a2a; +} + +.logo { + font-size: 1rem; + font-weight: 700; +} + +.top-nav span { + color: #b6b6b8; + font-size: 14px; +} + +.problem-tabs { + display: flex; + gap: 4px; +} + +.tab { + border: 0; + background: transparent; + color: #b6b6b8; + padding: 8px 10px; + cursor: pointer; + border-bottom: 2px solid transparent; +} + +.tab.active { + color: #f3f3f3; + border-bottom-color: #facc15; +} + +.language-tab span { + display: inline-block; + padding: 4px 10px; + border: 1px solid #2a2a2a; + border-radius: 6px; + color: #d4d4d4; + font-size: 13px; +} + +.workspace-main { + min-height: 0; + display: grid; + grid-template-columns: 1fr 1fr; + overflow: hidden; +} + +.workspace-panel { + min-height: 0; + overflow: auto; + padding: 20px; + background: #141416; +} + +.workspace-problem { + border-right: 1px solid #2a2a2a; +} + +.workspace-editor { + background: #0d0d0f; +} + +.problem-content h1 { + margin-bottom: 12px; + font-size: 1.8rem; +} + +.problem-content p { + margin-bottom: 10px; + line-height: 1.5; + color: #d4d4d4; +} + +.example-card { + margin-top: 14px; + padding: 12px; + border: 1px solid #2a2a2a; + border-radius: 8px; + background: #17171a; +} + +.example-card pre, +.editor-content pre { + margin-top: 8px; + white-space: pre-wrap; + word-break: break-word; + color: #d4d4d4; + font-size: 14px; + line-height: 1.45; +} + +.problem-content ul { + margin-top: 8px; + padding-left: 20px; +} + +.problem-content li { + margin-bottom: 6px; + color: #d4d4d4; +} + +.workspace-footer { + justify-content: flex-end; + gap: 10px; + border-top: 1px solid #2a2a2a; +} + +.btn { + border: 1px solid #2a2a2a; + background: #141416; + color: #f3f3f3; + border-radius: 8px; + padding: 8px 14px; + cursor: pointer; +} + +.btn-primary { + border-color: #eab308; + background: #facc15; + color: #111111; + font-weight: 700; +} + +@media (max-width: 900px) { + .workspace-main { + grid-template-columns: 1fr; + } + + .workspace-problem { + border-right: 0; + border-bottom: 1px solid #2a2a2a; + } +} \ No newline at end of file diff --git a/src/app/features/challenge-workspace/containers/challenge-workspace/challenge-workspace.html b/src/app/features/challenge-workspace/containers/challenge-workspace/challenge-workspace.html new file mode 100644 index 0000000..a6cb96d --- /dev/null +++ b/src/app/features/challenge-workspace/containers/challenge-workspace/challenge-workspace.html @@ -0,0 +1,85 @@ +
+
+ + +
+ +
+
+ + + +
+ +
+ JavaScript +
+
+ +
+
+ +
+

1. Two Sum

+

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

+

You may assume that each input would have exactly one solution, and you may not use the same element twice.

+

You can return the answer in any order.

+ +
+

Example 1:

+
Input: nums = [2,7,11,15], target = 9
+Output: [0,1] 
+Explanation: Because nums[0] + nums[1] == 9, we return [0, 1].
+
+ +
+

Example 2:

+
Input: nums = [3,2,4], target = 6
+Output: [1,2]
+
+ +
+

Example 3:

+
Input: nums = [3,3], target = 6
+Output: [0,1]
+
+ +

Constraints:

+
    +
  • 2 <= nums.length <= 10^4
  • +
  • -10^9 <= nums[i] <= 10^9
  • +
  • -10^9 <= target <= 10^9
  • +
  • Only one valid answer exists.
  • +
+
+
+ +
+
+
var twoSum = function(nums, target) {
+    const map = new Map();
+            
+    for (let i = 0; i < nums.length; i++) {
+        const complement = target - nums[i];
+            
+        if (map.has(complement)) {
+            return [map.get(complement), i];
+        }
+        map.set(nums[i], i);
+    }
+        
+    return [];
+};
+ +
+
+ +
+ + +
\ No newline at end of file diff --git a/src/app/features/challenge-workspace/containers/challenge-workspace/challenge-workspace.ts b/src/app/features/challenge-workspace/containers/challenge-workspace/challenge-workspace.ts new file mode 100644 index 0000000..187fc81 --- /dev/null +++ b/src/app/features/challenge-workspace/containers/challenge-workspace/challenge-workspace.ts @@ -0,0 +1,13 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-challenge-workspace', + standalone: true, + imports: [], + templateUrl: './challenge-workspace.html', + styleUrl: './challenge-workspace.css' +}) + +export class ChallengeWorkspaceContainer { + +} \ No newline at end of file diff --git a/tsconfig.app.json b/tsconfig.app.json index 264f459..e4dd97c 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -4,6 +4,7 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./out-tsc/app", + "rootDir": "./src", "types": [] }, "include": [ diff --git a/tsconfig.spec.json b/tsconfig.spec.json index d383706..2415dbd 100644 --- a/tsconfig.spec.json +++ b/tsconfig.spec.json @@ -4,6 +4,7 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./out-tsc/spec", + "rootDir": "./src/app", "types": [ "vitest/globals" ]