From c4ce2bfb3ca82dc5e6be76b81ea89461c92df390 Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:00:04 +0000 Subject: [PATCH 01/18] add tailwind extension --- .devcontainer/devcontainer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8028325f58..3d42cc2226 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -28,6 +28,7 @@ "extensions": [ "alefragnani.Bookmarks", "Angular.ng-template", + "bradlc.vscode-tailwindcss", "dbaeumer.vscode-eslint", "donjayamanne.python-environment-manager", "dorzey.vscode-sqlfluff", From f32ee6b91ef2060a1f36e5cf009cf9e2acf1d8e5 Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:18:51 +0000 Subject: [PATCH 02/18] add new project --- .../app-tailwind/.eslintrc.json | 33 + .../app-tailwind/jest.config.ts | 21 + apps/openchallenges/app-tailwind/project.json | 94 ++ .../app-tailwind/public/favicon.ico | Bin 0 -> 15086 bytes apps/openchallenges/app-tailwind/server.ts | 60 ++ .../app-tailwind/src/app/app.component.html | 1 + .../app-tailwind/src/app/app.component.scss | 0 .../src/app/app.component.spec.ts | 27 + .../app-tailwind/src/app/app.component.ts | 14 + .../app-tailwind/src/app/app.config.server.ts | 9 + .../app-tailwind/src/app/app.config.ts | 12 + .../app-tailwind/src/app/app.routes.ts | 3 + .../src/app/nx-welcome.component.ts | 935 ++++++++++++++++++ .../app-tailwind/src/index.html | 13 + .../app-tailwind/src/main.server.ts | 7 + apps/openchallenges/app-tailwind/src/main.ts | 5 + .../app-tailwind/src/styles.scss | 5 + .../app-tailwind/src/test-setup.ts | 8 + .../app-tailwind/tailwind.config.js | 14 + .../app-tailwind/tsconfig.app.json | 10 + .../app-tailwind/tsconfig.editor.json | 6 + .../openchallenges/app-tailwind/tsconfig.json | 32 + .../app-tailwind/tsconfig.spec.json | 11 + 23 files changed, 1320 insertions(+) create mode 100644 apps/openchallenges/app-tailwind/.eslintrc.json create mode 100644 apps/openchallenges/app-tailwind/jest.config.ts create mode 100644 apps/openchallenges/app-tailwind/project.json create mode 100644 apps/openchallenges/app-tailwind/public/favicon.ico create mode 100644 apps/openchallenges/app-tailwind/server.ts create mode 100644 apps/openchallenges/app-tailwind/src/app/app.component.html create mode 100644 apps/openchallenges/app-tailwind/src/app/app.component.scss create mode 100644 apps/openchallenges/app-tailwind/src/app/app.component.spec.ts create mode 100644 apps/openchallenges/app-tailwind/src/app/app.component.ts create mode 100644 apps/openchallenges/app-tailwind/src/app/app.config.server.ts create mode 100644 apps/openchallenges/app-tailwind/src/app/app.config.ts create mode 100644 apps/openchallenges/app-tailwind/src/app/app.routes.ts create mode 100644 apps/openchallenges/app-tailwind/src/app/nx-welcome.component.ts create mode 100644 apps/openchallenges/app-tailwind/src/index.html create mode 100644 apps/openchallenges/app-tailwind/src/main.server.ts create mode 100644 apps/openchallenges/app-tailwind/src/main.ts create mode 100644 apps/openchallenges/app-tailwind/src/styles.scss create mode 100644 apps/openchallenges/app-tailwind/src/test-setup.ts create mode 100644 apps/openchallenges/app-tailwind/tailwind.config.js create mode 100644 apps/openchallenges/app-tailwind/tsconfig.app.json create mode 100644 apps/openchallenges/app-tailwind/tsconfig.editor.json create mode 100644 apps/openchallenges/app-tailwind/tsconfig.json create mode 100644 apps/openchallenges/app-tailwind/tsconfig.spec.json diff --git a/apps/openchallenges/app-tailwind/.eslintrc.json b/apps/openchallenges/app-tailwind/.eslintrc.json new file mode 100644 index 0000000000..36040daaee --- /dev/null +++ b/apps/openchallenges/app-tailwind/.eslintrc.json @@ -0,0 +1,33 @@ +{ + "extends": ["../../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts"], + "extends": ["plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates"], + "rules": { + "@angular-eslint/directive-selector": [ + "error", + { + "type": "attribute", + "prefix": "app", + "style": "camelCase" + } + ], + "@angular-eslint/component-selector": [ + "error", + { + "type": "element", + "prefix": "app", + "style": "kebab-case" + } + ] + } + }, + { + "files": ["*.html"], + "extends": ["plugin:@nx/angular-template"], + "rules": {} + } + ] +} diff --git a/apps/openchallenges/app-tailwind/jest.config.ts b/apps/openchallenges/app-tailwind/jest.config.ts new file mode 100644 index 0000000000..cc73902e16 --- /dev/null +++ b/apps/openchallenges/app-tailwind/jest.config.ts @@ -0,0 +1,21 @@ +export default { + displayName: 'openchallenges-app-tailwind', + preset: '../../../jest.preset.js', + setupFilesAfterEnv: ['/src/test-setup.ts'], + coverageDirectory: '../../../coverage/apps/openchallenges/app-tailwind', + transform: { + '^.+\\.(ts|mjs|js|html)$': [ + 'jest-preset-angular', + { + tsconfig: '/tsconfig.spec.json', + stringifyContentPathRegex: '\\.(html|svg)$', + }, + ], + }, + transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], + snapshotSerializers: [ + 'jest-preset-angular/build/serializers/no-ng-attributes', + 'jest-preset-angular/build/serializers/ng-snapshot', + 'jest-preset-angular/build/serializers/html-comment', + ], +}; diff --git a/apps/openchallenges/app-tailwind/project.json b/apps/openchallenges/app-tailwind/project.json new file mode 100644 index 0000000000..eb817c797c --- /dev/null +++ b/apps/openchallenges/app-tailwind/project.json @@ -0,0 +1,94 @@ +{ + "name": "openchallenges-app-tailwind", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "projectType": "application", + "prefix": "app", + "sourceRoot": "apps/openchallenges/app-tailwind/src", + "tags": [], + "targets": { + "build": { + "executor": "@angular-devkit/build-angular:application", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/apps/openchallenges/app-tailwind", + "index": "apps/openchallenges/app-tailwind/src/index.html", + "browser": "apps/openchallenges/app-tailwind/src/main.ts", + "polyfills": ["zone.js"], + "tsConfig": "apps/openchallenges/app-tailwind/tsconfig.app.json", + "inlineStyleLanguage": "scss", + "assets": [ + { + "glob": "**/*", + "input": "apps/openchallenges/app-tailwind/public" + } + ], + "styles": ["apps/openchallenges/app-tailwind/src/styles.scss"], + "scripts": [], + "server": "apps/openchallenges/app-tailwind/src/main.server.ts", + "prerender": true, + "ssr": { + "entry": "apps/openchallenges/app-tailwind/server.ts" + } + }, + "configurations": { + "production": { + "budgets": [ + { + "type": "initial", + "maximumWarning": "500kb", + "maximumError": "1mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "2kb", + "maximumError": "4kb" + } + ], + "outputHashing": "all" + }, + "development": { + "optimization": false, + "extractLicenses": false, + "sourceMap": true + } + }, + "defaultConfiguration": "production" + }, + "serve": { + "executor": "@angular-devkit/build-angular:dev-server", + "configurations": { + "production": { + "buildTarget": "openchallenges-app-tailwind:build:production" + }, + "development": { + "buildTarget": "openchallenges-app-tailwind:build:development" + } + }, + "defaultConfiguration": "development" + }, + "extract-i18n": { + "executor": "@angular-devkit/build-angular:extract-i18n", + "options": { + "buildTarget": "openchallenges-app-tailwind:build" + } + }, + "lint": { + "executor": "@nx/eslint:lint" + }, + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "apps/openchallenges/app-tailwind/jest.config.ts" + } + }, + "serve-static": { + "executor": "@nx/web:file-server", + "options": { + "buildTarget": "openchallenges-app-tailwind:build", + "staticFilePath": "dist/apps/openchallenges/app-tailwind/browser", + "spa": true + } + } + } +} diff --git a/apps/openchallenges/app-tailwind/public/favicon.ico b/apps/openchallenges/app-tailwind/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..317ebcb2336e0833a22dddf0ab287849f26fda57 GIT binary patch literal 15086 zcmeI332;U^%p|z7g|#(P)qFEA@4f!_@qOK2 z_lJl}!lhL!VT_U|uN7%8B2iKH??xhDa;*`g{yjTFWHvXn;2s{4R7kH|pKGdy(7z!K zgftM+Ku7~24TLlh(!g)gz|foI94G^t2^IO$uvX$3(OR0<_5L2sB)lMAMy|+`xodJ{ z_Uh_1m)~h?a;2W{dmhM;u!YGo=)OdmId_B<%^V^{ovI@y`7^g1_V9G}*f# zNzAtvou}I!W1#{M^@ROc(BZ! z+F!!_aR&Px3_reO(EW+TwlW~tv*2zr?iP7(d~a~yA|@*a89IUke+c472NXM0wiX{- zl`UrZC^1XYyf%1u)-Y)jj9;MZ!SLfd2Hl?o|80Su%Z?To_=^g_Jt0oa#CT*tjx>BI z16wec&AOWNK<#i0Qd=1O$fymLRoUR*%;h@*@v7}wApDl^w*h}!sYq%kw+DKDY)@&A z@9$ULEB3qkR#85`lb8#WZw=@})#kQig9oqy^I$dj&k4jU&^2(M3q{n1AKeGUKPFbr z1^<)aH;VsG@J|B&l>UtU#Ejv3GIqERzYgL@UOAWtW<{p#zy`WyJgpCy8$c_e%wYJL zyGHRRx38)HyjU3y{-4z6)pzb>&Q1pR)B&u01F-|&Gx4EZWK$nkUkOI|(D4UHOXg_- zw{OBf!oWQUn)Pe(=f=nt=zkmdjpO^o8ZZ9o_|4tW1ni+Un9iCW47*-ut$KQOww!;u z`0q)$s6IZO!~9$e_P9X!hqLxu`fpcL|2f^I5d4*a@Dq28;@2271v_N+5HqYZ>x;&O z05*7JT)mUe&%S0@UD)@&8SmQrMtsDfZT;fkdA!r(S=}Oz>iP)w=W508=Rc#nNn7ym z1;42c|8($ALY8#a({%1#IXbWn9-Y|0eDY$_L&j{63?{?AH{);EzcqfydD$@-B`Y3<%IIj7S7rK_N}je^=dEk%JQ4c z!tBdTPE3Tse;oYF>cnrapWq*o)m47X1`~6@(!Y29#>-#8zm&LXrXa(3=7Z)ElaQqj z-#0JJy3Fi(C#Rx(`=VXtJ63E2_bZGCz+QRa{W0e2(m3sI?LOcUBx)~^YCqZ{XEPX)C>G>U4tfqeH8L(3|pQR*zbL1 zT9e~4Tb5p9_G}$y4t`i*4t_Mr9QYvL9C&Ah*}t`q*}S+VYh0M6GxTTSXI)hMpMpIq zD1ImYqJLzbj0}~EpE-aH#VCH_udYEW#`P2zYmi&xSPs_{n6tBj=MY|-XrA;SGA_>y zGtU$?HXm$gYj*!N)_nQ59%lQdXtQZS3*#PC-{iB_sm+ytD*7j`D*k(P&IH2GHT}Eh z5697eQECVIGQAUe#eU2I!yI&%0CP#>%6MWV z@zS!p@+Y1i1b^QuuEF*13CuB zu69dve5k7&Wgb+^s|UB08Dr3u`h@yM0NTj4h7MnHo-4@xmyr7(*4$rpPwsCDZ@2be zRz9V^GnV;;?^Lk%ynzq&K(Aix`mWmW`^152Hoy$CTYVehpD-S1-W^#k#{0^L`V6CN+E z!w+xte;2vu4AmVNEFUOBmrBL>6MK@!O2*N|2=d|Y;oN&A&qv=qKn73lDD zI(+oJAdgv>Yr}8(&@ZuAZE%XUXmX(U!N+Z_sjL<1vjy1R+1IeHt`79fnYdOL{$ci7 z%3f0A*;Zt@ED&Gjm|OFTYBDe%bbo*xXAQsFz+Q`fVBH!N2)kaxN8P$c>sp~QXnv>b zwq=W3&Mtmih7xkR$YA)1Yi?avHNR6C99!u6fh=cL|KQ&PwF!n@ud^n(HNIImHD!h87!i*t?G|p0o+eelJ?B@A64_9%SBhNaJ64EvKgD&%LjLCYnNfc; znj?%*p@*?dq#NqcQFmmX($wms@CSAr9#>hUR^=I+=0B)vvGX%T&#h$kmX*s=^M2E!@N9#m?LhMvz}YB+kd zG~mbP|D(;{s_#;hsKK9lbVK&Lo734x7SIFJ9V_}2$@q?zm^7?*XH94w5Qae{7zOMUF z^?%F%)c1Y)Q?Iy?I>knw*8gYW#ok|2gdS=YYZLiD=CW|Nj;n^x!=S#iJ#`~Ld79+xXpVmUK^B(xO_vO!btA9y7w3L3-0j-y4 z?M-V{%z;JI`bk7yFDcP}OcCd*{Q9S5$iGA7*E1@tfkyjAi!;wP^O71cZ^Ep)qrQ)N z#wqw0_HS;T7x3y|`P==i3hEwK%|>fZ)c&@kgKO1~5<5xBSk?iZV?KI6&i72H6S9A* z=U(*e)EqEs?Oc04)V-~K5AUmh|62H4*`UAtItO$O(q5?6jj+K^oD!04r=6#dsxp?~}{`?&sXn#q2 zGuY~7>O2=!u@@Kfu7q=W*4egu@qPMRM>(eyYyaIE<|j%d=iWNdGsx%c!902v#ngNg z@#U-O_4xN$s_9?(`{>{>7~-6FgWpBpqXb`Ydc3OFL#&I}Irse9F_8R@4zSS*Y*o*B zXL?6*Aw!AfkNCgcr#*yj&p3ZDe2y>v$>FUdKIy_2N~}6AbHc7gA3`6$g@1o|dE>vz z4pl(j9;kyMsjaw}lO?(?Xg%4k!5%^t#@5n=WVc&JRa+XT$~#@rldvN3S1rEpU$;XgxVny7mki3 z-Hh|jUCHrUXuLr!)`w>wgO0N%KTB-1di>cj(x3Bav`7v z3G7EIbU$z>`Nad7Rk_&OT-W{;qg)-GXV-aJT#(ozdmnA~Rq3GQ_3mby(>q6Ocb-RgTUhTN)))x>m&eD;$J5Bg zo&DhY36Yg=J=$Z>t}RJ>o|@hAcwWzN#r(WJ52^g$lh^!63@hh+dR$&_dEGu&^CR*< z!oFqSqO@>xZ*nC2oiOd0eS*F^IL~W-rsrO`J`ej{=ou_q^_(<$&-3f^J z&L^MSYWIe{&pYq&9eGaArA~*kA { }); + // Serve static files from /browser + server.get( + '**', + express.static(browserDistFolder, { + maxAge: '1y', + index: 'index.html', + }), + ); + + // All regular routes use the Angular engine + server.get('**', (req, res, next) => { + const { protocol, originalUrl, baseUrl, headers } = req; + + commonEngine + .render({ + bootstrap, + documentFilePath: indexHtml, + url: `${protocol}://${headers.host}${originalUrl}`, + publicPath: browserDistFolder, + providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }], + }) + .then((html) => res.send(html)) + .catch((err) => next(err)); + }); + + return server; +} + +function run(): void { + const port = process.env['PORT'] || 4000; + + // Start up the Node server + const server = app(); + server.listen(port, () => { + console.log(`Node Express server listening on http://localhost:${port}`); + }); +} + +run(); diff --git a/apps/openchallenges/app-tailwind/src/app/app.component.html b/apps/openchallenges/app-tailwind/src/app/app.component.html new file mode 100644 index 0000000000..0f4018b6d7 --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/app/app.component.html @@ -0,0 +1 @@ + diff --git a/apps/openchallenges/app-tailwind/src/app/app.component.scss b/apps/openchallenges/app-tailwind/src/app/app.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/apps/openchallenges/app-tailwind/src/app/app.component.spec.ts b/apps/openchallenges/app-tailwind/src/app/app.component.spec.ts new file mode 100644 index 0000000000..f1584ffc3c --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/app/app.component.spec.ts @@ -0,0 +1,27 @@ +import { TestBed } from '@angular/core/testing'; +import { AppComponent } from './app.component'; +import { NxWelcomeComponent } from './nx-welcome.component'; +import { RouterModule } from '@angular/router'; + +describe('AppComponent', () => { + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [AppComponent, NxWelcomeComponent, RouterModule.forRoot([])], + }).compileComponents(); + }); + + it('should render title', () => { + const fixture = TestBed.createComponent(AppComponent); + fixture.detectChanges(); + const compiled = fixture.nativeElement as HTMLElement; + expect(compiled.querySelector('h1')?.textContent).toContain( + 'Welcome openchallenges-app-tailwind', + ); + }); + + it(`should have as title 'openchallenges-app-tailwind'`, () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.componentInstance; + expect(app.title).toEqual('openchallenges-app-tailwind'); + }); +}); diff --git a/apps/openchallenges/app-tailwind/src/app/app.component.ts b/apps/openchallenges/app-tailwind/src/app/app.component.ts new file mode 100644 index 0000000000..05974888b6 --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/app/app.component.ts @@ -0,0 +1,14 @@ +import { Component } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { NxWelcomeComponent } from './nx-welcome.component'; + +@Component({ + standalone: true, + imports: [NxWelcomeComponent, RouterModule], + selector: 'app-root', + templateUrl: './app.component.html', + styleUrl: './app.component.scss', +}) +export class AppComponent { + title = 'openchallenges-app-tailwind'; +} diff --git a/apps/openchallenges/app-tailwind/src/app/app.config.server.ts b/apps/openchallenges/app-tailwind/src/app/app.config.server.ts new file mode 100644 index 0000000000..1980cfe118 --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/app/app.config.server.ts @@ -0,0 +1,9 @@ +import { mergeApplicationConfig, ApplicationConfig } from '@angular/core'; +import { provideServerRendering } from '@angular/platform-server'; +import { appConfig } from './app.config'; + +const serverConfig: ApplicationConfig = { + providers: [provideServerRendering()], +}; + +export const config = mergeApplicationConfig(appConfig, serverConfig); diff --git a/apps/openchallenges/app-tailwind/src/app/app.config.ts b/apps/openchallenges/app-tailwind/src/app/app.config.ts new file mode 100644 index 0000000000..8f91ae956c --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/app/app.config.ts @@ -0,0 +1,12 @@ +import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'; +import { provideRouter } from '@angular/router'; +import { appRoutes } from './app.routes'; +import { provideClientHydration } from '@angular/platform-browser'; + +export const appConfig: ApplicationConfig = { + providers: [ + provideClientHydration(), + provideZoneChangeDetection({ eventCoalescing: true }), + provideRouter(appRoutes), + ], +}; diff --git a/apps/openchallenges/app-tailwind/src/app/app.routes.ts b/apps/openchallenges/app-tailwind/src/app/app.routes.ts new file mode 100644 index 0000000000..8762dfe2c6 --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/app/app.routes.ts @@ -0,0 +1,3 @@ +import { Route } from '@angular/router'; + +export const appRoutes: Route[] = []; diff --git a/apps/openchallenges/app-tailwind/src/app/nx-welcome.component.ts b/apps/openchallenges/app-tailwind/src/app/nx-welcome.component.ts new file mode 100644 index 0000000000..1bd71a85b1 --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/app/nx-welcome.component.ts @@ -0,0 +1,935 @@ +import { Component, ViewEncapsulation } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +@Component({ + selector: 'app-nx-welcome', + standalone: true, + imports: [CommonModule], + template: ` + + +
+
+ +
+

+ Hello there, + Welcome openchallenges-app-tailwind 👋 +

+
+ +
+
+

+ + + + You're up and running +

+ What's next? +
+
+ + + +
+
+ + + +
+

Next steps

+

Here are some things you can do with Nx:

+
+ + + + + Build, test and lint your app + +
# Build
+nx build 
+# Test
+nx test 
+# Lint
+nx lint 
+# Run them together!
+nx run-many -t build test lint
+
+
+ + + + + View project details + +
nx show project openchallenges-app-tailwind
+
+ +
+ + + + + View interactive project graph + +
nx graph
+
+ +
+ + + + + Add UI library + +
# Generate UI lib
+nx g @nx/angular:lib ui
+# Add a component
+nx g @nx/angular:component ui/src/lib/button
+
+
+

+ Carefully crafted with + + + +

+
+
+ `, + styles: [], + encapsulation: ViewEncapsulation.None, +}) +export class NxWelcomeComponent {} diff --git a/apps/openchallenges/app-tailwind/src/index.html b/apps/openchallenges/app-tailwind/src/index.html new file mode 100644 index 0000000000..a643a399cb --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/index.html @@ -0,0 +1,13 @@ + + + + + openchallenges-app-tailwind + + + + + + + + diff --git a/apps/openchallenges/app-tailwind/src/main.server.ts b/apps/openchallenges/app-tailwind/src/main.server.ts new file mode 100644 index 0000000000..4b9d4d1545 --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/main.server.ts @@ -0,0 +1,7 @@ +import { bootstrapApplication } from '@angular/platform-browser'; +import { AppComponent } from './app/app.component'; +import { config } from './app/app.config.server'; + +const bootstrap = () => bootstrapApplication(AppComponent, config); + +export default bootstrap; diff --git a/apps/openchallenges/app-tailwind/src/main.ts b/apps/openchallenges/app-tailwind/src/main.ts new file mode 100644 index 0000000000..17447a5dce --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/main.ts @@ -0,0 +1,5 @@ +import { bootstrapApplication } from '@angular/platform-browser'; +import { appConfig } from './app/app.config'; +import { AppComponent } from './app/app.component'; + +bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err)); diff --git a/apps/openchallenges/app-tailwind/src/styles.scss b/apps/openchallenges/app-tailwind/src/styles.scss new file mode 100644 index 0000000000..77e408aa8b --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/styles.scss @@ -0,0 +1,5 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +/* You can add global styles to this file, and also import other style files */ diff --git a/apps/openchallenges/app-tailwind/src/test-setup.ts b/apps/openchallenges/app-tailwind/src/test-setup.ts new file mode 100644 index 0000000000..ab1eeeb335 --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/test-setup.ts @@ -0,0 +1,8 @@ +// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment +globalThis.ngJest = { + testEnvironmentOptions: { + errorOnUnknownElements: true, + errorOnUnknownProperties: true, + }, +}; +import 'jest-preset-angular/setup-jest'; diff --git a/apps/openchallenges/app-tailwind/tailwind.config.js b/apps/openchallenges/app-tailwind/tailwind.config.js new file mode 100644 index 0000000000..38183db2c8 --- /dev/null +++ b/apps/openchallenges/app-tailwind/tailwind.config.js @@ -0,0 +1,14 @@ +const { createGlobPatternsForDependencies } = require('@nx/angular/tailwind'); +const { join } = require('path'); + +/** @type {import('tailwindcss').Config} */ +module.exports = { + content: [ + join(__dirname, 'src/**/!(*.stories|*.spec).{ts,html}'), + ...createGlobPatternsForDependencies(__dirname), + ], + theme: { + extend: {}, + }, + plugins: [], +}; diff --git a/apps/openchallenges/app-tailwind/tsconfig.app.json b/apps/openchallenges/app-tailwind/tsconfig.app.json new file mode 100644 index 0000000000..2afe01ea4a --- /dev/null +++ b/apps/openchallenges/app-tailwind/tsconfig.app.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "types": ["node"] + }, + "files": ["src/main.ts", "src/main.server.ts", "server.ts"], + "include": ["src/**/*.d.ts"], + "exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"] +} diff --git a/apps/openchallenges/app-tailwind/tsconfig.editor.json b/apps/openchallenges/app-tailwind/tsconfig.editor.json new file mode 100644 index 0000000000..a8ac182c08 --- /dev/null +++ b/apps/openchallenges/app-tailwind/tsconfig.editor.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/**/*.ts"], + "compilerOptions": {}, + "exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"] +} diff --git a/apps/openchallenges/app-tailwind/tsconfig.json b/apps/openchallenges/app-tailwind/tsconfig.json new file mode 100644 index 0000000000..ddb3050218 --- /dev/null +++ b/apps/openchallenges/app-tailwind/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "target": "es2022", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.editor.json" + }, + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.spec.json" + } + ], + "extends": "../../../tsconfig.base.json", + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + } +} diff --git a/apps/openchallenges/app-tailwind/tsconfig.spec.json b/apps/openchallenges/app-tailwind/tsconfig.spec.json new file mode 100644 index 0000000000..e637bf83b5 --- /dev/null +++ b/apps/openchallenges/app-tailwind/tsconfig.spec.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "module": "commonjs", + "target": "es2016", + "types": ["jest", "node"] + }, + "files": ["src/test-setup.ts"], + "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] +} From accaf313d5afc33f01ff8567ec16277691fbc952 Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Thu, 7 Nov 2024 18:47:24 +0000 Subject: [PATCH 03/18] migrate some contents from original app --- .../app-tailwind/.eslintrc.json | 10 +- .../app-tailwind/src/app/app-sections.ts | 12 + .../app-tailwind/src/app/app.component.html | 16 +- ...nent.spec.ts => app.component.spec.ts.off} | 25 +- .../app-tailwind/src/app/app.component.ts | 73 +- .../app-tailwind/src/app/app.config.server.ts | 12 +- .../app-tailwind/src/app/app.config.ts | 52 +- .../app-tailwind/src/app/app.routes.ts | 55 +- .../google-tag-manager-id.provider.ts | 7 + .../google-tag-manager.component.ts | 41 + .../src/app/google-tag-manager/index.ts | 1 + .../src/app/nx-welcome.component.ts | 935 ------------------ .../app-tailwind/src/index.html | 5 +- .../app-tailwind/src/styles.scss | 4 + .../app-tailwind/tsconfig.editor.json | 2 +- .../app-tailwind/tsconfig.spec.json | 8 +- 16 files changed, 285 insertions(+), 973 deletions(-) create mode 100644 apps/openchallenges/app-tailwind/src/app/app-sections.ts rename apps/openchallenges/app-tailwind/src/app/{app.component.spec.ts => app.component.spec.ts.off} (58%) create mode 100644 apps/openchallenges/app-tailwind/src/app/google-tag-manager/google-tag-manager-id.provider.ts create mode 100644 apps/openchallenges/app-tailwind/src/app/google-tag-manager/google-tag-manager.component.ts create mode 100644 apps/openchallenges/app-tailwind/src/app/google-tag-manager/index.ts delete mode 100644 apps/openchallenges/app-tailwind/src/app/nx-welcome.component.ts diff --git a/apps/openchallenges/app-tailwind/.eslintrc.json b/apps/openchallenges/app-tailwind/.eslintrc.json index 36040daaee..9d63a89a78 100644 --- a/apps/openchallenges/app-tailwind/.eslintrc.json +++ b/apps/openchallenges/app-tailwind/.eslintrc.json @@ -1,5 +1,5 @@ { - "extends": ["../../../.eslintrc.json"], + "extends": ["plugin:playwright/recommended", "../../../.eslintrc.json"], "ignorePatterns": ["!**/*"], "overrides": [ { @@ -10,7 +10,7 @@ "error", { "type": "attribute", - "prefix": "app", + "prefix": "openchallenges", "style": "camelCase" } ], @@ -18,7 +18,7 @@ "error", { "type": "element", - "prefix": "app", + "prefix": "openchallenges", "style": "kebab-case" } ] @@ -28,6 +28,10 @@ "files": ["*.html"], "extends": ["plugin:@nx/angular-template"], "rules": {} + }, + { + "files": ["e2e/**/*.{ts,js,tsx,jsx}"], + "rules": {} } ] } diff --git a/apps/openchallenges/app-tailwind/src/app/app-sections.ts b/apps/openchallenges/app-tailwind/src/app/app-sections.ts new file mode 100644 index 0000000000..7bd3a61f7e --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/app/app-sections.ts @@ -0,0 +1,12 @@ +import { NavbarSection } from '@sagebionetworks/openchallenges/ui'; + +export const APP_SECTIONS: { [key: string]: NavbarSection } = { + challenge: { + name: 'Challenges', + summary: 'Explore challenges', + }, + org: { + name: 'Organizations', + summary: 'Explore organizations', + }, +}; diff --git a/apps/openchallenges/app-tailwind/src/app/app.component.html b/apps/openchallenges/app-tailwind/src/app/app.component.html index 0f4018b6d7..c6f4cf6b8e 100644 --- a/apps/openchallenges/app-tailwind/src/app/app.component.html +++ b/apps/openchallenges/app-tailwind/src/app/app.component.html @@ -1 +1,15 @@ - + + + +
+ +
diff --git a/apps/openchallenges/app-tailwind/src/app/app.component.spec.ts b/apps/openchallenges/app-tailwind/src/app/app.component.spec.ts.off similarity index 58% rename from apps/openchallenges/app-tailwind/src/app/app.component.spec.ts rename to apps/openchallenges/app-tailwind/src/app/app.component.spec.ts.off index f1584ffc3c..fad2738a2e 100644 --- a/apps/openchallenges/app-tailwind/src/app/app.component.spec.ts +++ b/apps/openchallenges/app-tailwind/src/app/app.component.spec.ts.off @@ -1,27 +1,32 @@ import { TestBed } from '@angular/core/testing'; import { AppComponent } from './app.component'; import { NxWelcomeComponent } from './nx-welcome.component'; -import { RouterModule } from '@angular/router'; +import { RouterTestingModule } from '@angular/router/testing'; describe('AppComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [AppComponent, NxWelcomeComponent, RouterModule.forRoot([])], + imports: [RouterTestingModule], + declarations: [AppComponent, NxWelcomeComponent], }).compileComponents(); }); - it('should render title', () => { + it('should create the app', () => { const fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - const compiled = fixture.nativeElement as HTMLElement; - expect(compiled.querySelector('h1')?.textContent).toContain( - 'Welcome openchallenges-app-tailwind', - ); + const app = fixture.componentInstance; + expect(app).toBeTruthy(); }); - it(`should have as title 'openchallenges-app-tailwind'`, () => { + it(`should have as title 'openchallenges'`, () => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.componentInstance; - expect(app.title).toEqual('openchallenges-app-tailwind'); + expect(app.title).toEqual('openchallenges'); + }); + + it('should render title', () => { + const fixture = TestBed.createComponent(AppComponent); + fixture.detectChanges(); + const compiled = fixture.nativeElement as HTMLElement; + expect(compiled.querySelector('h1')?.textContent).toContain('Welcome openchallenges'); }); }); diff --git a/apps/openchallenges/app-tailwind/src/app/app.component.ts b/apps/openchallenges/app-tailwind/src/app/app.component.ts index 05974888b6..15f50a8b5b 100644 --- a/apps/openchallenges/app-tailwind/src/app/app.component.ts +++ b/apps/openchallenges/app-tailwind/src/app/app.component.ts @@ -1,14 +1,69 @@ -import { Component } from '@angular/core'; -import { RouterModule } from '@angular/router'; -import { NxWelcomeComponent } from './nx-welcome.component'; +import { Component, OnDestroy, OnInit } from '@angular/core'; +import { Subscription } from 'rxjs'; +import { PageTitleService } from '@sagebionetworks/openchallenges/util'; +import { + Avatar, + MenuItem, + MOCK_AVATAR_32, + USER_MENU_ITEMS, + NavbarSection, + NavbarComponent, +} from '@sagebionetworks/openchallenges/ui'; +import { APP_SECTIONS } from './app-sections'; +import { RouterOutlet } from '@angular/router'; +import { HomeDataService } from '@sagebionetworks/openchallenges/home'; +import { GoogleTagManagerComponent } from './google-tag-manager/google-tag-manager.component'; +import { ConfigService } from '@sagebionetworks/openchallenges/config'; +import { NgIf } from '@angular/common'; @Component({ - standalone: true, - imports: [NxWelcomeComponent, RouterModule], - selector: 'app-root', + selector: 'openchallenges-root', templateUrl: './app.component.html', - styleUrl: './app.component.scss', + styleUrls: ['./app.component.scss'], + standalone: true, + imports: [NavbarComponent, RouterOutlet, NgIf, GoogleTagManagerComponent], }) -export class AppComponent { - title = 'openchallenges-app-tailwind'; +export class AppComponent implements OnInit, OnDestroy { + title = 'OpenChallenges'; + sections: { [key: string]: NavbarSection } = APP_SECTIONS; + isLoggedIn = false; + userAvatar: Avatar = MOCK_AVATAR_32; + userMenuItems: MenuItem[] = USER_MENU_ITEMS; + readonly useGoogleTagManager: boolean; + + private subscriptions: Subscription[] = []; + + constructor( + private pageTitleService: PageTitleService, + private homeDataService: HomeDataService, + private configService: ConfigService, + ) { + this.useGoogleTagManager = this.configService.config.googleTagManagerId.length > 0; + } + + ngOnInit() { + // TODO Call getUserProfile() only if the user is logged in, other wise an error is generated + // when the page is rendered with SSR. + // https://github.com/Sage-Bionetworks/sage-monorepo/issues/880#issuecomment-1318955348 + // this.kauthService.getUserProfile().subscribe((userProfile) => { + // this.userAvatar.name = userProfile.username ? userProfile.username : ''; + // }); + this.userAvatar.name = 'blank'; + + this.pageTitleService.setTitle('OpenChallenges'); + + this.homeDataService.setChallengesPerYear(); + } + + ngOnDestroy(): void { + this.subscriptions.forEach((sub) => sub.unsubscribe()); + } + + selectUserMenuItem(menuItem: MenuItem): void { + console.log('Menu item selected', menuItem); + } + + login(): void { + console.log('Clicked on log In'); + } } diff --git a/apps/openchallenges/app-tailwind/src/app/app.config.server.ts b/apps/openchallenges/app-tailwind/src/app/app.config.server.ts index 1980cfe118..33d83d276a 100644 --- a/apps/openchallenges/app-tailwind/src/app/app.config.server.ts +++ b/apps/openchallenges/app-tailwind/src/app/app.config.server.ts @@ -1,9 +1,17 @@ import { mergeApplicationConfig, ApplicationConfig } from '@angular/core'; import { provideServerRendering } from '@angular/platform-server'; -import { appConfig } from './app.config'; +import { appConfig, APP_BASE_URL_PROVIDER_INDEX } from './app.config'; +import { provideClientHydration } from '@angular/platform-browser'; const serverConfig: ApplicationConfig = { - providers: [provideServerRendering()], + providers: [provideServerRendering(), provideClientHydration()], }; +// The file server.ts defines a provider that specifies 'APP_BASE_URL' based on the request protocol +// and host. If this provider could be defined in serverConfig above, there would be no need to +// manually remove the provider that specifies 'APP_BASE_URL' from appConfig used for client-side +// rendering. Also removing based on an index should be avoided: I would have preferred to remove it +// based on a property value but couldn't. +appConfig.providers.splice(APP_BASE_URL_PROVIDER_INDEX, 1); + export const config = mergeApplicationConfig(appConfig, serverConfig); diff --git a/apps/openchallenges/app-tailwind/src/app/app.config.ts b/apps/openchallenges/app-tailwind/src/app/app.config.ts index 8f91ae956c..e5bcc558e7 100644 --- a/apps/openchallenges/app-tailwind/src/app/app.config.ts +++ b/apps/openchallenges/app-tailwind/src/app/app.config.ts @@ -1,12 +1,50 @@ -import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'; -import { provideRouter } from '@angular/router'; -import { appRoutes } from './app.routes'; -import { provideClientHydration } from '@angular/platform-browser'; +import { ApplicationConfig, APP_INITIALIZER, APP_ID } from '@angular/core'; +import { + provideRouter, + withEnabledBlockingInitialNavigation, + withInMemoryScrolling, +} from '@angular/router'; +import { withInterceptorsFromDi, provideHttpClient } from '@angular/common/http'; +import { provideAnimations } from '@angular/platform-browser/animations'; +import { BASE_PATH as API_CLIENT_BASE_PATH } from '@sagebionetworks/openchallenges/api-client-angular'; +import { configFactory, ConfigService } from '@sagebionetworks/openchallenges/config'; + +import { routes } from './app.routes'; + +// This index is used to remove the corresponding provider in app.config.server.ts. +export const APP_BASE_URL_PROVIDER_INDEX = 1; export const appConfig: ApplicationConfig = { providers: [ - provideClientHydration(), - provideZoneChangeDetection({ eventCoalescing: true }), - provideRouter(appRoutes), + { provide: APP_ID, useValue: 'openchallenges-app' }, + { + // This provider must be specified at the index defined by APP_BASE_URL_PROVIDER_INDEX. + provide: 'APP_BASE_URL', + useFactory: () => '.', + deps: [], + }, + { + provide: APP_INITIALIZER, + useFactory: configFactory, + deps: [ConfigService], + multi: true, + }, + { + provide: API_CLIENT_BASE_PATH, + useFactory: (configService: ConfigService) => + configService.config.isPlatformServer + ? configService.config.ssrApiUrl + : configService.config.csrApiUrl, + deps: [ConfigService], + }, + provideAnimations(), + provideHttpClient(withInterceptorsFromDi()), + provideRouter( + routes, + withEnabledBlockingInitialNavigation(), + withInMemoryScrolling({ + scrollPositionRestoration: 'enabled', + }), + ), ], }; diff --git a/apps/openchallenges/app-tailwind/src/app/app.routes.ts b/apps/openchallenges/app-tailwind/src/app/app.routes.ts index 8762dfe2c6..d3861020ed 100644 --- a/apps/openchallenges/app-tailwind/src/app/app.routes.ts +++ b/apps/openchallenges/app-tailwind/src/app/app.routes.ts @@ -1,3 +1,54 @@ -import { Route } from '@angular/router'; +import { Routes } from '@angular/router'; -export const appRoutes: Route[] = []; +export const routes: Routes = [ + { path: '', redirectTo: 'home', pathMatch: 'full' }, + // { + // path: 'home', + // loadChildren: () => + // import('@sagebionetworks/openchallenges/home').then((routes) => routes.routes), + // }, + { + path: 'about', + loadChildren: () => + import('@sagebionetworks/openchallenges/about').then((routes) => routes.routes), + }, + // { + // path: 'challenge', + // loadChildren: () => + // import('@sagebionetworks/openchallenges/challenge-search').then((routes) => routes.routes), + // }, + // { + // path: 'org', + // loadChildren: () => + // import('@sagebionetworks/openchallenges/org-search').then((routes) => routes.routes), + // }, + // { + // path: 'signup', + // loadChildren: () => + // import('@sagebionetworks/openchallenges/signup').then((routes) => routes.routes), + // }, + { + path: 'team', + loadChildren: () => + import('@sagebionetworks/openchallenges/team').then((routes) => routes.routes), + }, + { + path: 'not-found', + loadChildren: () => + import('@sagebionetworks/openchallenges/not-found').then((routes) => routes.routes), + }, + // { + // path: 'org/:orgLogin', + // loadChildren: () => + // import('@sagebionetworks/openchallenges/org-profile').then((routes) => routes.routes), + // }, + // { + // path: 'challenge/:challengeId', + // loadChildren: () => + // import('@sagebionetworks/openchallenges/challenge').then((routes) => routes.routes), + // }, + { + path: '**', + redirectTo: '/not-found', + }, +]; diff --git a/apps/openchallenges/app-tailwind/src/app/google-tag-manager/google-tag-manager-id.provider.ts b/apps/openchallenges/app-tailwind/src/app/google-tag-manager/google-tag-manager-id.provider.ts new file mode 100644 index 0000000000..edcb6abae8 --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/app/google-tag-manager/google-tag-manager-id.provider.ts @@ -0,0 +1,7 @@ +import { ConfigService } from '@sagebionetworks/openchallenges/config'; + +export const googleTagManagerIdProvider = { + provide: 'googleTagManagerId', + useFactory: (configService: ConfigService) => configService.config.googleTagManagerId, + deps: [ConfigService], +}; diff --git a/apps/openchallenges/app-tailwind/src/app/google-tag-manager/google-tag-manager.component.ts b/apps/openchallenges/app-tailwind/src/app/google-tag-manager/google-tag-manager.component.ts new file mode 100644 index 0000000000..5dedf67c5e --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/app/google-tag-manager/google-tag-manager.component.ts @@ -0,0 +1,41 @@ +import { Component, OnInit } from '@angular/core'; +import { NavigationEnd, Router } from '@angular/router'; +import { GoogleTagManagerService } from 'angular-google-tag-manager'; +import { ConfigService } from '@sagebionetworks/openchallenges/config'; +import { googleTagManagerIdProvider } from './google-tag-manager-id.provider'; + +@Component({ + selector: 'openchallenges-google-tag-manager', + template: '', + standalone: true, + providers: [ + googleTagManagerIdProvider, + // GoogleTagManagerService has been evaluated before we defined the GTM ID. That is why we + // redefine it below so that its initialization get access to the GTM ID. + { + provide: GoogleTagManagerService, + useClass: GoogleTagManagerService, + }, + ], +}) +export class GoogleTagManagerComponent implements OnInit { + constructor( + private router: Router, + private gtmService: GoogleTagManagerService, + private configService: ConfigService, + ) {} + + ngOnInit(): void { + if (!this.configService.config.isPlatformServer) { + this.router.events.forEach((event) => { + if (event instanceof NavigationEnd) { + const gtmTag = { + event: 'page', + pageName: event.url, + }; + this.gtmService.pushTag(gtmTag); + } + }); + } + } +} diff --git a/apps/openchallenges/app-tailwind/src/app/google-tag-manager/index.ts b/apps/openchallenges/app-tailwind/src/app/google-tag-manager/index.ts new file mode 100644 index 0000000000..2c6dc359fa --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/app/google-tag-manager/index.ts @@ -0,0 +1 @@ +export * from './google-tag-manager.component'; diff --git a/apps/openchallenges/app-tailwind/src/app/nx-welcome.component.ts b/apps/openchallenges/app-tailwind/src/app/nx-welcome.component.ts deleted file mode 100644 index 1bd71a85b1..0000000000 --- a/apps/openchallenges/app-tailwind/src/app/nx-welcome.component.ts +++ /dev/null @@ -1,935 +0,0 @@ -import { Component, ViewEncapsulation } from '@angular/core'; -import { CommonModule } from '@angular/common'; - -@Component({ - selector: 'app-nx-welcome', - standalone: true, - imports: [CommonModule], - template: ` - - -
-
- -
-

- Hello there, - Welcome openchallenges-app-tailwind 👋 -

-
- -
-
-

- - - - You're up and running -

- What's next? -
-
- - - -
-
- - - -
-

Next steps

-

Here are some things you can do with Nx:

-
- - - - - Build, test and lint your app - -
# Build
-nx build 
-# Test
-nx test 
-# Lint
-nx lint 
-# Run them together!
-nx run-many -t build test lint
-
-
- - - - - View project details - -
nx show project openchallenges-app-tailwind
-
- -
- - - - - View interactive project graph - -
nx graph
-
- -
- - - - - Add UI library - -
# Generate UI lib
-nx g @nx/angular:lib ui
-# Add a component
-nx g @nx/angular:component ui/src/lib/button
-
-
-

- Carefully crafted with - - - -

-
-
- `, - styles: [], - encapsulation: ViewEncapsulation.None, -}) -export class NxWelcomeComponent {} diff --git a/apps/openchallenges/app-tailwind/src/index.html b/apps/openchallenges/app-tailwind/src/index.html index a643a399cb..e132b0928b 100644 --- a/apps/openchallenges/app-tailwind/src/index.html +++ b/apps/openchallenges/app-tailwind/src/index.html @@ -2,12 +2,13 @@ - openchallenges-app-tailwind + OpenChallenges + - + diff --git a/apps/openchallenges/app-tailwind/src/styles.scss b/apps/openchallenges/app-tailwind/src/styles.scss index 77e408aa8b..02a023cc11 100644 --- a/apps/openchallenges/app-tailwind/src/styles.scss +++ b/apps/openchallenges/app-tailwind/src/styles.scss @@ -1,3 +1,7 @@ +@use 'libs/openchallenges/styles/src/index'; + +// @use 'app-theme'; + @tailwind base; @tailwind components; @tailwind utilities; diff --git a/apps/openchallenges/app-tailwind/tsconfig.editor.json b/apps/openchallenges/app-tailwind/tsconfig.editor.json index a8ac182c08..f1cbdf153e 100644 --- a/apps/openchallenges/app-tailwind/tsconfig.editor.json +++ b/apps/openchallenges/app-tailwind/tsconfig.editor.json @@ -1,6 +1,6 @@ { "extends": "./tsconfig.json", - "include": ["src/**/*.ts"], + "include": ["src/**/*.ts", "src/app/app.component.spec.ts.off"], "compilerOptions": {}, "exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"] } diff --git a/apps/openchallenges/app-tailwind/tsconfig.spec.json b/apps/openchallenges/app-tailwind/tsconfig.spec.json index e637bf83b5..773767299c 100644 --- a/apps/openchallenges/app-tailwind/tsconfig.spec.json +++ b/apps/openchallenges/app-tailwind/tsconfig.spec.json @@ -7,5 +7,11 @@ "types": ["jest", "node"] }, "files": ["src/test-setup.ts"], - "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] + "include": [ + "jest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.d.ts", + "src/app/app.component.spec.ts.off" + ] } From ebfc3a0bbe93a9cf35f60db798cef9cfa912b384 Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Thu, 7 Nov 2024 22:13:46 +0000 Subject: [PATCH 04/18] add other original content of app --- apps/openchallenges/app-tailwind/.env.example | 8 +++ apps/openchallenges/app-tailwind/Dockerfile | 24 +++++++ .../10-envsubst-on-app-config-template.sh | 4 ++ .../app-tailwind/docker-entrypoint.sh | 11 +++ .../challenge-search-paginator.spec.ts.off | 17 +++++ .../app-tailwind/e2e/home.spec.ts.off | 8 +++ .../app-tailwind/playwright.config.ts | 71 +++++++++++++++++++ .../app-tailwind/src/_app-theme.scss | 46 ++++++++++++ .../app-tailwind/src/app/app.component.html | 4 +- .../app-tailwind/src/app/app.routes.ts | 60 ++++++++-------- .../src/assets/silent-check-sso.html | 7 ++ .../app-tailwind/src/config/config.json | 10 +++ .../src/config/config.json.template | 10 +++ .../src/environments/environment.prod.ts | 5 ++ .../src/environments/environment.ts | 18 +++++ .../app-tailwind/src/humans.txt | 22 ++++++ .../app-tailwind/src/proxy.conf.json | 1 + .../app-tailwind/src/robots.txt | 5 ++ .../app-tailwind/src/styles.scss | 4 +- 19 files changed, 300 insertions(+), 35 deletions(-) create mode 100644 apps/openchallenges/app-tailwind/.env.example create mode 100644 apps/openchallenges/app-tailwind/Dockerfile create mode 100644 apps/openchallenges/app-tailwind/docker-entrypoint.d/10-envsubst-on-app-config-template.sh create mode 100644 apps/openchallenges/app-tailwind/docker-entrypoint.sh create mode 100644 apps/openchallenges/app-tailwind/e2e/challenge-search-paginator.spec.ts.off create mode 100644 apps/openchallenges/app-tailwind/e2e/home.spec.ts.off create mode 100644 apps/openchallenges/app-tailwind/playwright.config.ts create mode 100644 apps/openchallenges/app-tailwind/src/_app-theme.scss create mode 100644 apps/openchallenges/app-tailwind/src/assets/silent-check-sso.html create mode 100644 apps/openchallenges/app-tailwind/src/config/config.json create mode 100644 apps/openchallenges/app-tailwind/src/config/config.json.template create mode 100644 apps/openchallenges/app-tailwind/src/environments/environment.prod.ts create mode 100644 apps/openchallenges/app-tailwind/src/environments/environment.ts create mode 100644 apps/openchallenges/app-tailwind/src/humans.txt create mode 100644 apps/openchallenges/app-tailwind/src/proxy.conf.json create mode 100644 apps/openchallenges/app-tailwind/src/robots.txt diff --git a/apps/openchallenges/app-tailwind/.env.example b/apps/openchallenges/app-tailwind/.env.example new file mode 100644 index 0000000000..717fd05f69 --- /dev/null +++ b/apps/openchallenges/app-tailwind/.env.example @@ -0,0 +1,8 @@ +API_DOCS_URL="http://localhost:8000/api-docs" +APP_VERSION="1.0.0-alpha" +CSR_API_URL="http://localhost:8082/api/v1" +DATA_UPDATED_ON="2023-09-26" +ENVIRONMENT="production" +GOOGLE_TAG_MANAGER_ID="" +SSR_API_URL="http://openchallenges-api-gateway:8082/api/v1" +ENABLE_OPERATION_FILTER="false" \ No newline at end of file diff --git a/apps/openchallenges/app-tailwind/Dockerfile b/apps/openchallenges/app-tailwind/Dockerfile new file mode 100644 index 0000000000..c27f548043 --- /dev/null +++ b/apps/openchallenges/app-tailwind/Dockerfile @@ -0,0 +1,24 @@ +FROM node:20.7.0-alpine + +ENV APP_DIR=/app + +RUN apk add --no-cache curl envsubst jq su-exec + +WORKDIR / +COPY apps/openchallenges/app/docker-entrypoint.sh . +COPY apps/openchallenges/app/docker-entrypoint.d /docker-entrypoint.d +RUN chmod +x docker-entrypoint.sh /docker-entrypoint.d/* + +WORKDIR ${APP_DIR} +COPY dist/apps/openchallenges/app/browser/server ${APP_DIR} +# The path of the destination folder must be the same as the path specified in server.ts. +COPY dist/apps/openchallenges/app/browser/browser ${APP_DIR}/dist/apps/openchallenges/app/browser/browser + +HEALTHCHECK --interval=2s --timeout=3s --retries=20 --start-period=5s \ + CMD curl --fail --silent "localhost:4200/health" | jq '.status' | grep UP || exit 1 + +EXPOSE 4200 + +ENTRYPOINT ["/docker-entrypoint.sh"] + +CMD ["node", "main.js"] diff --git a/apps/openchallenges/app-tailwind/docker-entrypoint.d/10-envsubst-on-app-config-template.sh b/apps/openchallenges/app-tailwind/docker-entrypoint.d/10-envsubst-on-app-config-template.sh new file mode 100644 index 0000000000..dfef93928a --- /dev/null +++ b/apps/openchallenges/app-tailwind/docker-entrypoint.d/10-envsubst-on-app-config-template.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +cd "${APP_DIR}/dist/apps/openchallenges/app/browser/browser/config" +envsubst < config.json.template > config.json diff --git a/apps/openchallenges/app-tailwind/docker-entrypoint.sh b/apps/openchallenges/app-tailwind/docker-entrypoint.sh new file mode 100644 index 0000000000..fc31ae5aa4 --- /dev/null +++ b/apps/openchallenges/app-tailwind/docker-entrypoint.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env sh +set -e + +/docker-entrypoint.d/10-envsubst-on-app-config-template.sh + +if [ "$1" = 'node' ]; then + cd ${APP_DIR} + exec su-exec node "$@" +fi + +exec "$@" \ No newline at end of file diff --git a/apps/openchallenges/app-tailwind/e2e/challenge-search-paginator.spec.ts.off b/apps/openchallenges/app-tailwind/e2e/challenge-search-paginator.spec.ts.off new file mode 100644 index 0000000000..cee25bcecd --- /dev/null +++ b/apps/openchallenges/app-tailwind/e2e/challenge-search-paginator.spec.ts.off @@ -0,0 +1,17 @@ +import { test, expect } from '@playwright/test'; + +test('paginator reset to page 1 on filter change', async ({ page }) => { + // Go to the challenge search page + await page.goto('/challenge'); + // Go to the second page + await page.getByRole('button', { name: '2' }).click(); + // Make a change to the challenge query input by selecting 'active' status + await page + .locator('div') + .filter({ hasText: /^Active$/ }) + .locator('div') + .nth(2) + .click(); + // Assert that the paginator page number has been reset to 1 + await expect(page.getByRole('button', { name: '1' })).toBeVisible(); +}); diff --git a/apps/openchallenges/app-tailwind/e2e/home.spec.ts.off b/apps/openchallenges/app-tailwind/e2e/home.spec.ts.off new file mode 100644 index 0000000000..e21e7dbde9 --- /dev/null +++ b/apps/openchallenges/app-tailwind/e2e/home.spec.ts.off @@ -0,0 +1,8 @@ +import { test, expect } from '@playwright/test'; + +test('has banner', async ({ page }) => { + await page.goto('/'); + + // Expect first h4 to contain a substring. + await expect(page.locator('h4').first()).toHaveText('Welcome to OpenChallenges!'); +}); diff --git a/apps/openchallenges/app-tailwind/playwright.config.ts b/apps/openchallenges/app-tailwind/playwright.config.ts new file mode 100644 index 0000000000..04fbf127ca --- /dev/null +++ b/apps/openchallenges/app-tailwind/playwright.config.ts @@ -0,0 +1,71 @@ +import { defineConfig, devices } from '@playwright/test'; +import { nxE2EPreset } from '@nx/playwright/preset'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import { workspaceRoot } from '@nx/devkit'; + +// For CI, you may want to set BASE_URL to the deployed application. +const baseURL = process.env['BASE_URL'] || 'http://localhost:4200'; + +/** + * See https://playwright.dev/docs/test-configuration. + */ +export default defineConfig({ + ...nxE2EPreset(__filename, { + testDir: './e2e', + // includeMobileBrowsers: true, // includes mobile Chrome and Safari + // includeBrandedBrowsers: true, // includes Google Chrome and Microsoft Edge + }), + projects: [ + /* Test against desktop browsers */ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + { + name: 'firefox', + use: { ...devices['Desktop Firefox'] }, + }, + { + name: 'webkit', + use: { ...devices['Desktop Safari'] }, + }, + /* Test against mobile viewports. */ + { + name: 'Mobile Chrome', + use: { ...devices['Pixel 5'] }, + }, + // { + // name: 'Mobile Safari', + // use: { ...devices['iPhone 12'] }, + // }, + /* Test against branded browsers. */ + // When Google Chrome and/or Microsoft Edge are installed in the dev container, Playwright will + // use one of them to open the HTML report. These browsers are slow to open and respond because + // they are emulated. It is recommended to now use them in combination with the HTML report. By + // default, when Chrome and Edge are not installed, the HTML report opens in the native browser + // of the developer, which is much faster. + // { + // name: 'Google Chrome', use: { ...devices['Desktop Chrome'], channel: 'chrome' }, // or + // 'chrome-beta' + // }, + // { + // name: 'Microsoft Edge', use: { ...devices['Desktop Edge'], channel: 'msedge' }, // or + // 'msedge-dev' + // }, + ], + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + use: { + baseURL, + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'on-first-retry', + }, + /* Run your local dev server before starting the tests */ + webServer: { + command: 'nx serve openchallenges-app', + url: 'http://127.0.0.1:4200', + reuseExistingServer: !process.env.CI, + cwd: workspaceRoot, + }, + reporter: [['line'], ['html', { open: 'never' }]], + // reporter: process.env.CI ? 'html' : 'line', +}); diff --git a/apps/openchallenges/app-tailwind/src/_app-theme.scss b/apps/openchallenges/app-tailwind/src/_app-theme.scss new file mode 100644 index 0000000000..9b641f2bcf --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/_app-theme.scss @@ -0,0 +1,46 @@ +@use 'sass:map'; +@use '@angular/material' as mat; +@use 'libs/openchallenges/themes/src/fonts' as fonts; +@use 'libs/openchallenges/themes/src/palettes' as palettes; +@use 'libs/openchallenges/themes/src/index' as openchallenges; +@include mat.typography-hierarchy(fonts.$lato); +@include mat.core; + +$primary: mat.m2-define-palette(palettes.$dark-blue-palette, 600); +$accent: mat.m2-define-palette(palettes.$accent-purple-palette, 400); +$theme: mat.m2-define-light-theme( + ( + color: ( + primary: $primary, + accent: $accent, + ), + typography: fonts.$lato, + density: 0, + is-dark: false, + ) +); + +// Add custom palettes used in figma to the theme +$theme: map.deep-merge( + $theme, + ( + color: ( + figma: palettes.$figma-collection, + ), + ) +); + +// Emit theme-dependent styles for common features used across multiple components. +@include mat.core-theme($theme); + +// Emit styles for MatButton based on `$theme`. +@include mat.button-theme($theme); + +// Include the theme mixins for other components you use here. +@include openchallenges.theme($theme); + +:root { + --color-btn-primary: #39bde7; + --color-btn-disabled: #ebebe4; + --color-btn-shadow: rgb(196 196 196 / 100%); +} diff --git a/apps/openchallenges/app-tailwind/src/app/app.component.html b/apps/openchallenges/app-tailwind/src/app/app.component.html index c6f4cf6b8e..968b56dcd4 100644 --- a/apps/openchallenges/app-tailwind/src/app/app.component.html +++ b/apps/openchallenges/app-tailwind/src/app/app.component.html @@ -1,6 +1,6 @@ - +/>
diff --git a/apps/openchallenges/app-tailwind/src/app/app.routes.ts b/apps/openchallenges/app-tailwind/src/app/app.routes.ts index d3861020ed..973436a0a5 100644 --- a/apps/openchallenges/app-tailwind/src/app/app.routes.ts +++ b/apps/openchallenges/app-tailwind/src/app/app.routes.ts @@ -2,31 +2,31 @@ import { Routes } from '@angular/router'; export const routes: Routes = [ { path: '', redirectTo: 'home', pathMatch: 'full' }, - // { - // path: 'home', - // loadChildren: () => - // import('@sagebionetworks/openchallenges/home').then((routes) => routes.routes), - // }, + { + path: 'home', + loadChildren: () => + import('@sagebionetworks/openchallenges/home').then((routes) => routes.routes), + }, { path: 'about', loadChildren: () => import('@sagebionetworks/openchallenges/about').then((routes) => routes.routes), }, - // { - // path: 'challenge', - // loadChildren: () => - // import('@sagebionetworks/openchallenges/challenge-search').then((routes) => routes.routes), - // }, - // { - // path: 'org', - // loadChildren: () => - // import('@sagebionetworks/openchallenges/org-search').then((routes) => routes.routes), - // }, - // { - // path: 'signup', - // loadChildren: () => - // import('@sagebionetworks/openchallenges/signup').then((routes) => routes.routes), - // }, + { + path: 'challenge', + loadChildren: () => + import('@sagebionetworks/openchallenges/challenge-search').then((routes) => routes.routes), + }, + { + path: 'org', + loadChildren: () => + import('@sagebionetworks/openchallenges/org-search').then((routes) => routes.routes), + }, + { + path: 'signup', + loadChildren: () => + import('@sagebionetworks/openchallenges/signup').then((routes) => routes.routes), + }, { path: 'team', loadChildren: () => @@ -37,16 +37,16 @@ export const routes: Routes = [ loadChildren: () => import('@sagebionetworks/openchallenges/not-found').then((routes) => routes.routes), }, - // { - // path: 'org/:orgLogin', - // loadChildren: () => - // import('@sagebionetworks/openchallenges/org-profile').then((routes) => routes.routes), - // }, - // { - // path: 'challenge/:challengeId', - // loadChildren: () => - // import('@sagebionetworks/openchallenges/challenge').then((routes) => routes.routes), - // }, + { + path: 'org/:orgLogin', + loadChildren: () => + import('@sagebionetworks/openchallenges/org-profile').then((routes) => routes.routes), + }, + { + path: 'challenge/:challengeId', + loadChildren: () => + import('@sagebionetworks/openchallenges/challenge').then((routes) => routes.routes), + }, { path: '**', redirectTo: '/not-found', diff --git a/apps/openchallenges/app-tailwind/src/assets/silent-check-sso.html b/apps/openchallenges/app-tailwind/src/assets/silent-check-sso.html new file mode 100644 index 0000000000..b3bd540ded --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/assets/silent-check-sso.html @@ -0,0 +1,7 @@ + + + + + diff --git a/apps/openchallenges/app-tailwind/src/config/config.json b/apps/openchallenges/app-tailwind/src/config/config.json new file mode 100644 index 0000000000..1855c41182 --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/config/config.json @@ -0,0 +1,10 @@ +{ + "apiDocsUrl": "http://localhost:8000/api-docs", + "appVersion": "1.0.0-alpha", + "csrApiUrl": "http://localhost:8082/api/v1", + "dataUpdatedOn": "yyyy-mm-dd", + "environment": "development", + "googleTagManagerId": "", + "ssrApiUrl": "http://openchallenges-api-gateway:8082/api/v1", + "enableOperationFilter": false +} diff --git a/apps/openchallenges/app-tailwind/src/config/config.json.template b/apps/openchallenges/app-tailwind/src/config/config.json.template new file mode 100644 index 0000000000..9c6e9c104f --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/config/config.json.template @@ -0,0 +1,10 @@ +{ + "apiDocsUrl": "${API_DOCS_URL}", + "appVersion": "${APP_VERSION}", + "csrApiUrl": "${CSR_API_URL}", + "dataUpdatedOn": "${DATA_UPDATED_ON}", + "environment": "${ENVIRONMENT}", + "googleTagManagerId": "${GOOGLE_TAG_MANAGER_ID}", + "ssrApiUrl": "${SSR_API_URL}", + "enableOperationFilter": "${ENABLE_OPERATION_FILTER}" +} \ No newline at end of file diff --git a/apps/openchallenges/app-tailwind/src/environments/environment.prod.ts b/apps/openchallenges/app-tailwind/src/environments/environment.prod.ts new file mode 100644 index 0000000000..81afb5af8b --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/environments/environment.prod.ts @@ -0,0 +1,5 @@ +export const environment = { + production: true, + apiUrl: 'http://localhost:4200/api', + appVersion: '0.0.1', +}; diff --git a/apps/openchallenges/app-tailwind/src/environments/environment.ts b/apps/openchallenges/app-tailwind/src/environments/environment.ts new file mode 100644 index 0000000000..1bfbbf2d22 --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/environments/environment.ts @@ -0,0 +1,18 @@ +// This file can be replaced during build by using the `fileReplacements` array. +// `ng build` replaces `environment.ts` with `environment.prod.ts`. +// The list of file replacements can be found in `angular.json`. + +export const environment = { + production: false, + apiUrl: 'http://localhost:4200/api', + appVersion: '0.0.1', +}; + +/* + * For easier debugging in development mode, you can import the following file + * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. + * + * This import should be commented out in production mode because it will have a negative impact + * on performance if an error is thrown. + */ +// import 'zone.js/plugins/zone-error'; // Included with Angular CLI. diff --git a/apps/openchallenges/app-tailwind/src/humans.txt b/apps/openchallenges/app-tailwind/src/humans.txt new file mode 100644 index 0000000000..f2711c9979 --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/humans.txt @@ -0,0 +1,22 @@ +/* TEAM */ +Lead: Thomas Schaffter +Contact: https://github.com/tschaffter + +Developer: Verena Chung +Contact: https://github.com/vpchung + +Developer: Rong Chai +Contact: https://github.com/rrchai + +Developer: Maria Diaz +Contact: https://github.com/mdsage1 + +Director: Jake Albrecht +Contact: https://github.com/chepyle + +/* THANKS */ +Director: James Eddy +Contact: https://github.com/jaeddy + +/* SITE */ +Last update: 2023/05/26 diff --git a/apps/openchallenges/app-tailwind/src/proxy.conf.json b/apps/openchallenges/app-tailwind/src/proxy.conf.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/proxy.conf.json @@ -0,0 +1 @@ +{} diff --git a/apps/openchallenges/app-tailwind/src/robots.txt b/apps/openchallenges/app-tailwind/src/robots.txt new file mode 100644 index 0000000000..4c73a82512 --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/robots.txt @@ -0,0 +1,5 @@ +User-agent: * +Disallow: /api/ +Disallow: /login/ + +Sitemap: http://www.openchallenges.org/sitemap.xml \ No newline at end of file diff --git a/apps/openchallenges/app-tailwind/src/styles.scss b/apps/openchallenges/app-tailwind/src/styles.scss index 02a023cc11..2a2c0a6935 100644 --- a/apps/openchallenges/app-tailwind/src/styles.scss +++ b/apps/openchallenges/app-tailwind/src/styles.scss @@ -1,7 +1,5 @@ @use 'libs/openchallenges/styles/src/index'; - -// @use 'app-theme'; - +@use 'app-theme'; @tailwind base; @tailwind components; @tailwind utilities; From 14ecc6a61ac3a6eb88bea8bc92e66b4b70d9e37a Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Thu, 7 Nov 2024 22:14:51 +0000 Subject: [PATCH 05/18] update the build executor --- apps/openchallenges/app-tailwind/project.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/openchallenges/app-tailwind/project.json b/apps/openchallenges/app-tailwind/project.json index eb817c797c..4f47721cbf 100644 --- a/apps/openchallenges/app-tailwind/project.json +++ b/apps/openchallenges/app-tailwind/project.json @@ -2,12 +2,11 @@ "name": "openchallenges-app-tailwind", "$schema": "../../../node_modules/nx/schemas/project-schema.json", "projectType": "application", - "prefix": "app", "sourceRoot": "apps/openchallenges/app-tailwind/src", - "tags": [], + "prefix": "openchallenges", "targets": { "build": { - "executor": "@angular-devkit/build-angular:application", + "executor": "@nx/angular:application", "outputs": ["{options.outputPath}"], "options": { "outputPath": "dist/apps/openchallenges/app-tailwind", From 4becd4309a0492bddd32a331dd49ca5ad5cfdb29 Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Thu, 7 Nov 2024 22:56:50 +0000 Subject: [PATCH 06/18] create a fresh project using nx/angular --- apps/openchallenges/app-tailwind/.env.example | 8 - .../app-tailwind/.eslintrc.json | 10 +- apps/openchallenges/app-tailwind/Dockerfile | 24 - .../10-envsubst-on-app-config-template.sh | 4 - .../app-tailwind/docker-entrypoint.sh | 11 - .../challenge-search-paginator.spec.ts.off | 17 - .../app-tailwind/e2e/home.spec.ts.off | 8 - .../app-tailwind/playwright.config.ts | 71 -- apps/openchallenges/app-tailwind/project.json | 5 +- .../app-tailwind/src/_app-theme.scss | 46 - .../app-tailwind/src/app/app-sections.ts | 12 - .../app-tailwind/src/app/app.component.html | 16 +- ...nent.spec.ts.off => app.component.spec.ts} | 25 +- .../app-tailwind/src/app/app.component.ts | 73 +- .../app-tailwind/src/app/app.config.server.ts | 12 +- .../app-tailwind/src/app/app.config.ts | 52 +- .../app-tailwind/src/app/app.routes.ts | 55 +- .../google-tag-manager-id.provider.ts | 7 - .../google-tag-manager.component.ts | 41 - .../src/app/google-tag-manager/index.ts | 1 - .../src/app/nx-welcome.component.ts | 935 ++++++++++++++++++ .../src/assets/silent-check-sso.html | 7 - .../app-tailwind/src/config/config.json | 10 - .../src/config/config.json.template | 10 - .../src/environments/environment.prod.ts | 5 - .../src/environments/environment.ts | 18 - .../app-tailwind/src/humans.txt | 22 - .../app-tailwind/src/index.html | 5 +- .../app-tailwind/src/proxy.conf.json | 1 - .../app-tailwind/src/robots.txt | 5 - .../app-tailwind/src/styles.scss | 2 - .../app-tailwind/tsconfig.editor.json | 2 +- .../app-tailwind/tsconfig.spec.json | 8 +- 33 files changed, 976 insertions(+), 552 deletions(-) delete mode 100644 apps/openchallenges/app-tailwind/.env.example delete mode 100644 apps/openchallenges/app-tailwind/Dockerfile delete mode 100644 apps/openchallenges/app-tailwind/docker-entrypoint.d/10-envsubst-on-app-config-template.sh delete mode 100644 apps/openchallenges/app-tailwind/docker-entrypoint.sh delete mode 100644 apps/openchallenges/app-tailwind/e2e/challenge-search-paginator.spec.ts.off delete mode 100644 apps/openchallenges/app-tailwind/e2e/home.spec.ts.off delete mode 100644 apps/openchallenges/app-tailwind/playwright.config.ts delete mode 100644 apps/openchallenges/app-tailwind/src/_app-theme.scss delete mode 100644 apps/openchallenges/app-tailwind/src/app/app-sections.ts rename apps/openchallenges/app-tailwind/src/app/{app.component.spec.ts.off => app.component.spec.ts} (58%) delete mode 100644 apps/openchallenges/app-tailwind/src/app/google-tag-manager/google-tag-manager-id.provider.ts delete mode 100644 apps/openchallenges/app-tailwind/src/app/google-tag-manager/google-tag-manager.component.ts delete mode 100644 apps/openchallenges/app-tailwind/src/app/google-tag-manager/index.ts create mode 100644 apps/openchallenges/app-tailwind/src/app/nx-welcome.component.ts delete mode 100644 apps/openchallenges/app-tailwind/src/assets/silent-check-sso.html delete mode 100644 apps/openchallenges/app-tailwind/src/config/config.json delete mode 100644 apps/openchallenges/app-tailwind/src/config/config.json.template delete mode 100644 apps/openchallenges/app-tailwind/src/environments/environment.prod.ts delete mode 100644 apps/openchallenges/app-tailwind/src/environments/environment.ts delete mode 100644 apps/openchallenges/app-tailwind/src/humans.txt delete mode 100644 apps/openchallenges/app-tailwind/src/proxy.conf.json delete mode 100644 apps/openchallenges/app-tailwind/src/robots.txt diff --git a/apps/openchallenges/app-tailwind/.env.example b/apps/openchallenges/app-tailwind/.env.example deleted file mode 100644 index 717fd05f69..0000000000 --- a/apps/openchallenges/app-tailwind/.env.example +++ /dev/null @@ -1,8 +0,0 @@ -API_DOCS_URL="http://localhost:8000/api-docs" -APP_VERSION="1.0.0-alpha" -CSR_API_URL="http://localhost:8082/api/v1" -DATA_UPDATED_ON="2023-09-26" -ENVIRONMENT="production" -GOOGLE_TAG_MANAGER_ID="" -SSR_API_URL="http://openchallenges-api-gateway:8082/api/v1" -ENABLE_OPERATION_FILTER="false" \ No newline at end of file diff --git a/apps/openchallenges/app-tailwind/.eslintrc.json b/apps/openchallenges/app-tailwind/.eslintrc.json index 9d63a89a78..36040daaee 100644 --- a/apps/openchallenges/app-tailwind/.eslintrc.json +++ b/apps/openchallenges/app-tailwind/.eslintrc.json @@ -1,5 +1,5 @@ { - "extends": ["plugin:playwright/recommended", "../../../.eslintrc.json"], + "extends": ["../../../.eslintrc.json"], "ignorePatterns": ["!**/*"], "overrides": [ { @@ -10,7 +10,7 @@ "error", { "type": "attribute", - "prefix": "openchallenges", + "prefix": "app", "style": "camelCase" } ], @@ -18,7 +18,7 @@ "error", { "type": "element", - "prefix": "openchallenges", + "prefix": "app", "style": "kebab-case" } ] @@ -28,10 +28,6 @@ "files": ["*.html"], "extends": ["plugin:@nx/angular-template"], "rules": {} - }, - { - "files": ["e2e/**/*.{ts,js,tsx,jsx}"], - "rules": {} } ] } diff --git a/apps/openchallenges/app-tailwind/Dockerfile b/apps/openchallenges/app-tailwind/Dockerfile deleted file mode 100644 index c27f548043..0000000000 --- a/apps/openchallenges/app-tailwind/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM node:20.7.0-alpine - -ENV APP_DIR=/app - -RUN apk add --no-cache curl envsubst jq su-exec - -WORKDIR / -COPY apps/openchallenges/app/docker-entrypoint.sh . -COPY apps/openchallenges/app/docker-entrypoint.d /docker-entrypoint.d -RUN chmod +x docker-entrypoint.sh /docker-entrypoint.d/* - -WORKDIR ${APP_DIR} -COPY dist/apps/openchallenges/app/browser/server ${APP_DIR} -# The path of the destination folder must be the same as the path specified in server.ts. -COPY dist/apps/openchallenges/app/browser/browser ${APP_DIR}/dist/apps/openchallenges/app/browser/browser - -HEALTHCHECK --interval=2s --timeout=3s --retries=20 --start-period=5s \ - CMD curl --fail --silent "localhost:4200/health" | jq '.status' | grep UP || exit 1 - -EXPOSE 4200 - -ENTRYPOINT ["/docker-entrypoint.sh"] - -CMD ["node", "main.js"] diff --git a/apps/openchallenges/app-tailwind/docker-entrypoint.d/10-envsubst-on-app-config-template.sh b/apps/openchallenges/app-tailwind/docker-entrypoint.d/10-envsubst-on-app-config-template.sh deleted file mode 100644 index dfef93928a..0000000000 --- a/apps/openchallenges/app-tailwind/docker-entrypoint.d/10-envsubst-on-app-config-template.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh - -cd "${APP_DIR}/dist/apps/openchallenges/app/browser/browser/config" -envsubst < config.json.template > config.json diff --git a/apps/openchallenges/app-tailwind/docker-entrypoint.sh b/apps/openchallenges/app-tailwind/docker-entrypoint.sh deleted file mode 100644 index fc31ae5aa4..0000000000 --- a/apps/openchallenges/app-tailwind/docker-entrypoint.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env sh -set -e - -/docker-entrypoint.d/10-envsubst-on-app-config-template.sh - -if [ "$1" = 'node' ]; then - cd ${APP_DIR} - exec su-exec node "$@" -fi - -exec "$@" \ No newline at end of file diff --git a/apps/openchallenges/app-tailwind/e2e/challenge-search-paginator.spec.ts.off b/apps/openchallenges/app-tailwind/e2e/challenge-search-paginator.spec.ts.off deleted file mode 100644 index cee25bcecd..0000000000 --- a/apps/openchallenges/app-tailwind/e2e/challenge-search-paginator.spec.ts.off +++ /dev/null @@ -1,17 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('paginator reset to page 1 on filter change', async ({ page }) => { - // Go to the challenge search page - await page.goto('/challenge'); - // Go to the second page - await page.getByRole('button', { name: '2' }).click(); - // Make a change to the challenge query input by selecting 'active' status - await page - .locator('div') - .filter({ hasText: /^Active$/ }) - .locator('div') - .nth(2) - .click(); - // Assert that the paginator page number has been reset to 1 - await expect(page.getByRole('button', { name: '1' })).toBeVisible(); -}); diff --git a/apps/openchallenges/app-tailwind/e2e/home.spec.ts.off b/apps/openchallenges/app-tailwind/e2e/home.spec.ts.off deleted file mode 100644 index e21e7dbde9..0000000000 --- a/apps/openchallenges/app-tailwind/e2e/home.spec.ts.off +++ /dev/null @@ -1,8 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('has banner', async ({ page }) => { - await page.goto('/'); - - // Expect first h4 to contain a substring. - await expect(page.locator('h4').first()).toHaveText('Welcome to OpenChallenges!'); -}); diff --git a/apps/openchallenges/app-tailwind/playwright.config.ts b/apps/openchallenges/app-tailwind/playwright.config.ts deleted file mode 100644 index 04fbf127ca..0000000000 --- a/apps/openchallenges/app-tailwind/playwright.config.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { defineConfig, devices } from '@playwright/test'; -import { nxE2EPreset } from '@nx/playwright/preset'; -// eslint-disable-next-line @typescript-eslint/no-unused-vars -import { workspaceRoot } from '@nx/devkit'; - -// For CI, you may want to set BASE_URL to the deployed application. -const baseURL = process.env['BASE_URL'] || 'http://localhost:4200'; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - ...nxE2EPreset(__filename, { - testDir: './e2e', - // includeMobileBrowsers: true, // includes mobile Chrome and Safari - // includeBrandedBrowsers: true, // includes Google Chrome and Microsoft Edge - }), - projects: [ - /* Test against desktop browsers */ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - { - name: 'firefox', - use: { ...devices['Desktop Firefox'] }, - }, - { - name: 'webkit', - use: { ...devices['Desktop Safari'] }, - }, - /* Test against mobile viewports. */ - { - name: 'Mobile Chrome', - use: { ...devices['Pixel 5'] }, - }, - // { - // name: 'Mobile Safari', - // use: { ...devices['iPhone 12'] }, - // }, - /* Test against branded browsers. */ - // When Google Chrome and/or Microsoft Edge are installed in the dev container, Playwright will - // use one of them to open the HTML report. These browsers are slow to open and respond because - // they are emulated. It is recommended to now use them in combination with the HTML report. By - // default, when Chrome and Edge are not installed, the HTML report opens in the native browser - // of the developer, which is much faster. - // { - // name: 'Google Chrome', use: { ...devices['Desktop Chrome'], channel: 'chrome' }, // or - // 'chrome-beta' - // }, - // { - // name: 'Microsoft Edge', use: { ...devices['Desktop Edge'], channel: 'msedge' }, // or - // 'msedge-dev' - // }, - ], - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - baseURL, - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - /* Run your local dev server before starting the tests */ - webServer: { - command: 'nx serve openchallenges-app', - url: 'http://127.0.0.1:4200', - reuseExistingServer: !process.env.CI, - cwd: workspaceRoot, - }, - reporter: [['line'], ['html', { open: 'never' }]], - // reporter: process.env.CI ? 'html' : 'line', -}); diff --git a/apps/openchallenges/app-tailwind/project.json b/apps/openchallenges/app-tailwind/project.json index 4f47721cbf..ea1f4b8b63 100644 --- a/apps/openchallenges/app-tailwind/project.json +++ b/apps/openchallenges/app-tailwind/project.json @@ -2,8 +2,9 @@ "name": "openchallenges-app-tailwind", "$schema": "../../../node_modules/nx/schemas/project-schema.json", "projectType": "application", + "prefix": "app", "sourceRoot": "apps/openchallenges/app-tailwind/src", - "prefix": "openchallenges", + "tags": [], "targets": { "build": { "executor": "@nx/angular:application", @@ -54,7 +55,7 @@ "defaultConfiguration": "production" }, "serve": { - "executor": "@angular-devkit/build-angular:dev-server", + "executor": "@nx/angular:dev-server", "configurations": { "production": { "buildTarget": "openchallenges-app-tailwind:build:production" diff --git a/apps/openchallenges/app-tailwind/src/_app-theme.scss b/apps/openchallenges/app-tailwind/src/_app-theme.scss deleted file mode 100644 index 9b641f2bcf..0000000000 --- a/apps/openchallenges/app-tailwind/src/_app-theme.scss +++ /dev/null @@ -1,46 +0,0 @@ -@use 'sass:map'; -@use '@angular/material' as mat; -@use 'libs/openchallenges/themes/src/fonts' as fonts; -@use 'libs/openchallenges/themes/src/palettes' as palettes; -@use 'libs/openchallenges/themes/src/index' as openchallenges; -@include mat.typography-hierarchy(fonts.$lato); -@include mat.core; - -$primary: mat.m2-define-palette(palettes.$dark-blue-palette, 600); -$accent: mat.m2-define-palette(palettes.$accent-purple-palette, 400); -$theme: mat.m2-define-light-theme( - ( - color: ( - primary: $primary, - accent: $accent, - ), - typography: fonts.$lato, - density: 0, - is-dark: false, - ) -); - -// Add custom palettes used in figma to the theme -$theme: map.deep-merge( - $theme, - ( - color: ( - figma: palettes.$figma-collection, - ), - ) -); - -// Emit theme-dependent styles for common features used across multiple components. -@include mat.core-theme($theme); - -// Emit styles for MatButton based on `$theme`. -@include mat.button-theme($theme); - -// Include the theme mixins for other components you use here. -@include openchallenges.theme($theme); - -:root { - --color-btn-primary: #39bde7; - --color-btn-disabled: #ebebe4; - --color-btn-shadow: rgb(196 196 196 / 100%); -} diff --git a/apps/openchallenges/app-tailwind/src/app/app-sections.ts b/apps/openchallenges/app-tailwind/src/app/app-sections.ts deleted file mode 100644 index 7bd3a61f7e..0000000000 --- a/apps/openchallenges/app-tailwind/src/app/app-sections.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { NavbarSection } from '@sagebionetworks/openchallenges/ui'; - -export const APP_SECTIONS: { [key: string]: NavbarSection } = { - challenge: { - name: 'Challenges', - summary: 'Explore challenges', - }, - org: { - name: 'Organizations', - summary: 'Explore organizations', - }, -}; diff --git a/apps/openchallenges/app-tailwind/src/app/app.component.html b/apps/openchallenges/app-tailwind/src/app/app.component.html index 968b56dcd4..0f4018b6d7 100644 --- a/apps/openchallenges/app-tailwind/src/app/app.component.html +++ b/apps/openchallenges/app-tailwind/src/app/app.component.html @@ -1,15 +1 @@ - - - -
- -
+ diff --git a/apps/openchallenges/app-tailwind/src/app/app.component.spec.ts.off b/apps/openchallenges/app-tailwind/src/app/app.component.spec.ts similarity index 58% rename from apps/openchallenges/app-tailwind/src/app/app.component.spec.ts.off rename to apps/openchallenges/app-tailwind/src/app/app.component.spec.ts index fad2738a2e..f1584ffc3c 100644 --- a/apps/openchallenges/app-tailwind/src/app/app.component.spec.ts.off +++ b/apps/openchallenges/app-tailwind/src/app/app.component.spec.ts @@ -1,32 +1,27 @@ import { TestBed } from '@angular/core/testing'; import { AppComponent } from './app.component'; import { NxWelcomeComponent } from './nx-welcome.component'; -import { RouterTestingModule } from '@angular/router/testing'; +import { RouterModule } from '@angular/router'; describe('AppComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [RouterTestingModule], - declarations: [AppComponent, NxWelcomeComponent], + imports: [AppComponent, NxWelcomeComponent, RouterModule.forRoot([])], }).compileComponents(); }); - it('should create the app', () => { + it('should render title', () => { const fixture = TestBed.createComponent(AppComponent); - const app = fixture.componentInstance; - expect(app).toBeTruthy(); + fixture.detectChanges(); + const compiled = fixture.nativeElement as HTMLElement; + expect(compiled.querySelector('h1')?.textContent).toContain( + 'Welcome openchallenges-app-tailwind', + ); }); - it(`should have as title 'openchallenges'`, () => { + it(`should have as title 'openchallenges-app-tailwind'`, () => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.componentInstance; - expect(app.title).toEqual('openchallenges'); - }); - - it('should render title', () => { - const fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - const compiled = fixture.nativeElement as HTMLElement; - expect(compiled.querySelector('h1')?.textContent).toContain('Welcome openchallenges'); + expect(app.title).toEqual('openchallenges-app-tailwind'); }); }); diff --git a/apps/openchallenges/app-tailwind/src/app/app.component.ts b/apps/openchallenges/app-tailwind/src/app/app.component.ts index 15f50a8b5b..05974888b6 100644 --- a/apps/openchallenges/app-tailwind/src/app/app.component.ts +++ b/apps/openchallenges/app-tailwind/src/app/app.component.ts @@ -1,69 +1,14 @@ -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { Subscription } from 'rxjs'; -import { PageTitleService } from '@sagebionetworks/openchallenges/util'; -import { - Avatar, - MenuItem, - MOCK_AVATAR_32, - USER_MENU_ITEMS, - NavbarSection, - NavbarComponent, -} from '@sagebionetworks/openchallenges/ui'; -import { APP_SECTIONS } from './app-sections'; -import { RouterOutlet } from '@angular/router'; -import { HomeDataService } from '@sagebionetworks/openchallenges/home'; -import { GoogleTagManagerComponent } from './google-tag-manager/google-tag-manager.component'; -import { ConfigService } from '@sagebionetworks/openchallenges/config'; -import { NgIf } from '@angular/common'; +import { Component } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { NxWelcomeComponent } from './nx-welcome.component'; @Component({ - selector: 'openchallenges-root', - templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'], standalone: true, - imports: [NavbarComponent, RouterOutlet, NgIf, GoogleTagManagerComponent], + imports: [NxWelcomeComponent, RouterModule], + selector: 'app-root', + templateUrl: './app.component.html', + styleUrl: './app.component.scss', }) -export class AppComponent implements OnInit, OnDestroy { - title = 'OpenChallenges'; - sections: { [key: string]: NavbarSection } = APP_SECTIONS; - isLoggedIn = false; - userAvatar: Avatar = MOCK_AVATAR_32; - userMenuItems: MenuItem[] = USER_MENU_ITEMS; - readonly useGoogleTagManager: boolean; - - private subscriptions: Subscription[] = []; - - constructor( - private pageTitleService: PageTitleService, - private homeDataService: HomeDataService, - private configService: ConfigService, - ) { - this.useGoogleTagManager = this.configService.config.googleTagManagerId.length > 0; - } - - ngOnInit() { - // TODO Call getUserProfile() only if the user is logged in, other wise an error is generated - // when the page is rendered with SSR. - // https://github.com/Sage-Bionetworks/sage-monorepo/issues/880#issuecomment-1318955348 - // this.kauthService.getUserProfile().subscribe((userProfile) => { - // this.userAvatar.name = userProfile.username ? userProfile.username : ''; - // }); - this.userAvatar.name = 'blank'; - - this.pageTitleService.setTitle('OpenChallenges'); - - this.homeDataService.setChallengesPerYear(); - } - - ngOnDestroy(): void { - this.subscriptions.forEach((sub) => sub.unsubscribe()); - } - - selectUserMenuItem(menuItem: MenuItem): void { - console.log('Menu item selected', menuItem); - } - - login(): void { - console.log('Clicked on log In'); - } +export class AppComponent { + title = 'openchallenges-app-tailwind'; } diff --git a/apps/openchallenges/app-tailwind/src/app/app.config.server.ts b/apps/openchallenges/app-tailwind/src/app/app.config.server.ts index 33d83d276a..1980cfe118 100644 --- a/apps/openchallenges/app-tailwind/src/app/app.config.server.ts +++ b/apps/openchallenges/app-tailwind/src/app/app.config.server.ts @@ -1,17 +1,9 @@ import { mergeApplicationConfig, ApplicationConfig } from '@angular/core'; import { provideServerRendering } from '@angular/platform-server'; -import { appConfig, APP_BASE_URL_PROVIDER_INDEX } from './app.config'; -import { provideClientHydration } from '@angular/platform-browser'; +import { appConfig } from './app.config'; const serverConfig: ApplicationConfig = { - providers: [provideServerRendering(), provideClientHydration()], + providers: [provideServerRendering()], }; -// The file server.ts defines a provider that specifies 'APP_BASE_URL' based on the request protocol -// and host. If this provider could be defined in serverConfig above, there would be no need to -// manually remove the provider that specifies 'APP_BASE_URL' from appConfig used for client-side -// rendering. Also removing based on an index should be avoided: I would have preferred to remove it -// based on a property value but couldn't. -appConfig.providers.splice(APP_BASE_URL_PROVIDER_INDEX, 1); - export const config = mergeApplicationConfig(appConfig, serverConfig); diff --git a/apps/openchallenges/app-tailwind/src/app/app.config.ts b/apps/openchallenges/app-tailwind/src/app/app.config.ts index e5bcc558e7..8f91ae956c 100644 --- a/apps/openchallenges/app-tailwind/src/app/app.config.ts +++ b/apps/openchallenges/app-tailwind/src/app/app.config.ts @@ -1,50 +1,12 @@ -import { ApplicationConfig, APP_INITIALIZER, APP_ID } from '@angular/core'; -import { - provideRouter, - withEnabledBlockingInitialNavigation, - withInMemoryScrolling, -} from '@angular/router'; -import { withInterceptorsFromDi, provideHttpClient } from '@angular/common/http'; -import { provideAnimations } from '@angular/platform-browser/animations'; -import { BASE_PATH as API_CLIENT_BASE_PATH } from '@sagebionetworks/openchallenges/api-client-angular'; -import { configFactory, ConfigService } from '@sagebionetworks/openchallenges/config'; - -import { routes } from './app.routes'; - -// This index is used to remove the corresponding provider in app.config.server.ts. -export const APP_BASE_URL_PROVIDER_INDEX = 1; +import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'; +import { provideRouter } from '@angular/router'; +import { appRoutes } from './app.routes'; +import { provideClientHydration } from '@angular/platform-browser'; export const appConfig: ApplicationConfig = { providers: [ - { provide: APP_ID, useValue: 'openchallenges-app' }, - { - // This provider must be specified at the index defined by APP_BASE_URL_PROVIDER_INDEX. - provide: 'APP_BASE_URL', - useFactory: () => '.', - deps: [], - }, - { - provide: APP_INITIALIZER, - useFactory: configFactory, - deps: [ConfigService], - multi: true, - }, - { - provide: API_CLIENT_BASE_PATH, - useFactory: (configService: ConfigService) => - configService.config.isPlatformServer - ? configService.config.ssrApiUrl - : configService.config.csrApiUrl, - deps: [ConfigService], - }, - provideAnimations(), - provideHttpClient(withInterceptorsFromDi()), - provideRouter( - routes, - withEnabledBlockingInitialNavigation(), - withInMemoryScrolling({ - scrollPositionRestoration: 'enabled', - }), - ), + provideClientHydration(), + provideZoneChangeDetection({ eventCoalescing: true }), + provideRouter(appRoutes), ], }; diff --git a/apps/openchallenges/app-tailwind/src/app/app.routes.ts b/apps/openchallenges/app-tailwind/src/app/app.routes.ts index 973436a0a5..8762dfe2c6 100644 --- a/apps/openchallenges/app-tailwind/src/app/app.routes.ts +++ b/apps/openchallenges/app-tailwind/src/app/app.routes.ts @@ -1,54 +1,3 @@ -import { Routes } from '@angular/router'; +import { Route } from '@angular/router'; -export const routes: Routes = [ - { path: '', redirectTo: 'home', pathMatch: 'full' }, - { - path: 'home', - loadChildren: () => - import('@sagebionetworks/openchallenges/home').then((routes) => routes.routes), - }, - { - path: 'about', - loadChildren: () => - import('@sagebionetworks/openchallenges/about').then((routes) => routes.routes), - }, - { - path: 'challenge', - loadChildren: () => - import('@sagebionetworks/openchallenges/challenge-search').then((routes) => routes.routes), - }, - { - path: 'org', - loadChildren: () => - import('@sagebionetworks/openchallenges/org-search').then((routes) => routes.routes), - }, - { - path: 'signup', - loadChildren: () => - import('@sagebionetworks/openchallenges/signup').then((routes) => routes.routes), - }, - { - path: 'team', - loadChildren: () => - import('@sagebionetworks/openchallenges/team').then((routes) => routes.routes), - }, - { - path: 'not-found', - loadChildren: () => - import('@sagebionetworks/openchallenges/not-found').then((routes) => routes.routes), - }, - { - path: 'org/:orgLogin', - loadChildren: () => - import('@sagebionetworks/openchallenges/org-profile').then((routes) => routes.routes), - }, - { - path: 'challenge/:challengeId', - loadChildren: () => - import('@sagebionetworks/openchallenges/challenge').then((routes) => routes.routes), - }, - { - path: '**', - redirectTo: '/not-found', - }, -]; +export const appRoutes: Route[] = []; diff --git a/apps/openchallenges/app-tailwind/src/app/google-tag-manager/google-tag-manager-id.provider.ts b/apps/openchallenges/app-tailwind/src/app/google-tag-manager/google-tag-manager-id.provider.ts deleted file mode 100644 index edcb6abae8..0000000000 --- a/apps/openchallenges/app-tailwind/src/app/google-tag-manager/google-tag-manager-id.provider.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ConfigService } from '@sagebionetworks/openchallenges/config'; - -export const googleTagManagerIdProvider = { - provide: 'googleTagManagerId', - useFactory: (configService: ConfigService) => configService.config.googleTagManagerId, - deps: [ConfigService], -}; diff --git a/apps/openchallenges/app-tailwind/src/app/google-tag-manager/google-tag-manager.component.ts b/apps/openchallenges/app-tailwind/src/app/google-tag-manager/google-tag-manager.component.ts deleted file mode 100644 index 5dedf67c5e..0000000000 --- a/apps/openchallenges/app-tailwind/src/app/google-tag-manager/google-tag-manager.component.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { NavigationEnd, Router } from '@angular/router'; -import { GoogleTagManagerService } from 'angular-google-tag-manager'; -import { ConfigService } from '@sagebionetworks/openchallenges/config'; -import { googleTagManagerIdProvider } from './google-tag-manager-id.provider'; - -@Component({ - selector: 'openchallenges-google-tag-manager', - template: '', - standalone: true, - providers: [ - googleTagManagerIdProvider, - // GoogleTagManagerService has been evaluated before we defined the GTM ID. That is why we - // redefine it below so that its initialization get access to the GTM ID. - { - provide: GoogleTagManagerService, - useClass: GoogleTagManagerService, - }, - ], -}) -export class GoogleTagManagerComponent implements OnInit { - constructor( - private router: Router, - private gtmService: GoogleTagManagerService, - private configService: ConfigService, - ) {} - - ngOnInit(): void { - if (!this.configService.config.isPlatformServer) { - this.router.events.forEach((event) => { - if (event instanceof NavigationEnd) { - const gtmTag = { - event: 'page', - pageName: event.url, - }; - this.gtmService.pushTag(gtmTag); - } - }); - } - } -} diff --git a/apps/openchallenges/app-tailwind/src/app/google-tag-manager/index.ts b/apps/openchallenges/app-tailwind/src/app/google-tag-manager/index.ts deleted file mode 100644 index 2c6dc359fa..0000000000 --- a/apps/openchallenges/app-tailwind/src/app/google-tag-manager/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './google-tag-manager.component'; diff --git a/apps/openchallenges/app-tailwind/src/app/nx-welcome.component.ts b/apps/openchallenges/app-tailwind/src/app/nx-welcome.component.ts new file mode 100644 index 0000000000..1bd71a85b1 --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/app/nx-welcome.component.ts @@ -0,0 +1,935 @@ +import { Component, ViewEncapsulation } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +@Component({ + selector: 'app-nx-welcome', + standalone: true, + imports: [CommonModule], + template: ` + + +
+
+ +
+

+ Hello there, + Welcome openchallenges-app-tailwind 👋 +

+
+ +
+
+

+ + + + You're up and running +

+ What's next? +
+
+ + + +
+
+ + + +
+

Next steps

+

Here are some things you can do with Nx:

+
+ + + + + Build, test and lint your app + +
# Build
+nx build 
+# Test
+nx test 
+# Lint
+nx lint 
+# Run them together!
+nx run-many -t build test lint
+
+
+ + + + + View project details + +
nx show project openchallenges-app-tailwind
+
+ +
+ + + + + View interactive project graph + +
nx graph
+
+ +
+ + + + + Add UI library + +
# Generate UI lib
+nx g @nx/angular:lib ui
+# Add a component
+nx g @nx/angular:component ui/src/lib/button
+
+
+

+ Carefully crafted with + + + +

+
+
+ `, + styles: [], + encapsulation: ViewEncapsulation.None, +}) +export class NxWelcomeComponent {} diff --git a/apps/openchallenges/app-tailwind/src/assets/silent-check-sso.html b/apps/openchallenges/app-tailwind/src/assets/silent-check-sso.html deleted file mode 100644 index b3bd540ded..0000000000 --- a/apps/openchallenges/app-tailwind/src/assets/silent-check-sso.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/apps/openchallenges/app-tailwind/src/config/config.json b/apps/openchallenges/app-tailwind/src/config/config.json deleted file mode 100644 index 1855c41182..0000000000 --- a/apps/openchallenges/app-tailwind/src/config/config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "apiDocsUrl": "http://localhost:8000/api-docs", - "appVersion": "1.0.0-alpha", - "csrApiUrl": "http://localhost:8082/api/v1", - "dataUpdatedOn": "yyyy-mm-dd", - "environment": "development", - "googleTagManagerId": "", - "ssrApiUrl": "http://openchallenges-api-gateway:8082/api/v1", - "enableOperationFilter": false -} diff --git a/apps/openchallenges/app-tailwind/src/config/config.json.template b/apps/openchallenges/app-tailwind/src/config/config.json.template deleted file mode 100644 index 9c6e9c104f..0000000000 --- a/apps/openchallenges/app-tailwind/src/config/config.json.template +++ /dev/null @@ -1,10 +0,0 @@ -{ - "apiDocsUrl": "${API_DOCS_URL}", - "appVersion": "${APP_VERSION}", - "csrApiUrl": "${CSR_API_URL}", - "dataUpdatedOn": "${DATA_UPDATED_ON}", - "environment": "${ENVIRONMENT}", - "googleTagManagerId": "${GOOGLE_TAG_MANAGER_ID}", - "ssrApiUrl": "${SSR_API_URL}", - "enableOperationFilter": "${ENABLE_OPERATION_FILTER}" -} \ No newline at end of file diff --git a/apps/openchallenges/app-tailwind/src/environments/environment.prod.ts b/apps/openchallenges/app-tailwind/src/environments/environment.prod.ts deleted file mode 100644 index 81afb5af8b..0000000000 --- a/apps/openchallenges/app-tailwind/src/environments/environment.prod.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const environment = { - production: true, - apiUrl: 'http://localhost:4200/api', - appVersion: '0.0.1', -}; diff --git a/apps/openchallenges/app-tailwind/src/environments/environment.ts b/apps/openchallenges/app-tailwind/src/environments/environment.ts deleted file mode 100644 index 1bfbbf2d22..0000000000 --- a/apps/openchallenges/app-tailwind/src/environments/environment.ts +++ /dev/null @@ -1,18 +0,0 @@ -// This file can be replaced during build by using the `fileReplacements` array. -// `ng build` replaces `environment.ts` with `environment.prod.ts`. -// The list of file replacements can be found in `angular.json`. - -export const environment = { - production: false, - apiUrl: 'http://localhost:4200/api', - appVersion: '0.0.1', -}; - -/* - * For easier debugging in development mode, you can import the following file - * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. - * - * This import should be commented out in production mode because it will have a negative impact - * on performance if an error is thrown. - */ -// import 'zone.js/plugins/zone-error'; // Included with Angular CLI. diff --git a/apps/openchallenges/app-tailwind/src/humans.txt b/apps/openchallenges/app-tailwind/src/humans.txt deleted file mode 100644 index f2711c9979..0000000000 --- a/apps/openchallenges/app-tailwind/src/humans.txt +++ /dev/null @@ -1,22 +0,0 @@ -/* TEAM */ -Lead: Thomas Schaffter -Contact: https://github.com/tschaffter - -Developer: Verena Chung -Contact: https://github.com/vpchung - -Developer: Rong Chai -Contact: https://github.com/rrchai - -Developer: Maria Diaz -Contact: https://github.com/mdsage1 - -Director: Jake Albrecht -Contact: https://github.com/chepyle - -/* THANKS */ -Director: James Eddy -Contact: https://github.com/jaeddy - -/* SITE */ -Last update: 2023/05/26 diff --git a/apps/openchallenges/app-tailwind/src/index.html b/apps/openchallenges/app-tailwind/src/index.html index e132b0928b..a643a399cb 100644 --- a/apps/openchallenges/app-tailwind/src/index.html +++ b/apps/openchallenges/app-tailwind/src/index.html @@ -2,13 +2,12 @@ - OpenChallenges + openchallenges-app-tailwind - - + diff --git a/apps/openchallenges/app-tailwind/src/proxy.conf.json b/apps/openchallenges/app-tailwind/src/proxy.conf.json deleted file mode 100644 index 0967ef424b..0000000000 --- a/apps/openchallenges/app-tailwind/src/proxy.conf.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/apps/openchallenges/app-tailwind/src/robots.txt b/apps/openchallenges/app-tailwind/src/robots.txt deleted file mode 100644 index 4c73a82512..0000000000 --- a/apps/openchallenges/app-tailwind/src/robots.txt +++ /dev/null @@ -1,5 +0,0 @@ -User-agent: * -Disallow: /api/ -Disallow: /login/ - -Sitemap: http://www.openchallenges.org/sitemap.xml \ No newline at end of file diff --git a/apps/openchallenges/app-tailwind/src/styles.scss b/apps/openchallenges/app-tailwind/src/styles.scss index 2a2c0a6935..77e408aa8b 100644 --- a/apps/openchallenges/app-tailwind/src/styles.scss +++ b/apps/openchallenges/app-tailwind/src/styles.scss @@ -1,5 +1,3 @@ -@use 'libs/openchallenges/styles/src/index'; -@use 'app-theme'; @tailwind base; @tailwind components; @tailwind utilities; diff --git a/apps/openchallenges/app-tailwind/tsconfig.editor.json b/apps/openchallenges/app-tailwind/tsconfig.editor.json index f1cbdf153e..a8ac182c08 100644 --- a/apps/openchallenges/app-tailwind/tsconfig.editor.json +++ b/apps/openchallenges/app-tailwind/tsconfig.editor.json @@ -1,6 +1,6 @@ { "extends": "./tsconfig.json", - "include": ["src/**/*.ts", "src/app/app.component.spec.ts.off"], + "include": ["src/**/*.ts"], "compilerOptions": {}, "exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"] } diff --git a/apps/openchallenges/app-tailwind/tsconfig.spec.json b/apps/openchallenges/app-tailwind/tsconfig.spec.json index 773767299c..e637bf83b5 100644 --- a/apps/openchallenges/app-tailwind/tsconfig.spec.json +++ b/apps/openchallenges/app-tailwind/tsconfig.spec.json @@ -7,11 +7,5 @@ "types": ["jest", "node"] }, "files": ["src/test-setup.ts"], - "include": [ - "jest.config.ts", - "src/**/*.test.ts", - "src/**/*.spec.ts", - "src/**/*.d.ts", - "src/app/app.component.spec.ts.off" - ] + "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] } From d424b095046586bacce33e5a7c52752ec9597694 Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Thu, 7 Nov 2024 22:58:08 +0000 Subject: [PATCH 07/18] update tsconfig.base.json in alphabetical order --- tsconfig.base.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.base.json b/tsconfig.base.json index 1389cd2427..310604d765 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -38,7 +38,6 @@ "@sagebionetworks/model-ad/not-found": ["libs/model-ad/not-found/src/index.ts"], "@sagebionetworks/model-ad/ui": ["libs/model-ad/ui/src/index.ts"], "@sagebionetworks/model-ad/util": ["libs/model-ad/util/src/index.ts"], - "@sagebionetworks/sage-monorepo-nx-plugin": ["libs/sage-monorepo/nx-plugin/src/index.ts"], "@sagebionetworks/openchallenges/about": ["libs/openchallenges/about/src/index.ts"], "@sagebionetworks/openchallenges/api-client-angular": [ "libs/openchallenges/api-client-angular/src/index.ts" @@ -67,6 +66,7 @@ "@sagebionetworks/results-visualization-framework/ui": [ "libs/results-visualization-framework/ui/src/index.ts" ], + "@sagebionetworks/sage-monorepo-nx-plugin": ["libs/sage-monorepo/nx-plugin/src/index.ts"], "@sagebionetworks/sandbox-angular-lib": ["libs/sandbox/angular-lib/src/index.ts"], "@sagebionetworks/shared/charts": ["libs/shared/typescript/charts/src/index.ts"], "@sagebionetworks/shared/charts-angular": [ From f2b7990f4e0b1a1723a7515d52be07f832707da7 Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Fri, 8 Nov 2024 00:12:28 +0000 Subject: [PATCH 08/18] add initial changed files --- apps/openchallenges/app-tailwind/project.json | 15 ++++++++++ .../app-tailwind/src/app/app.routes.ts | 15 ++++++++-- .../src/lib/not-found.component.html | 4 +-- .../src/lib/not-found.component.scss | 7 +++-- .../not-found/src/lib/not-found.component.ts | 29 +++++++++---------- 5 files changed, 49 insertions(+), 21 deletions(-) diff --git a/apps/openchallenges/app-tailwind/project.json b/apps/openchallenges/app-tailwind/project.json index ea1f4b8b63..181725dc6a 100644 --- a/apps/openchallenges/app-tailwind/project.json +++ b/apps/openchallenges/app-tailwind/project.json @@ -17,6 +17,21 @@ "tsConfig": "apps/openchallenges/app-tailwind/tsconfig.app.json", "inlineStyleLanguage": "scss", "assets": [ + { + "input": "libs/shared/typescript/assets/src/assets", + "glob": "**/*", + "output": "assets" + }, + { + "input": "libs/openchallenges/assets/src/assets", + "glob": "**/*", + "output": "openchallenges-assets" + }, + { + "input": "libs/openchallenges/assets/src", + "glob": "favicon.ico", + "output": "" + }, { "glob": "**/*", "input": "apps/openchallenges/app-tailwind/public" diff --git a/apps/openchallenges/app-tailwind/src/app/app.routes.ts b/apps/openchallenges/app-tailwind/src/app/app.routes.ts index 8762dfe2c6..43a97f1d4b 100644 --- a/apps/openchallenges/app-tailwind/src/app/app.routes.ts +++ b/apps/openchallenges/app-tailwind/src/app/app.routes.ts @@ -1,3 +1,14 @@ -import { Route } from '@angular/router'; +import { Routes } from '@angular/router'; -export const appRoutes: Route[] = []; +export const appRoutes: Routes = [ + { path: '', redirectTo: 'not-found', pathMatch: 'full' }, + { + path: 'not-found', + loadChildren: () => + import('@sagebionetworks/openchallenges/not-found').then((routes) => routes.routes), + }, + { + path: '**', + redirectTo: '/not-found', + }, +]; diff --git a/libs/openchallenges/not-found/src/lib/not-found.component.html b/libs/openchallenges/not-found/src/lib/not-found.component.html index aa54a6e1df..93933d26df 100644 --- a/libs/openchallenges/not-found/src/lib/not-found.component.html +++ b/libs/openchallenges/not-found/src/lib/not-found.component.html @@ -15,10 +15,10 @@

Page Not Found

- +/> --> diff --git a/libs/openchallenges/not-found/src/lib/not-found.component.scss b/libs/openchallenges/not-found/src/lib/not-found.component.scss index d7741c58bf..af02e8bee5 100644 --- a/libs/openchallenges/not-found/src/lib/not-found.component.scss +++ b/libs/openchallenges/not-found/src/lib/not-found.component.scss @@ -1,4 +1,4 @@ -@use 'libs/openchallenges/styles/src/lib/constants'; +// @use 'libs/openchallenges/styles/src/lib/constants'; #error { background: url('/openchallenges-assets/images/banner-sm.svg'); @@ -8,11 +8,14 @@ flex-direction: column; justify-content: center; align-items: center; - min-height: calc(100vh - constants.$navbar-height); + + // min-height: calc(100vh - constants.$navbar-height); } + .err-message { padding-top: 100px; } + .btn-group { margin-top: 48px; diff --git a/libs/openchallenges/not-found/src/lib/not-found.component.ts b/libs/openchallenges/not-found/src/lib/not-found.component.ts index 1712f0725d..63679cad83 100644 --- a/libs/openchallenges/not-found/src/lib/not-found.component.ts +++ b/libs/openchallenges/not-found/src/lib/not-found.component.ts @@ -4,27 +4,26 @@ import { MatButtonModule } from '@angular/material/button'; import { RouterModule } from '@angular/router'; import { MatCardModule } from '@angular/material/card'; import { ConfigService } from '@sagebionetworks/openchallenges/config'; -import { FooterComponent } from '@sagebionetworks/openchallenges/ui'; +// import { FooterComponent } from '@sagebionetworks/openchallenges/ui'; @Component({ selector: 'openchallenges-not-found', standalone: true, - imports: [CommonModule, RouterModule, MatCardModule, MatButtonModule, FooterComponent], + imports: [CommonModule, RouterModule, MatCardModule, MatButtonModule], templateUrl: './not-found.component.html', styleUrls: ['./not-found.component.scss'], }) export class NotFoundComponent { - public appVersion: string; - public dataUpdatedOn: string; - public privacyPolicyUrl: string; - public termsOfUseUrl: string; - public apiDocsUrl: string; - - constructor(private readonly configService: ConfigService) { - this.appVersion = this.configService.config.appVersion; - this.dataUpdatedOn = this.configService.config.dataUpdatedOn; - this.privacyPolicyUrl = this.configService.config.privacyPolicyUrl; - this.termsOfUseUrl = this.configService.config.termsOfUseUrl; - this.apiDocsUrl = this.configService.config.apiDocsUrl; - } + // public appVersion: string; + // public dataUpdatedOn: string; + // public privacyPolicyUrl: string; + // public termsOfUseUrl: string; + // public apiDocsUrl: string; + // constructor(private readonly configService: ConfigService) { + // this.appVersion = this.configService.config.appVersion; + // this.dataUpdatedOn = this.configService.config.dataUpdatedOn; + // this.privacyPolicyUrl = this.configService.config.privacyPolicyUrl; + // this.termsOfUseUrl = this.configService.config.termsOfUseUrl; + // this.apiDocsUrl = this.configService.config.apiDocsUrl; + // } } From c2c417c9717be4b01a56233043945e02bdee498e Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Fri, 8 Nov 2024 18:23:30 +0000 Subject: [PATCH 09/18] add a new lib for not-found --- libs/openchallengs-tailwind/.eslintrc.json | 33 +++++++++++++++++++ libs/openchallengs-tailwind/README.md | 7 ++++ libs/openchallengs-tailwind/jest.config.ts | 21 ++++++++++++ libs/openchallengs-tailwind/project.json | 20 +++++++++++ libs/openchallengs-tailwind/src/index.ts | 1 + .../src/lib/not-found/not-found.component.css | 0 .../lib/not-found/not-found.component.html | 1 + .../lib/not-found/not-found.component.spec.ts | 21 ++++++++++++ .../src/lib/not-found/not-found.component.ts | 11 +++++++ libs/openchallengs-tailwind/src/test-setup.ts | 8 +++++ libs/openchallengs-tailwind/tsconfig.json | 28 ++++++++++++++++ libs/openchallengs-tailwind/tsconfig.lib.json | 12 +++++++ .../openchallengs-tailwind/tsconfig.spec.json | 11 +++++++ tsconfig.base.json | 3 ++ 14 files changed, 177 insertions(+) create mode 100644 libs/openchallengs-tailwind/.eslintrc.json create mode 100644 libs/openchallengs-tailwind/README.md create mode 100644 libs/openchallengs-tailwind/jest.config.ts create mode 100644 libs/openchallengs-tailwind/project.json create mode 100644 libs/openchallengs-tailwind/src/index.ts create mode 100644 libs/openchallengs-tailwind/src/lib/not-found/not-found.component.css create mode 100644 libs/openchallengs-tailwind/src/lib/not-found/not-found.component.html create mode 100644 libs/openchallengs-tailwind/src/lib/not-found/not-found.component.spec.ts create mode 100644 libs/openchallengs-tailwind/src/lib/not-found/not-found.component.ts create mode 100644 libs/openchallengs-tailwind/src/test-setup.ts create mode 100644 libs/openchallengs-tailwind/tsconfig.json create mode 100644 libs/openchallengs-tailwind/tsconfig.lib.json create mode 100644 libs/openchallengs-tailwind/tsconfig.spec.json diff --git a/libs/openchallengs-tailwind/.eslintrc.json b/libs/openchallengs-tailwind/.eslintrc.json new file mode 100644 index 0000000000..b953e5d37d --- /dev/null +++ b/libs/openchallengs-tailwind/.eslintrc.json @@ -0,0 +1,33 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts"], + "extends": ["plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates"], + "rules": { + "@angular-eslint/directive-selector": [ + "error", + { + "type": "attribute", + "prefix": "lib", + "style": "camelCase" + } + ], + "@angular-eslint/component-selector": [ + "error", + { + "type": "element", + "prefix": "lib", + "style": "kebab-case" + } + ] + } + }, + { + "files": ["*.html"], + "extends": ["plugin:@nx/angular-template"], + "rules": {} + } + ] +} diff --git a/libs/openchallengs-tailwind/README.md b/libs/openchallengs-tailwind/README.md new file mode 100644 index 0000000000..c47ef4b76d --- /dev/null +++ b/libs/openchallengs-tailwind/README.md @@ -0,0 +1,7 @@ +# not-found + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test not-found` to execute the unit tests. diff --git a/libs/openchallengs-tailwind/jest.config.ts b/libs/openchallengs-tailwind/jest.config.ts new file mode 100644 index 0000000000..b31e03cb2a --- /dev/null +++ b/libs/openchallengs-tailwind/jest.config.ts @@ -0,0 +1,21 @@ +export default { + displayName: 'not-found', + preset: '../../jest.preset.js', + setupFilesAfterEnv: ['/src/test-setup.ts'], + coverageDirectory: '../../coverage/libs/openchallengs-tailwind', + transform: { + '^.+\\.(ts|mjs|js|html)$': [ + 'jest-preset-angular', + { + tsconfig: '/tsconfig.spec.json', + stringifyContentPathRegex: '\\.(html|svg)$', + }, + ], + }, + transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], + snapshotSerializers: [ + 'jest-preset-angular/build/serializers/no-ng-attributes', + 'jest-preset-angular/build/serializers/ng-snapshot', + 'jest-preset-angular/build/serializers/html-comment', + ], +}; diff --git a/libs/openchallengs-tailwind/project.json b/libs/openchallengs-tailwind/project.json new file mode 100644 index 0000000000..93f48d109a --- /dev/null +++ b/libs/openchallengs-tailwind/project.json @@ -0,0 +1,20 @@ +{ + "name": "not-found", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/openchallengs-tailwind/src", + "prefix": "lib", + "projectType": "library", + "tags": [], + "targets": { + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "libs/openchallengs-tailwind/jest.config.ts" + } + }, + "lint": { + "executor": "@nx/eslint:lint" + } + } +} diff --git a/libs/openchallengs-tailwind/src/index.ts b/libs/openchallengs-tailwind/src/index.ts new file mode 100644 index 0000000000..abf95dfbee --- /dev/null +++ b/libs/openchallengs-tailwind/src/index.ts @@ -0,0 +1 @@ +export * from './lib/not-found/not-found.component'; diff --git a/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.css b/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.html b/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.html new file mode 100644 index 0000000000..80710204f0 --- /dev/null +++ b/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.html @@ -0,0 +1 @@ +

not-found works!

diff --git a/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.spec.ts b/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.spec.ts new file mode 100644 index 0000000000..747861135b --- /dev/null +++ b/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.spec.ts @@ -0,0 +1,21 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { NotFoundComponent } from './not-found.component'; + +describe('NotFoundComponent', () => { + let component: NotFoundComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [NotFoundComponent], + }).compileComponents(); + + fixture = TestBed.createComponent(NotFoundComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.ts b/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.ts new file mode 100644 index 0000000000..f06467186d --- /dev/null +++ b/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.ts @@ -0,0 +1,11 @@ +import { Component } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +@Component({ + selector: 'lib-not-found', + standalone: true, + imports: [CommonModule], + templateUrl: './not-found.component.html', + styleUrl: './not-found.component.css', +}) +export class NotFoundComponent {} diff --git a/libs/openchallengs-tailwind/src/test-setup.ts b/libs/openchallengs-tailwind/src/test-setup.ts new file mode 100644 index 0000000000..ab1eeeb335 --- /dev/null +++ b/libs/openchallengs-tailwind/src/test-setup.ts @@ -0,0 +1,8 @@ +// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment +globalThis.ngJest = { + testEnvironmentOptions: { + errorOnUnknownElements: true, + errorOnUnknownProperties: true, + }, +}; +import 'jest-preset-angular/setup-jest'; diff --git a/libs/openchallengs-tailwind/tsconfig.json b/libs/openchallengs-tailwind/tsconfig.json new file mode 100644 index 0000000000..56deb89f6a --- /dev/null +++ b/libs/openchallengs-tailwind/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "target": "es2022", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ], + "extends": "../../tsconfig.base.json", + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + } +} diff --git a/libs/openchallengs-tailwind/tsconfig.lib.json b/libs/openchallengs-tailwind/tsconfig.lib.json new file mode 100644 index 0000000000..4cab05d463 --- /dev/null +++ b/libs/openchallengs-tailwind/tsconfig.lib.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "declarationMap": true, + "inlineSources": true, + "types": [] + }, + "exclude": ["src/**/*.spec.ts", "src/test-setup.ts", "jest.config.ts", "src/**/*.test.ts"], + "include": ["src/**/*.ts"] +} diff --git a/libs/openchallengs-tailwind/tsconfig.spec.json b/libs/openchallengs-tailwind/tsconfig.spec.json new file mode 100644 index 0000000000..7870b7c011 --- /dev/null +++ b/libs/openchallengs-tailwind/tsconfig.spec.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "target": "es2016", + "types": ["jest", "node"] + }, + "files": ["src/test-setup.ts"], + "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index 310604d765..21281bad3a 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -78,6 +78,9 @@ ], "@sagebionetworks/synapse/api-client-angular": [ "libs/synapse/api-client-angular/src/index.ts" + ], + "@sagebionetworks/openchallenges-tailwind/not-found": [ + "libs/openchallengs-tailwind/src/index.ts" ] } }, From b5bd79075a19ec8b712d0d3b7cbea476d57b5cb3 Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Fri, 8 Nov 2024 21:21:38 +0000 Subject: [PATCH 10/18] add new library for not-found page --- .../app-tailwind/src/app/app.component.html | 2 +- ...nent.spec.ts => app.component.spec.ts.off} | 0 .../app-tailwind/src/app/app.routes.ts | 2 +- .../app-tailwind/tailwind.config.js | 20 ++++++++++++++++ .../not-found-tailwind}/.eslintrc.json | 6 ++--- .../not-found-tailwind/README.md | 7 ++++++ .../not-found-tailwind}/jest.config.ts | 6 ++--- .../not-found-tailwind/project.json | 20 ++++++++++++++++ .../not-found-tailwind/src/index.ts | 1 + .../not-found-tailwind.component.css} | 0 .../not-found-tailwind.component.html | 24 +++++++++++++++++++ .../not-found-tailwind.component.spec.ts.off | 21 ++++++++++++++++ .../not-found-tailwind.component.ts | 11 +++++++++ .../not-found-tailwind.routes.ts | 4 ++++ .../not-found-tailwind}/src/test-setup.ts | 0 .../not-found-tailwind}/tsconfig.json | 2 +- .../not-found-tailwind}/tsconfig.lib.json | 4 ++-- .../not-found-tailwind/tsconfig.spec.json | 17 +++++++++++++ libs/openchallengs-tailwind/README.md | 7 ------ libs/openchallengs-tailwind/project.json | 20 ---------------- libs/openchallengs-tailwind/src/index.ts | 1 - .../lib/not-found/not-found.component.html | 1 - .../lib/not-found/not-found.component.spec.ts | 21 ---------------- .../src/lib/not-found/not-found.component.ts | 11 --------- .../openchallengs-tailwind/tsconfig.spec.json | 11 --------- tsconfig.base.json | 4 ++-- 26 files changed, 138 insertions(+), 85 deletions(-) rename apps/openchallenges/app-tailwind/src/app/{app.component.spec.ts => app.component.spec.ts.off} (100%) rename libs/{openchallengs-tailwind => openchallenges/not-found-tailwind}/.eslintrc.json (84%) create mode 100644 libs/openchallenges/not-found-tailwind/README.md rename libs/{openchallengs-tailwind => openchallenges/not-found-tailwind}/jest.config.ts (78%) create mode 100644 libs/openchallenges/not-found-tailwind/project.json create mode 100644 libs/openchallenges/not-found-tailwind/src/index.ts rename libs/{openchallengs-tailwind/src/lib/not-found/not-found.component.css => openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.css} (100%) create mode 100644 libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.html create mode 100644 libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.spec.ts.off create mode 100644 libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.ts create mode 100644 libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.routes.ts rename libs/{openchallengs-tailwind => openchallenges/not-found-tailwind}/src/test-setup.ts (100%) rename libs/{openchallengs-tailwind => openchallenges/not-found-tailwind}/tsconfig.json (93%) rename libs/{openchallengs-tailwind => openchallenges/not-found-tailwind}/tsconfig.lib.json (64%) create mode 100644 libs/openchallenges/not-found-tailwind/tsconfig.spec.json delete mode 100644 libs/openchallengs-tailwind/README.md delete mode 100644 libs/openchallengs-tailwind/project.json delete mode 100644 libs/openchallengs-tailwind/src/index.ts delete mode 100644 libs/openchallengs-tailwind/src/lib/not-found/not-found.component.html delete mode 100644 libs/openchallengs-tailwind/src/lib/not-found/not-found.component.spec.ts delete mode 100644 libs/openchallengs-tailwind/src/lib/not-found/not-found.component.ts delete mode 100644 libs/openchallengs-tailwind/tsconfig.spec.json diff --git a/apps/openchallenges/app-tailwind/src/app/app.component.html b/apps/openchallenges/app-tailwind/src/app/app.component.html index 0f4018b6d7..0680b43f9c 100644 --- a/apps/openchallenges/app-tailwind/src/app/app.component.html +++ b/apps/openchallenges/app-tailwind/src/app/app.component.html @@ -1 +1 @@ - + diff --git a/apps/openchallenges/app-tailwind/src/app/app.component.spec.ts b/apps/openchallenges/app-tailwind/src/app/app.component.spec.ts.off similarity index 100% rename from apps/openchallenges/app-tailwind/src/app/app.component.spec.ts rename to apps/openchallenges/app-tailwind/src/app/app.component.spec.ts.off diff --git a/apps/openchallenges/app-tailwind/src/app/app.routes.ts b/apps/openchallenges/app-tailwind/src/app/app.routes.ts index 43a97f1d4b..0dca10cccb 100644 --- a/apps/openchallenges/app-tailwind/src/app/app.routes.ts +++ b/apps/openchallenges/app-tailwind/src/app/app.routes.ts @@ -5,7 +5,7 @@ export const appRoutes: Routes = [ { path: 'not-found', loadChildren: () => - import('@sagebionetworks/openchallenges/not-found').then((routes) => routes.routes), + import('@sagebionetworks/openchallenges/not-found-tailwind').then((routes) => routes.routes), }, { path: '**', diff --git a/apps/openchallenges/app-tailwind/tailwind.config.js b/apps/openchallenges/app-tailwind/tailwind.config.js index 38183db2c8..22857fc8e0 100644 --- a/apps/openchallenges/app-tailwind/tailwind.config.js +++ b/apps/openchallenges/app-tailwind/tailwind.config.js @@ -9,6 +9,26 @@ module.exports = { ], theme: { extend: {}, + colors: { + primary: { + light: 'green', + DEFAULT: 'red', + dark: 'blue', + }, + secondary: { + light: '#e9d5ff', + DEFAULT: '#a855f7', + dark: '#7e22ce', + }, + white: '#ffffff', + black: '#000000', + }, + spacing: { + sm: '1rem', + md: '1.5rem', + lg: '2rem', + xl: '3rem', + }, }, plugins: [], }; diff --git a/libs/openchallengs-tailwind/.eslintrc.json b/libs/openchallenges/not-found-tailwind/.eslintrc.json similarity index 84% rename from libs/openchallengs-tailwind/.eslintrc.json rename to libs/openchallenges/not-found-tailwind/.eslintrc.json index b953e5d37d..f02b39e763 100644 --- a/libs/openchallengs-tailwind/.eslintrc.json +++ b/libs/openchallenges/not-found-tailwind/.eslintrc.json @@ -1,5 +1,5 @@ { - "extends": ["../../.eslintrc.json"], + "extends": ["../../../.eslintrc.json"], "ignorePatterns": ["!**/*"], "overrides": [ { @@ -10,7 +10,7 @@ "error", { "type": "attribute", - "prefix": "lib", + "prefix": "openchallenges", "style": "camelCase" } ], @@ -18,7 +18,7 @@ "error", { "type": "element", - "prefix": "lib", + "prefix": "openchallenges", "style": "kebab-case" } ] diff --git a/libs/openchallenges/not-found-tailwind/README.md b/libs/openchallenges/not-found-tailwind/README.md new file mode 100644 index 0000000000..8f80b46d25 --- /dev/null +++ b/libs/openchallenges/not-found-tailwind/README.md @@ -0,0 +1,7 @@ +# not-found-tailwind + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test not-found-tailwind` to execute the unit tests. diff --git a/libs/openchallengs-tailwind/jest.config.ts b/libs/openchallenges/not-found-tailwind/jest.config.ts similarity index 78% rename from libs/openchallengs-tailwind/jest.config.ts rename to libs/openchallenges/not-found-tailwind/jest.config.ts index b31e03cb2a..5a47347fe0 100644 --- a/libs/openchallengs-tailwind/jest.config.ts +++ b/libs/openchallenges/not-found-tailwind/jest.config.ts @@ -1,8 +1,8 @@ export default { - displayName: 'not-found', - preset: '../../jest.preset.js', + displayName: 'not-found-tailwind', + preset: '../../../jest.preset.js', setupFilesAfterEnv: ['/src/test-setup.ts'], - coverageDirectory: '../../coverage/libs/openchallengs-tailwind', + coverageDirectory: '../../../coverage/libs/openchallenges/not-found-tailwind', transform: { '^.+\\.(ts|mjs|js|html)$': [ 'jest-preset-angular', diff --git a/libs/openchallenges/not-found-tailwind/project.json b/libs/openchallenges/not-found-tailwind/project.json new file mode 100644 index 0000000000..2ac5ff298f --- /dev/null +++ b/libs/openchallenges/not-found-tailwind/project.json @@ -0,0 +1,20 @@ +{ + "name": "not-found-tailwind", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/openchallenges/not-found-tailwind/src", + "prefix": "openchallenges", + "projectType": "library", + "tags": [], + "targets": { + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "libs/openchallenges/not-found-tailwind/jest.config.ts" + } + }, + "lint": { + "executor": "@nx/eslint:lint" + } + } +} diff --git a/libs/openchallenges/not-found-tailwind/src/index.ts b/libs/openchallenges/not-found-tailwind/src/index.ts new file mode 100644 index 0000000000..77612fd406 --- /dev/null +++ b/libs/openchallenges/not-found-tailwind/src/index.ts @@ -0,0 +1 @@ +export * from './lib/not-found-tailwind/not-found-tailwind.routes'; diff --git a/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.css b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.css similarity index 100% rename from libs/openchallengs-tailwind/src/lib/not-found/not-found.component.css rename to libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.css diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.html b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.html new file mode 100644 index 0000000000..7a16699fa9 --- /dev/null +++ b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.html @@ -0,0 +1,24 @@ +
+
+ 404 +

Page Not Found

+

Oops! The page you are looking for does not exist. It might have been moved or deleted.

+
+ +
+ + diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.spec.ts.off b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.spec.ts.off new file mode 100644 index 0000000000..70fad17a28 --- /dev/null +++ b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.spec.ts.off @@ -0,0 +1,21 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { NotFoundTailwindComponent } from './not-found-tailwind.component'; + +describe('NotFoundTailwindComponent', () => { + let component: NotFoundTailwindComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [NotFoundTailwindComponent], + }).compileComponents(); + + fixture = TestBed.createComponent(NotFoundTailwindComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.ts b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.ts new file mode 100644 index 0000000000..1cbbd7d2b5 --- /dev/null +++ b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.ts @@ -0,0 +1,11 @@ +import { Component } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +@Component({ + selector: 'openchallenges-not-found-tailwind', + standalone: true, + imports: [CommonModule], + templateUrl: './not-found-tailwind.component.html', + styleUrl: './not-found-tailwind.component.css', +}) +export class NotFoundTailwindComponent {} diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.routes.ts b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.routes.ts new file mode 100644 index 0000000000..53a9a7cf7f --- /dev/null +++ b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.routes.ts @@ -0,0 +1,4 @@ +import { Routes } from '@angular/router'; +import { NotFoundTailwindComponent } from './not-found-tailwind.component'; + +export const routes: Routes = [{ path: '', component: NotFoundTailwindComponent }]; diff --git a/libs/openchallengs-tailwind/src/test-setup.ts b/libs/openchallenges/not-found-tailwind/src/test-setup.ts similarity index 100% rename from libs/openchallengs-tailwind/src/test-setup.ts rename to libs/openchallenges/not-found-tailwind/src/test-setup.ts diff --git a/libs/openchallengs-tailwind/tsconfig.json b/libs/openchallenges/not-found-tailwind/tsconfig.json similarity index 93% rename from libs/openchallengs-tailwind/tsconfig.json rename to libs/openchallenges/not-found-tailwind/tsconfig.json index 56deb89f6a..fde35eab04 100644 --- a/libs/openchallengs-tailwind/tsconfig.json +++ b/libs/openchallenges/not-found-tailwind/tsconfig.json @@ -18,7 +18,7 @@ "path": "./tsconfig.spec.json" } ], - "extends": "../../tsconfig.base.json", + "extends": "../../../tsconfig.base.json", "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false, "strictInjectionParameters": true, diff --git a/libs/openchallengs-tailwind/tsconfig.lib.json b/libs/openchallenges/not-found-tailwind/tsconfig.lib.json similarity index 64% rename from libs/openchallengs-tailwind/tsconfig.lib.json rename to libs/openchallenges/not-found-tailwind/tsconfig.lib.json index 4cab05d463..872bc4599b 100644 --- a/libs/openchallengs-tailwind/tsconfig.lib.json +++ b/libs/openchallenges/not-found-tailwind/tsconfig.lib.json @@ -1,12 +1,12 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "../../../dist/out-tsc", "declaration": true, "declarationMap": true, "inlineSources": true, "types": [] }, "exclude": ["src/**/*.spec.ts", "src/test-setup.ts", "jest.config.ts", "src/**/*.test.ts"], - "include": ["src/**/*.ts"] + "include": ["src/**/*.ts", "src/lib/not-found-tailwind/not-found-tailwind.component.spec.ts.off"] } diff --git a/libs/openchallenges/not-found-tailwind/tsconfig.spec.json b/libs/openchallenges/not-found-tailwind/tsconfig.spec.json new file mode 100644 index 0000000000..04ad319f56 --- /dev/null +++ b/libs/openchallenges/not-found-tailwind/tsconfig.spec.json @@ -0,0 +1,17 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "module": "commonjs", + "target": "es2016", + "types": ["jest", "node"] + }, + "files": ["src/test-setup.ts"], + "include": [ + "jest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.d.ts", + "src/lib/not-found-tailwind/not-found-tailwind.component.spec.ts.off" + ] +} diff --git a/libs/openchallengs-tailwind/README.md b/libs/openchallengs-tailwind/README.md deleted file mode 100644 index c47ef4b76d..0000000000 --- a/libs/openchallengs-tailwind/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# not-found - -This library was generated with [Nx](https://nx.dev). - -## Running unit tests - -Run `nx test not-found` to execute the unit tests. diff --git a/libs/openchallengs-tailwind/project.json b/libs/openchallengs-tailwind/project.json deleted file mode 100644 index 93f48d109a..0000000000 --- a/libs/openchallengs-tailwind/project.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "not-found", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "libs/openchallengs-tailwind/src", - "prefix": "lib", - "projectType": "library", - "tags": [], - "targets": { - "test": { - "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], - "options": { - "jestConfig": "libs/openchallengs-tailwind/jest.config.ts" - } - }, - "lint": { - "executor": "@nx/eslint:lint" - } - } -} diff --git a/libs/openchallengs-tailwind/src/index.ts b/libs/openchallengs-tailwind/src/index.ts deleted file mode 100644 index abf95dfbee..0000000000 --- a/libs/openchallengs-tailwind/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './lib/not-found/not-found.component'; diff --git a/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.html b/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.html deleted file mode 100644 index 80710204f0..0000000000 --- a/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.html +++ /dev/null @@ -1 +0,0 @@ -

not-found works!

diff --git a/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.spec.ts b/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.spec.ts deleted file mode 100644 index 747861135b..0000000000 --- a/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.spec.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { NotFoundComponent } from './not-found.component'; - -describe('NotFoundComponent', () => { - let component: NotFoundComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [NotFoundComponent], - }).compileComponents(); - - fixture = TestBed.createComponent(NotFoundComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.ts b/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.ts deleted file mode 100644 index f06467186d..0000000000 --- a/libs/openchallengs-tailwind/src/lib/not-found/not-found.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Component } from '@angular/core'; -import { CommonModule } from '@angular/common'; - -@Component({ - selector: 'lib-not-found', - standalone: true, - imports: [CommonModule], - templateUrl: './not-found.component.html', - styleUrl: './not-found.component.css', -}) -export class NotFoundComponent {} diff --git a/libs/openchallengs-tailwind/tsconfig.spec.json b/libs/openchallengs-tailwind/tsconfig.spec.json deleted file mode 100644 index 7870b7c011..0000000000 --- a/libs/openchallengs-tailwind/tsconfig.spec.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", - "target": "es2016", - "types": ["jest", "node"] - }, - "files": ["src/test-setup.ts"], - "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] -} diff --git a/tsconfig.base.json b/tsconfig.base.json index 21281bad3a..abbb708afa 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -79,8 +79,8 @@ "@sagebionetworks/synapse/api-client-angular": [ "libs/synapse/api-client-angular/src/index.ts" ], - "@sagebionetworks/openchallenges-tailwind/not-found": [ - "libs/openchallengs-tailwind/src/index.ts" + "@sagebionetworks/openchallenges/not-found-tailwind": [ + "libs/openchallenges/not-found-tailwind/src/index.ts" ] } }, From 41534c45306a8b8478dfc76059950ffc47f7c32a Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Fri, 8 Nov 2024 21:41:50 +0000 Subject: [PATCH 11/18] add prefix --- libs/openchallenges/not-found-tailwind/project.json | 2 +- .../lib/not-found-tailwind/not-found-tailwind.component.css | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/openchallenges/not-found-tailwind/project.json b/libs/openchallenges/not-found-tailwind/project.json index 2ac5ff298f..4fa291bc22 100644 --- a/libs/openchallenges/not-found-tailwind/project.json +++ b/libs/openchallenges/not-found-tailwind/project.json @@ -1,5 +1,5 @@ { - "name": "not-found-tailwind", + "name": "openchallenges-not-found-tailwind", "$schema": "../../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "libs/openchallenges/not-found-tailwind/src", "prefix": "openchallenges", diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.css b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.css index e69de29bb2..5f25e208ae 100644 --- a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.css +++ b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.css @@ -0,0 +1,3 @@ +.test { + background-color: theme(colors.primary); +} From fd4da836314787144a2e6fe7818eb026af319a33 Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Fri, 8 Nov 2024 21:46:05 +0000 Subject: [PATCH 12/18] change to use scss --- .../lib/not-found-tailwind/not-found-tailwind.component.css | 3 --- .../lib/not-found-tailwind/not-found-tailwind.component.scss | 3 +++ .../src/lib/not-found-tailwind/not-found-tailwind.component.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.css create mode 100644 libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.scss diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.css b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.css deleted file mode 100644 index 5f25e208ae..0000000000 --- a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.css +++ /dev/null @@ -1,3 +0,0 @@ -.test { - background-color: theme(colors.primary); -} diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.scss b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.scss new file mode 100644 index 0000000000..cb00be6379 --- /dev/null +++ b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.scss @@ -0,0 +1,3 @@ +.test { + background-color: theme('colors.primary'); +} diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.ts b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.ts index 1cbbd7d2b5..a8fe361563 100644 --- a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.ts +++ b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.ts @@ -6,6 +6,6 @@ import { CommonModule } from '@angular/common'; standalone: true, imports: [CommonModule], templateUrl: './not-found-tailwind.component.html', - styleUrl: './not-found-tailwind.component.css', + styleUrl: './not-found-tailwind.component.scss', }) export class NotFoundTailwindComponent {} From 60f35b074c9050775b7c2099262df3bfe03770fa Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Fri, 8 Nov 2024 21:52:45 +0000 Subject: [PATCH 13/18] remove the unused folder and ignore the invalidPConfigPath error --- .vscode/settings.json | 1 + libs/openchallenges/not-found-tailwind/src/index.ts | 2 +- .../{not-found-tailwind => }/not-found-tailwind.component.html | 0 .../src/lib/not-found-tailwind.component.scss | 3 +++ .../not-found-tailwind.component.spec.ts.off | 0 .../{not-found-tailwind => }/not-found-tailwind.component.ts | 0 .../lib/{not-found-tailwind => }/not-found-tailwind.routes.ts | 0 .../lib/not-found-tailwind/not-found-tailwind.component.scss | 3 --- 8 files changed, 5 insertions(+), 4 deletions(-) rename libs/openchallenges/not-found-tailwind/src/lib/{not-found-tailwind => }/not-found-tailwind.component.html (100%) create mode 100644 libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.scss rename libs/openchallenges/not-found-tailwind/src/lib/{not-found-tailwind => }/not-found-tailwind.component.spec.ts.off (100%) rename libs/openchallenges/not-found-tailwind/src/lib/{not-found-tailwind => }/not-found-tailwind.component.ts (100%) rename libs/openchallenges/not-found-tailwind/src/lib/{not-found-tailwind => }/not-found-tailwind.routes.ts (100%) delete mode 100644 libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.scss diff --git a/.vscode/settings.json b/.vscode/settings.json index 931547af97..b328138d6a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -88,6 +88,7 @@ "password": "changeme" } ], + "tailwindCSS.includeLanguages": { "javascript": "javascript", "typescript": "typescript" }, "terminal.integrated.showExitAlert": false, "rewrap.wrappingColumn": 100, "jest.runMode": "on-demand" diff --git a/libs/openchallenges/not-found-tailwind/src/index.ts b/libs/openchallenges/not-found-tailwind/src/index.ts index 77612fd406..f452be9bb8 100644 --- a/libs/openchallenges/not-found-tailwind/src/index.ts +++ b/libs/openchallenges/not-found-tailwind/src/index.ts @@ -1 +1 @@ -export * from './lib/not-found-tailwind/not-found-tailwind.routes'; +export * from './lib/not-found-tailwind.routes'; diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.html b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.html similarity index 100% rename from libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.html rename to libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.html diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.scss b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.scss new file mode 100644 index 0000000000..9e020227c9 --- /dev/null +++ b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.scss @@ -0,0 +1,3 @@ +.test { + background-color: theme('colors.primary.DEFAULT'); +} diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.spec.ts.off b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.spec.ts.off similarity index 100% rename from libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.spec.ts.off rename to libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.spec.ts.off diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.ts b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.ts similarity index 100% rename from libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.ts rename to libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.ts diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.routes.ts b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.routes.ts similarity index 100% rename from libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.routes.ts rename to libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.routes.ts diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.scss b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.scss deleted file mode 100644 index cb00be6379..0000000000 --- a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind/not-found-tailwind.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.test { - background-color: theme('colors.primary'); -} From 707318442c4f756c96022411dae38e63ed65194c Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Fri, 8 Nov 2024 22:26:51 +0000 Subject: [PATCH 14/18] change back to use css --- .vscode/settings.json | 1 + ...tailwind.component.scss => not-found-tailwind.component.css} | 0 .../not-found-tailwind/src/lib/not-found-tailwind.component.ts | 2 +- 3 files changed, 2 insertions(+), 1 deletion(-) rename libs/openchallenges/not-found-tailwind/src/lib/{not-found-tailwind.component.scss => not-found-tailwind.component.css} (100%) diff --git a/.vscode/settings.json b/.vscode/settings.json index b328138d6a..bb4a46d6bd 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -88,6 +88,7 @@ "password": "changeme" } ], + "tailwindCSS.lint.invalidConfigPath": "ignore", "tailwindCSS.includeLanguages": { "javascript": "javascript", "typescript": "typescript" }, "terminal.integrated.showExitAlert": false, "rewrap.wrappingColumn": 100, diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.scss b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.css similarity index 100% rename from libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.scss rename to libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.css diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.ts b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.ts index a8fe361563..1cbbd7d2b5 100644 --- a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.ts +++ b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.ts @@ -6,6 +6,6 @@ import { CommonModule } from '@angular/common'; standalone: true, imports: [CommonModule], templateUrl: './not-found-tailwind.component.html', - styleUrl: './not-found-tailwind.component.scss', + styleUrl: './not-found-tailwind.component.css', }) export class NotFoundTailwindComponent {} From 3971e098d1f1b3d88c3d75bbcb06c1ea5d05f9a0 Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Fri, 8 Nov 2024 23:46:16 +0000 Subject: [PATCH 15/18] add new styles and theme libraries for tailwind --- .vscode/settings.json | 1 - libs/openchallenges/styles-tailwind/README.md | 7 +++++++ libs/openchallenges/themes-tailwind/README.md | 7 +++++++ tsconfig.base.json | 12 +++++++++--- 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 libs/openchallenges/styles-tailwind/README.md create mode 100644 libs/openchallenges/themes-tailwind/README.md diff --git a/.vscode/settings.json b/.vscode/settings.json index bb4a46d6bd..1e55f72d50 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -89,7 +89,6 @@ } ], "tailwindCSS.lint.invalidConfigPath": "ignore", - "tailwindCSS.includeLanguages": { "javascript": "javascript", "typescript": "typescript" }, "terminal.integrated.showExitAlert": false, "rewrap.wrappingColumn": 100, "jest.runMode": "on-demand" diff --git a/libs/openchallenges/styles-tailwind/README.md b/libs/openchallenges/styles-tailwind/README.md new file mode 100644 index 0000000000..fe6b48b627 --- /dev/null +++ b/libs/openchallenges/styles-tailwind/README.md @@ -0,0 +1,7 @@ +# styles-tailwind + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test styles-tailwind` to execute the unit tests. diff --git a/libs/openchallenges/themes-tailwind/README.md b/libs/openchallenges/themes-tailwind/README.md new file mode 100644 index 0000000000..989e124e16 --- /dev/null +++ b/libs/openchallenges/themes-tailwind/README.md @@ -0,0 +1,7 @@ +# themes-tailwind + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test themes-tailwind` to execute the unit tests. diff --git a/tsconfig.base.json b/tsconfig.base.json index abbb708afa..4693b91a08 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -52,6 +52,9 @@ "@sagebionetworks/openchallenges/home": ["libs/openchallenges/home/src/index.ts"], "@sagebionetworks/openchallenges/login": ["libs/openchallenges/login/src/index.ts"], "@sagebionetworks/openchallenges/not-found": ["libs/openchallenges/not-found/src/index.ts"], + "@sagebionetworks/openchallenges/not-found-tailwind": [ + "libs/openchallenges/not-found-tailwind/src/index.ts" + ], "@sagebionetworks/openchallenges/org-profile": [ "libs/openchallenges/org-profile/src/index.ts" ], @@ -59,8 +62,14 @@ "@sagebionetworks/openchallenges/pages": ["libs/openchallenges/pages/src/index.ts"], "@sagebionetworks/openchallenges/signup": ["libs/openchallenges/signup/src/index.ts"], "@sagebionetworks/openchallenges/styles": ["libs/openchallenges/styles/src/index.ts"], + "@sagebionetworks/openchallenges/styles-tailwind": [ + "libs/openchallenges/styles-tailwind/src/index.ts" + ], "@sagebionetworks/openchallenges/team": ["libs/openchallenges/team/src/index.ts"], "@sagebionetworks/openchallenges/themes": ["libs/openchallenges/themes/src/index.ts"], + "@sagebionetworks/openchallenges/themes-tailwind": [ + "libs/openchallenges/themes-tailwind/src/index.ts" + ], "@sagebionetworks/openchallenges/ui": ["libs/openchallenges/ui/src/index.ts"], "@sagebionetworks/openchallenges/util": ["libs/openchallenges/util/src/index.ts"], "@sagebionetworks/results-visualization-framework/ui": [ @@ -78,9 +87,6 @@ ], "@sagebionetworks/synapse/api-client-angular": [ "libs/synapse/api-client-angular/src/index.ts" - ], - "@sagebionetworks/openchallenges/not-found-tailwind": [ - "libs/openchallenges/not-found-tailwind/src/index.ts" ] } }, From 61adee227cae8d104d68918c54a755b93fcfaf8e Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Sat, 9 Nov 2024 03:23:36 +0000 Subject: [PATCH 16/18] inital setup the themes --- .../app-tailwind/src/styles.scss | 4 + .../app-tailwind/tailwind.config.js | 74 ++++++++--- .../src/lib/not-found-tailwind.component.css | 3 - .../themes-tailwind/src/fonts.css | 13 ++ .../themes-tailwind/src/palettes.css | 125 ++++++++++++++++++ 5 files changed, 198 insertions(+), 21 deletions(-) create mode 100644 libs/openchallenges/themes-tailwind/src/fonts.css create mode 100644 libs/openchallenges/themes-tailwind/src/palettes.css diff --git a/apps/openchallenges/app-tailwind/src/styles.scss b/apps/openchallenges/app-tailwind/src/styles.scss index 77e408aa8b..87f519e969 100644 --- a/apps/openchallenges/app-tailwind/src/styles.scss +++ b/apps/openchallenges/app-tailwind/src/styles.scss @@ -1,5 +1,9 @@ +@import 'libs/openchallenges/themes-tailwind/src/fonts.css'; +@import 'libs/openchallenges/themes-tailwind/src/palettes.css'; @tailwind base; @tailwind components; @tailwind utilities; /* You can add global styles to this file, and also import other style files */ + +/* Import fonts and colors from the theme library */ diff --git a/apps/openchallenges/app-tailwind/tailwind.config.js b/apps/openchallenges/app-tailwind/tailwind.config.js index 22857fc8e0..c9ef3e8fc3 100644 --- a/apps/openchallenges/app-tailwind/tailwind.config.js +++ b/apps/openchallenges/app-tailwind/tailwind.config.js @@ -8,26 +8,64 @@ module.exports = { ...createGlobPatternsForDependencies(__dirname), ], theme: { - extend: {}, - colors: { - primary: { - light: 'green', - DEFAULT: 'red', - dark: 'blue', + extend: { + colors: { + primary: { + DEFAULT: 'var(--color-dark-blue-600)', + 50: 'var(--color-dark-blue-50)', + 100: 'var(--color-dark-blue-100)', + 200: 'var(--color-dark-blue-200)', + 300: 'var(--color-dark-blue-300)', + 400: 'var(--color-dark-blue-400)', + 500: 'var(--color-dark-blue-500)', + 600: 'var(--color-dark-blue-600)', + 700: 'var(--color-dark-blue-700)', + 800: 'var(--color-dark-blue-800)', + 900: 'var(--color-dark-blue-900)', + }, + accent: { + DEFAULT: 'var(--color-light-purple-400)', + 50: 'var(--color-light-purple-50)', + 100: 'var(--color-light-purple-100)', + 200: 'var(--color-light-purple-200)', + 300: 'var(--color-light-purple-300)', + 400: 'var(--color-light-purple-400)', + 500: 'var(--color-light-purple-500)', + 600: 'var(--color-light-purple-600)', + 700: 'var(--color-light-purple-700)', + 800: 'var(--color-light-purple-800)', + 900: 'var(--color-light-purple-900)', + }, + figma: { + navbar: 'var(--figma-navbar)', + accent1: 'var(--figma-accent1)', + accent2: 'var(--figma-accent2)', + primary1: 'var(--figma-primary1)', + primary2: 'var(--figma-primary2)', + navbardark: 'var(--figma-navbardark)', + secondary1: 'var(--figma-secondary1)', + secondary2: 'var(--figma-secondary2)', + darkaccent1: 'var(--figma-darkaccent1)', + darkaccent2: 'var(--figma-darkaccent2)', + grayBlack: 'var(--figma-gray-black)', + grayWhite: 'var(--figma-gray-white)', + hoverLight: 'var(--figma-hover-light)', + hoverDark: 'var(--figma-hover-dark)', + }, }, - secondary: { - light: '#e9d5ff', - DEFAULT: '#a855f7', - dark: '#7e22ce', + fontFamily: { + lato: ['var(--font-family-lato)'], + }, + fontSize: { + headline5: ['var(--font-headline-5)'], + headline6: ['var(--font-headline-6)'], + subtitle1: ['var(--font-subtitle-1)'], + subtitle2: ['var(--font-subtitle-2)'], + body1: ['var(--font-body-1)'], + body2: ['var(--font-body-2)'], + caption: ['var(--font-caption)'], + button: ['var(--font-button)'], }, - white: '#ffffff', - black: '#000000', - }, - spacing: { - sm: '1rem', - md: '1.5rem', - lg: '2rem', - xl: '3rem', }, }, plugins: [], diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.css b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.css index 9e020227c9..e69de29bb2 100644 --- a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.css +++ b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.css @@ -1,3 +0,0 @@ -.test { - background-color: theme('colors.primary.DEFAULT'); -} diff --git a/libs/openchallenges/themes-tailwind/src/fonts.css b/libs/openchallenges/themes-tailwind/src/fonts.css new file mode 100644 index 0000000000..3cba9a0e24 --- /dev/null +++ b/libs/openchallenges/themes-tailwind/src/fonts.css @@ -0,0 +1,13 @@ +@import 'https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap'; + +:root { + --font-family-lato: 'Lato', sans-serif; + --font-headline-5: 46px / 56px 700; + --font-headline-6: 40px / 50px 700; + --font-subtitle-1: 28px / 38px 700; + --font-subtitle-2: 20px / 32px 400; + --font-body-1: 21px / 36px 400; + --font-body-2: 16px / 26px 400; + --font-caption: 14px / 21px 400; + --font-button: 16px / 18px 700; +} diff --git a/libs/openchallenges/themes-tailwind/src/palettes.css b/libs/openchallenges/themes-tailwind/src/palettes.css new file mode 100644 index 0000000000..d4b2e564a5 --- /dev/null +++ b/libs/openchallenges/themes-tailwind/src/palettes.css @@ -0,0 +1,125 @@ +:root { + /* Dark and Light Text Colors */ + --dark-primary-text: rgb(0 0 0 / 87%); + --dark-secondary-text: rgb(0 0 0 / 54%); + --dark-disabled-text: rgb(0 0 0 / 38%); + --dark-dividers: rgb(0 0 0 / 12%); + --dark-focused: rgb(0 0 0 / 12%); + --light-primary-text: #fff; + --light-secondary-text: rgb(255 255 255 / 70%); + --light-disabled-text: rgb(255 255 255 / 50%); + --light-dividers: rgb(255 255 255 / 12%); + --light-focused: rgb(255 255 255 / 12%); + + /* Dark Blue Palette */ + --color-dark-blue-50: #e8ebf5; + --color-dark-blue-100: #c4cce7; + --color-dark-blue-200: #9dabd7; + --color-dark-blue-300: #768ac7; + --color-dark-blue-400: #586fbc; + --color-dark-blue-500: #3756b1; + --color-dark-blue-600: #314fa7; + --color-dark-blue-700: #27459b; + --color-dark-blue-800: #1f3b8f; + --color-dark-blue-900: #102979; + + /* Dark Blue Contrast Colors */ + --color-dark-blue-contrast-50: var(--dark-primary-text); + --color-dark-blue-contrast-100: var(--dark-primary-text); + --color-dark-blue-contrast-200: var(--dark-primary-text); + --color-dark-blue-contrast-300: var(--dark-primary-text); + --color-dark-blue-contrast-400: var(--light-primary-text); + --color-dark-blue-contrast-500: var(--light-primary-text); + --color-dark-blue-contrast-600: var(--light-primary-text); + --color-dark-blue-contrast-700: var(--light-primary-text); + --color-dark-blue-contrast-800: var(--light-primary-text); + --color-dark-blue-contrast-900: var(--light-primary-text); + + /* Light Blue Palette */ + --color-light-blue-50: #dff4fb; + --color-light-blue-100: #ade3f4; + --color-light-blue-200: #76d1ed; + --color-light-blue-300: #39bde7; + --color-light-blue-400: #00b1e5; + --color-light-blue-500: #00a4e3; + --color-light-blue-600: #0096d5; + --color-light-blue-700: #0084c3; + --color-light-blue-800: #0073b0; + --color-light-blue-900: #005390; + + /* Light Blue Contrast Colors */ + --color-light-blue-contrast-50: var(--dark-primary-text); + --color-light-blue-contrast-100: var(--dark-primary-text); + --color-light-blue-contrast-200: var(--dark-primary-text); + --color-light-blue-contrast-300: var(--dark-primary-text); + --color-light-blue-contrast-400: var(--dark-primary-text); + --color-light-blue-contrast-500: var(--dark-primary-text); + --color-light-blue-contrast-600: var(--dark-primary-text); + --color-light-blue-contrast-700: var(--dark-primary-text); + --color-light-blue-contrast-800: var(--light-primary-text); + --color-light-blue-contrast-900: var(--light-primary-text); + + /* Light Green Palette */ + --color-light-green-50: #e8fefb; + --color-light-green-100: #c6fdf3; + --color-light-green-200: #a5fdec; + --color-light-green-300: #88f9e3; + --color-light-green-400: #76f2d9; + --color-light-green-500: #71ecd0; + --color-light-green-600: #6adbbf; + --color-light-green-700: #61c8ad; + --color-light-green-800: #5bb79d; + --color-light-green-900: #50977e; + + /* Light Green Contrast Colors */ + --color-light-green-contrast-50: var(--dark-primary-text); + --color-light-green-contrast-100: var(--dark-primary-text); + --color-light-green-contrast-200: var(--dark-primary-text); + --color-light-green-contrast-300: var(--dark-primary-text); + --color-light-green-contrast-400: var(--dark-primary-text); + --color-light-green-contrast-500: var(--dark-primary-text); + --color-light-green-contrast-600: var(--dark-primary-text); + --color-light-green-contrast-700: var(--dark-primary-text); + --color-light-green-contrast-800: var(--dark-primary-text); + --color-light-green-contrast-900: var(--dark-primary-text); + + /* Light Purple Palette */ + --color-light-purple-50: #ede8ff; + --color-light-purple-100: #d0c6fd; + --color-light-purple-200: #afa0fe; + --color-light-purple-300: #8a78ff; + --color-light-purple-400: #6859ff; + --color-light-purple-500: #594afc; + --color-light-purple-600: #2e3aee; + --color-light-purple-700: #0032e5; + --color-light-purple-800: #002ddc; + --color-light-purple-900: #0023ce; + + /* Light Purple Contrast Colors */ + --color-light-purple-contrast-50: var(--dark-primary-text); + --color-light-purple-contrast-100: var(--dark-primary-text); + --color-light-purple-contrast-200: var(--dark-primary-text); + --color-light-purple-contrast-300: var(--dark-primary-text); + --color-light-purple-contrast-400: var(--light-primary-text); + --color-light-purple-contrast-500: var(--light-primary-text); + --color-light-purple-contrast-600: var(--light-primary-text); + --color-light-purple-contrast-700: var(--light-primary-text); + --color-light-purple-contrast-800: var(--light-primary-text); + --color-light-purple-contrast-900: var(--light-primary-text); + + /* Figma Collection */ + --figma-navbar: var(--color-dark-blue-600); + --figma-accent1: var(--color-light-green-100); + --figma-accent2: var(--color-light-purple-50); + --figma-primary1: var(--color-dark-blue-400); + --figma-primary2: var(--dark-focused); + --figma-navbardark: var(--color-dark-blue-800); + --figma-secondary1: var(--color-light-blue-300); + --figma-secondary2: var(--color-light-purple-300); + --figma-darkaccent1: var(--color-light-green-700); + --figma-darkaccent2: var(--color-light-purple-200); + --figma-gray-black: #000; + --figma-gray-white: #fff; + --figma-hover-light: rgb(249 249 249 / 100%); + --figma-hover-dark: rgb(229 229 229 / 100%); +} From a0aae838a2b6677c9588c94d560b391d10f7ef75 Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Sat, 9 Nov 2024 05:22:38 +0000 Subject: [PATCH 17/18] inital migration to tailwind for not-found page --- .../app-tailwind/src/styles.scss | 55 ++++++++++++++++++- .../app-tailwind/tailwind.config.js | 31 +++++++++++ .../src/lib/not-found-tailwind.component.html | 25 ++++++++- .../src/lib/not-found-tailwind.component.ts | 4 +- .../styles-tailwind/src/constants.css | 32 +++++++++++ .../styles-tailwind/src/general.css | 0 .../styles-tailwind/src/index.css | 2 + .../themes-tailwind/src/index.css | 2 + 8 files changed, 146 insertions(+), 5 deletions(-) create mode 100644 libs/openchallenges/styles-tailwind/src/constants.css create mode 100644 libs/openchallenges/styles-tailwind/src/general.css create mode 100644 libs/openchallenges/styles-tailwind/src/index.css create mode 100644 libs/openchallenges/themes-tailwind/src/index.css diff --git a/apps/openchallenges/app-tailwind/src/styles.scss b/apps/openchallenges/app-tailwind/src/styles.scss index 87f519e969..2564a1b2d1 100644 --- a/apps/openchallenges/app-tailwind/src/styles.scss +++ b/apps/openchallenges/app-tailwind/src/styles.scss @@ -1,5 +1,5 @@ -@import 'libs/openchallenges/themes-tailwind/src/fonts.css'; -@import 'libs/openchallenges/themes-tailwind/src/palettes.css'; +@import 'libs/openchallenges/styles-tailwind/src/index.css'; +@import 'libs/openchallenges/themes-tailwind/src/index.css'; @tailwind base; @tailwind components; @tailwind utilities; @@ -7,3 +7,54 @@ /* You can add global styles to this file, and also import other style files */ /* Import fonts and colors from the theme library */ +@layer base { + html { + margin-top: var(--navbar-height); + } + + body { + max-height: 100vh; + margin: 0; + } + + em { + color: #00b1e5; + font-style: normal; + font-weight: 700; + } + + // BUTTONS + .btn { + padding: 6px 32px !important; + text-transform: uppercase; + text-decoration: none; + transition: background 0.15s ease !important; + } + + .btn-block { + width: 100%; + padding: 16px 32px !important; + text-transform: uppercase; + text-decoration: none; + } + + .btn-group { + display: flex; + flex-flow: column wrap; + align-content: center; + + a { + text-decoration: none; + } + } + + .btn-group > *:first-child { + align-self: stretch; + } + + .btn-group button, + .btn-group a { + margin: 5px; + padding: 21px 32px !important; + } +} diff --git a/apps/openchallenges/app-tailwind/tailwind.config.js b/apps/openchallenges/app-tailwind/tailwind.config.js index c9ef3e8fc3..ab30eb7851 100644 --- a/apps/openchallenges/app-tailwind/tailwind.config.js +++ b/apps/openchallenges/app-tailwind/tailwind.config.js @@ -66,6 +66,37 @@ module.exports = { caption: ['var(--font-caption)'], button: ['var(--font-button)'], }, + spacing: { + 'navbar-height': 'var(--navbar-height)', + 'navbar-height-tall': 'var(--navbar-height-tall)', + 'footer-height': 'var(--footer-height)', + unit: 'var(--unit)', + 'half-unit': 'var(--half-unit)', + 'two-units': 'var(--two-units)', + 'three-units': 'var(--three-units)', + 'four-units': 'var(--four-units)', + 'five-units': 'var(--five-units)', + 'six-units': 'var(--six-units)', + }, + borderRadius: { + round: 'var(--radius-round)', + 2: 'var(--radius-2)', + 4: 'var(--radius-4)', + 8: 'var(--radius-8)', + 16: 'var(--radius-16)', + }, + maxWidth: { + maxwidth: 'var(--maxwidth)', + xlarge: 'var(--xlarge)', + xxlarge: 'var(--xxlarge)', + }, + screens: { + sm: 'var(--sm-breakpoint)', + md: 'var(--md-breakpoint)', + lg: 'var(--lg-breakpoint)', + xl: 'var(--xl-breakpoint)', + xxl: 'var(--xxl-breakpoint)', + }, }, }, plugins: [], diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.html b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.html index 7a16699fa9..eb920af5f0 100644 --- a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.html +++ b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.html @@ -1,4 +1,4 @@ -
+ +
+
+ 404 +

Page Not Found

+

+ Oops! The page you are looking for does not exist. It might have been moved or deleted. +

+
+ +
diff --git a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.ts b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.ts index 1cbbd7d2b5..8a3110ba8d 100644 --- a/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.ts +++ b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.ts @@ -1,10 +1,12 @@ import { Component } from '@angular/core'; import { CommonModule } from '@angular/common'; +import { RouterModule } from '@angular/router'; +import { MatButtonModule } from '@angular/material/button'; @Component({ selector: 'openchallenges-not-found-tailwind', standalone: true, - imports: [CommonModule], + imports: [CommonModule, RouterModule, MatButtonModule], templateUrl: './not-found-tailwind.component.html', styleUrl: './not-found-tailwind.component.css', }) diff --git a/libs/openchallenges/styles-tailwind/src/constants.css b/libs/openchallenges/styles-tailwind/src/constants.css new file mode 100644 index 0000000000..707d15e7c8 --- /dev/null +++ b/libs/openchallenges/styles-tailwind/src/constants.css @@ -0,0 +1,32 @@ +:root { + /* Spacing */ + --navbar-height: 68px; + --navbar-height-tall: 240px; + --footer-height: 259px; + --unit: 16px; + --half-unit: 8px; + --two-units: 32px; + --three-units: 48px; + --four-units: 64px; + --five-units: 80px; + --six-units: 96px; + + /* Border Radius */ + --radius-round: 50%; + --radius-2: 2px; + --radius-4: 4px; + --radius-8: 8px; + --radius-16: 16px; + + /* Max Widths */ + --maxwidth: 1400px; + --xlarge: 192px; + --xxlarge: 288px; + + /* Breakpoints */ + --sm-breakpoint: 576px; + --md-breakpoint: 768px; + --lg-breakpoint: 992px; + --xl-breakpoint: 1200px; + --xxl-breakpoint: 1400px; +} diff --git a/libs/openchallenges/styles-tailwind/src/general.css b/libs/openchallenges/styles-tailwind/src/general.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libs/openchallenges/styles-tailwind/src/index.css b/libs/openchallenges/styles-tailwind/src/index.css new file mode 100644 index 0000000000..3715a11b25 --- /dev/null +++ b/libs/openchallenges/styles-tailwind/src/index.css @@ -0,0 +1,2 @@ +@import 'constants.css'; +@import 'general.css'; diff --git a/libs/openchallenges/themes-tailwind/src/index.css b/libs/openchallenges/themes-tailwind/src/index.css new file mode 100644 index 0000000000..2caec5be5d --- /dev/null +++ b/libs/openchallenges/themes-tailwind/src/index.css @@ -0,0 +1,2 @@ +@import 'fonts.css'; +@import 'palettes.css'; From badaf77333e4431727c0ee2c95f49f9981aade6b Mon Sep 17 00:00:00 2001 From: rrchai <73901500+rrchai@users.noreply.github.com> Date: Sat, 9 Nov 2024 05:24:40 +0000 Subject: [PATCH 18/18] revert changes for current not found page --- .../src/lib/not-found.component.html | 4 +-- .../src/lib/not-found.component.scss | 5 ++-- .../not-found/src/lib/not-found.component.ts | 29 ++++++++++--------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/libs/openchallenges/not-found/src/lib/not-found.component.html b/libs/openchallenges/not-found/src/lib/not-found.component.html index 93933d26df..aa54a6e1df 100644 --- a/libs/openchallenges/not-found/src/lib/not-found.component.html +++ b/libs/openchallenges/not-found/src/lib/not-found.component.html @@ -15,10 +15,10 @@

Page Not Found

- +/> diff --git a/libs/openchallenges/not-found/src/lib/not-found.component.scss b/libs/openchallenges/not-found/src/lib/not-found.component.scss index af02e8bee5..86b7209694 100644 --- a/libs/openchallenges/not-found/src/lib/not-found.component.scss +++ b/libs/openchallenges/not-found/src/lib/not-found.component.scss @@ -1,4 +1,4 @@ -// @use 'libs/openchallenges/styles/src/lib/constants'; +@use 'libs/openchallenges/styles/src/lib/constants'; #error { background: url('/openchallenges-assets/images/banner-sm.svg'); @@ -8,8 +8,7 @@ flex-direction: column; justify-content: center; align-items: center; - - // min-height: calc(100vh - constants.$navbar-height); + min-height: calc(100vh - constants.$navbar-height); } .err-message { diff --git a/libs/openchallenges/not-found/src/lib/not-found.component.ts b/libs/openchallenges/not-found/src/lib/not-found.component.ts index 63679cad83..1712f0725d 100644 --- a/libs/openchallenges/not-found/src/lib/not-found.component.ts +++ b/libs/openchallenges/not-found/src/lib/not-found.component.ts @@ -4,26 +4,27 @@ import { MatButtonModule } from '@angular/material/button'; import { RouterModule } from '@angular/router'; import { MatCardModule } from '@angular/material/card'; import { ConfigService } from '@sagebionetworks/openchallenges/config'; -// import { FooterComponent } from '@sagebionetworks/openchallenges/ui'; +import { FooterComponent } from '@sagebionetworks/openchallenges/ui'; @Component({ selector: 'openchallenges-not-found', standalone: true, - imports: [CommonModule, RouterModule, MatCardModule, MatButtonModule], + imports: [CommonModule, RouterModule, MatCardModule, MatButtonModule, FooterComponent], templateUrl: './not-found.component.html', styleUrls: ['./not-found.component.scss'], }) export class NotFoundComponent { - // public appVersion: string; - // public dataUpdatedOn: string; - // public privacyPolicyUrl: string; - // public termsOfUseUrl: string; - // public apiDocsUrl: string; - // constructor(private readonly configService: ConfigService) { - // this.appVersion = this.configService.config.appVersion; - // this.dataUpdatedOn = this.configService.config.dataUpdatedOn; - // this.privacyPolicyUrl = this.configService.config.privacyPolicyUrl; - // this.termsOfUseUrl = this.configService.config.termsOfUseUrl; - // this.apiDocsUrl = this.configService.config.apiDocsUrl; - // } + public appVersion: string; + public dataUpdatedOn: string; + public privacyPolicyUrl: string; + public termsOfUseUrl: string; + public apiDocsUrl: string; + + constructor(private readonly configService: ConfigService) { + this.appVersion = this.configService.config.appVersion; + this.dataUpdatedOn = this.configService.config.dataUpdatedOn; + this.privacyPolicyUrl = this.configService.config.privacyPolicyUrl; + this.termsOfUseUrl = this.configService.config.termsOfUseUrl; + this.apiDocsUrl = this.configService.config.apiDocsUrl; + } }