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", diff --git a/.vscode/settings.json b/.vscode/settings.json index 931547af97..1e55f72d50 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -88,6 +88,7 @@ "password": "changeme" } ], + "tailwindCSS.lint.invalidConfigPath": "ignore", "terminal.integrated.showExitAlert": false, "rewrap.wrappingColumn": 100, "jest.runMode": "on-demand" 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..181725dc6a --- /dev/null +++ b/apps/openchallenges/app-tailwind/project.json @@ -0,0 +1,109 @@ +{ + "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": "@nx/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": [ + { + "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" + } + ], + "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": "@nx/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 0000000000..317ebcb233 Binary files /dev/null and b/apps/openchallenges/app-tailwind/public/favicon.ico differ diff --git a/apps/openchallenges/app-tailwind/server.ts b/apps/openchallenges/app-tailwind/server.ts new file mode 100644 index 0000000000..9c65f56d29 --- /dev/null +++ b/apps/openchallenges/app-tailwind/server.ts @@ -0,0 +1,60 @@ +import { APP_BASE_HREF } from '@angular/common'; +import { CommonEngine } from '@angular/ssr'; +import express from 'express'; +import { fileURLToPath } from 'node:url'; +import { dirname, join, resolve } from 'node:path'; +import bootstrap from './src/main.server'; + +// The Express app is exported so that it can be used by serverless Functions. +export function app(): express.Express { + const server = express(); + const serverDistFolder = dirname(fileURLToPath(import.meta.url)); + const browserDistFolder = resolve(serverDistFolder, '../browser'); + const indexHtml = join(serverDistFolder, 'index.server.html'); + + const commonEngine = new CommonEngine(); + + server.set('view engine', 'html'); + server.set('views', browserDistFolder); + + // Example Express Rest API endpoints + // server.get('/api/**', (req, res) => { }); + // 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..0680b43f9c --- /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.off b/apps/openchallenges/app-tailwind/src/app/app.component.spec.ts.off new file mode 100644 index 0000000000..f1584ffc3c --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/app/app.component.spec.ts.off @@ -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..0dca10cccb --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/app/app.routes.ts @@ -0,0 +1,14 @@ +import { Routes } from '@angular/router'; + +export const appRoutes: Routes = [ + { path: '', redirectTo: 'not-found', pathMatch: 'full' }, + { + path: 'not-found', + loadChildren: () => + import('@sagebionetworks/openchallenges/not-found-tailwind').then((routes) => routes.routes), + }, + { + path: '**', + redirectTo: '/not-found', + }, +]; 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..2564a1b2d1 --- /dev/null +++ b/apps/openchallenges/app-tailwind/src/styles.scss @@ -0,0 +1,60 @@ +@import 'libs/openchallenges/styles-tailwind/src/index.css'; +@import 'libs/openchallenges/themes-tailwind/src/index.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 */ +@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/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..ab30eb7851 --- /dev/null +++ b/apps/openchallenges/app-tailwind/tailwind.config.js @@ -0,0 +1,103 @@ +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: { + 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)', + }, + }, + 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)'], + }, + 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/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"] +} diff --git a/libs/openchallenges/not-found-tailwind/.eslintrc.json b/libs/openchallenges/not-found-tailwind/.eslintrc.json new file mode 100644 index 0000000000..f02b39e763 --- /dev/null +++ b/libs/openchallenges/not-found-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": "openchallenges", + "style": "camelCase" + } + ], + "@angular-eslint/component-selector": [ + "error", + { + "type": "element", + "prefix": "openchallenges", + "style": "kebab-case" + } + ] + } + }, + { + "files": ["*.html"], + "extends": ["plugin:@nx/angular-template"], + "rules": {} + } + ] +} 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/openchallenges/not-found-tailwind/jest.config.ts b/libs/openchallenges/not-found-tailwind/jest.config.ts new file mode 100644 index 0000000000..5a47347fe0 --- /dev/null +++ b/libs/openchallenges/not-found-tailwind/jest.config.ts @@ -0,0 +1,21 @@ +export default { + displayName: 'not-found-tailwind', + preset: '../../../jest.preset.js', + setupFilesAfterEnv: ['/src/test-setup.ts'], + coverageDirectory: '../../../coverage/libs/openchallenges/not-found-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/openchallenges/not-found-tailwind/project.json b/libs/openchallenges/not-found-tailwind/project.json new file mode 100644 index 0000000000..4fa291bc22 --- /dev/null +++ b/libs/openchallenges/not-found-tailwind/project.json @@ -0,0 +1,20 @@ +{ + "name": "openchallenges-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..f452be9bb8 --- /dev/null +++ b/libs/openchallenges/not-found-tailwind/src/index.ts @@ -0,0 +1 @@ +export * from './lib/not-found-tailwind.routes'; 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 new file mode 100644 index 0000000000..e69de29bb2 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 new file mode 100644 index 0000000000..eb920af5f0 --- /dev/null +++ b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.html @@ -0,0 +1,45 @@ + + + +
+
+ 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.spec.ts.off b/libs/openchallenges/not-found-tailwind/src/lib/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.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.component.ts b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.ts new file mode 100644 index 0000000000..8a3110ba8d --- /dev/null +++ b/libs/openchallenges/not-found-tailwind/src/lib/not-found-tailwind.component.ts @@ -0,0 +1,13 @@ +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, RouterModule, MatButtonModule], + 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.routes.ts b/libs/openchallenges/not-found-tailwind/src/lib/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.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/openchallenges/not-found-tailwind/src/test-setup.ts b/libs/openchallenges/not-found-tailwind/src/test-setup.ts new file mode 100644 index 0000000000..ab1eeeb335 --- /dev/null +++ b/libs/openchallenges/not-found-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/openchallenges/not-found-tailwind/tsconfig.json b/libs/openchallenges/not-found-tailwind/tsconfig.json new file mode 100644 index 0000000000..fde35eab04 --- /dev/null +++ b/libs/openchallenges/not-found-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/openchallenges/not-found-tailwind/tsconfig.lib.json b/libs/openchallenges/not-found-tailwind/tsconfig.lib.json new file mode 100644 index 0000000000..872bc4599b --- /dev/null +++ b/libs/openchallenges/not-found-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", "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/openchallenges/not-found/src/lib/not-found.component.scss b/libs/openchallenges/not-found/src/lib/not-found.component.scss index d7741c58bf..86b7209694 100644 --- a/libs/openchallenges/not-found/src/lib/not-found.component.scss +++ b/libs/openchallenges/not-found/src/lib/not-found.component.scss @@ -10,9 +10,11 @@ align-items: center; min-height: calc(100vh - constants.$navbar-height); } + .err-message { padding-top: 100px; } + .btn-group { margin-top: 48px; 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/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/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/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/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'; 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%); +} diff --git a/tsconfig.base.json b/tsconfig.base.json index 1389cd2427..4693b91a08 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" @@ -53,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" ], @@ -60,13 +62,20 @@ "@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": [ "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": [