Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-5918 Add new plugin #3081

Open
wants to merge 41 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
84e4811
CB-5918 add holidays plugin
SychevAndrey Nov 18, 2024
07c4297
CB-5918 add plugin-holidays as a reference to product default
SychevAndrey Nov 18, 2024
c877dbc
CB-5918 fix holidays plugin, add icons
SychevAndrey Nov 18, 2024
bc4f254
CB-5918 fix: don't run many renders simultaneously
SychevAndrey Nov 18, 2024
776dc9e
CB-5918 fix: flakes respawn
SychevAndrey Nov 18, 2024
63d184a
CB-5918 refactor: adjust flakes size and speed
SychevAndrey Nov 18, 2024
1a7226a
CB-5918 refactor: make flakes look like flakes
SychevAndrey Nov 18, 2024
e2f141f
CB-5918 Extract Logo registration to separate plugin
SychevAndrey Nov 19, 2024
21f9474
CB-5918 refactor: update exports in holiday plugin
SychevAndrey Nov 19, 2024
ba540e1
CB-5918 feat: make logo src a prop
SychevAndrey Nov 19, 2024
592314c
CB-5918 refactor: update logos
SychevAndrey Nov 19, 2024
5ebb300
CB-5918 refactor: snowflakes removing faster if more flakes
SychevAndrey Nov 19, 2024
6481e50
CB-5918 refactor: reduce action icon rotation on click
SychevAndrey Nov 19, 2024
d2f1369
CB-5918 fix: deps
SychevAndrey Nov 19, 2024
013993b
CB-5918 fix: ts-config reference
SychevAndrey Nov 19, 2024
a6b755a
CB-5918 refactor: use debounce for resizing
SychevAndrey Nov 19, 2024
7df6325
CB-5918 refactor: add throttle to handleMouseMove
SychevAndrey Nov 19, 2024
7de4761
CB-5918 refactor: update logo
SychevAndrey Nov 19, 2024
779bc8e
CB-5918 fix: start date
SychevAndrey Nov 19, 2024
2987ef5
CB-5918 feat: add rotation to snowflakes
SychevAndrey Nov 19, 2024
f62a6bd
CB-5918 fix: dep version
SychevAndrey Nov 20, 2024
3ea0bc7
CB-5918: refactor: split up app logo plugin to public and admin parts
SychevAndrey Nov 20, 2024
c4fbbcd
CB-5918 refactor: split holidays plugin up to two parts: admin and pu…
SychevAndrey Nov 20, 2024
cb9e557
CB-5918 refactor: avoid using anonymous functions in Christmas class
SychevAndrey Nov 20, 2024
544a312
CB-5918 refactor: HolidayActionButton
SychevAndrey Nov 20, 2024
29c9a57
CB-5918 refactor: IHoliday interface naming
SychevAndrey Nov 20, 2024
545cf08
CB-5918 fix: update TS refs
SychevAndrey Nov 20, 2024
66d8b83
CB-5918 fix: legacy color notation and lost this
SychevAndrey Nov 20, 2024
f97479a
CB-5918 refactor: remove redundant plugin bootstrap export
SychevAndrey Nov 20, 2024
f5be137
CB-5918 refactor: rename private property
SychevAndrey Nov 20, 2024
c4804bd
CB-5918 refactor: use IconButton core block inside HolidayActionButton
SychevAndrey Nov 20, 2024
b6d2911
CB-5918 refactor: add check in addHoliday method
SychevAndrey Nov 20, 2024
7120316
CB-5918 refactor: simplify logoSrc condition
SychevAndrey Nov 20, 2024
82dd908
CB-5918 refactor: remove redundant styles
SychevAndrey Nov 21, 2024
4362513
CB-5918 refactor: use descriptive names for plugins bootstrap
SychevAndrey Nov 21, 2024
c3222ae
CB-5918 refactor: specify dep version
SychevAndrey Nov 21, 2024
7815921
CB-5918 refactor: improve Christmas class readability
SychevAndrey Nov 21, 2024
6f8694e
Merge branch 'devel' into CB-5918-add-christmas
dariamarutkina Nov 22, 2024
08d9138
CB-5918 refactor: use lazy import for logo
SychevAndrey Nov 22, 2024
f3246e6
CB-5918 refactor: export lazy components properly
SychevAndrey Nov 22, 2024
b8ed932
Merge branch 'devel' into CB-5918-add-christmas
EvgeniaBzzz Nov 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions webapp/packages/core-blocks/src/layout/AppLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ import styles from './AppLogo.module.css';
interface Props {
title: string;
onClick?: () => void;
iconSrc?: string;
}

export const AppLogo: React.FC<Props> = function AppLogo({ title, onClick }) {
export const AppLogo: React.FC<Props> = function AppLogo({ title, onClick, iconSrc = '/icons/logo_sm.svg' }) {
const style = useS(styles);
return (
<div tabIndex={0} className={s(style, { container: true })} onClick={onClick}>
<IconOrImage title={title} className={s(style, { logo: true })} icon="/icons/logo_sm.svg" />
<IconOrImage title={title} className={s(style, { logo: true })} icon={iconSrc} />
</div>
);
};
17 changes: 17 additions & 0 deletions webapp/packages/plugin-app-logo-administration/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# dependencies
/node_modules

# testing
/coverage

# production
/lib

# misc
.DS_Store
.env*

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
30 changes: 30 additions & 0 deletions webapp/packages/plugin-app-logo-administration/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "@cloudbeaver/plugin-app-logo-administration",
"type": "module",
"sideEffects": [
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
],
"version": "0.1.0",
"description": "",
"license": "Apache-2.0",
"main": "dist/index.js",
"scripts": {
"build": "tsc -b",
"clean": "rimraf --glob dist",
"lint": "eslint ./src/ --ext .ts,.tsx",
"validate-dependencies": "core-cli-validate-dependencies",
"update-ts-references": "yarn run clean && typescript-resolve-references"
},
"dependencies": {
"@cloudbeaver/core-blocks": "^0",
"@cloudbeaver/core-di": "^0",
"@cloudbeaver/plugin-administration": "^0",
"@cloudbeaver/plugin-app-logo": "^0"
},
"peerDependencies": {},
"devDependencies": {
"typescript": "^5"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
*/
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { AdministrationTopAppBarService, WizardTopAppBarService } from '@cloudbeaver/plugin-administration';
import { Logo } from '@cloudbeaver/plugin-top-app-bar';
import { LogoLazy } from '@cloudbeaver/plugin-app-logo';

@injectable()
export class AdministrationTopAppBarBootstrap extends Bootstrap {
export class AppLogoAdministrationPluginBootstrap extends Bootstrap {
constructor(
private readonly administrationTopAppBarService: AdministrationTopAppBarService,
private readonly wizardTopAppBarService: WizardTopAppBarService,
) {
super();
}

override register(): void | Promise<void> {
this.administrationTopAppBarService.placeholder.add(Logo, 0);
this.wizardTopAppBarService.placeholder.add(Logo, 0);
override register() {
this.administrationTopAppBarService.placeholder.add(LogoLazy, 0);
this.wizardTopAppBarService.placeholder.add(LogoLazy, 0);
}
}
11 changes: 11 additions & 0 deletions webapp/packages/plugin-app-logo-administration/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { appLogoAdministrationPlugin } from './manifest.js';

export { appLogoAdministrationPlugin };
export default appLogoAdministrationPlugin;
15 changes: 15 additions & 0 deletions webapp/packages/plugin-app-logo-administration/src/manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import type { PluginManifest } from '@cloudbeaver/core-di';

export const appLogoAdministrationPlugin: PluginManifest = {
info: {
name: 'App Logo Administration plugin',
},
providers: [() => import('./PluginBootstrap.js').then(m => m.AppLogoAdministrationPluginBootstrap)],
};
24 changes: 24 additions & 0 deletions webapp/packages/plugin-app-logo-administration/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo"
},
"references": [
{
"path": "../core-blocks/tsconfig.json"
},
{
"path": "../core-di/tsconfig.json"
},
{
"path": "../plugin-administration/tsconfig.json"
},
{
"path": "../plugin-app-logo/tsconfig.json"
}
],
"include": ["__custom_mocks__/**/*", "src/**/*", "src/**/*.json", "src/**/*.css", "src/**/*.scss"],
"exclude": ["**/node_modules", "lib/**/*", "dist/**/*"]
}
17 changes: 17 additions & 0 deletions webapp/packages/plugin-app-logo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# dependencies
/node_modules

# testing
/coverage

# production
/lib

# misc
.DS_Store
.env*

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
39 changes: 39 additions & 0 deletions webapp/packages/plugin-app-logo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "@cloudbeaver/plugin-app-logo",
"type": "module",
"sideEffects": [
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
],
"version": "0.1.0",
"description": "",
"license": "Apache-2.0",
"main": "dist/index.js",
"scripts": {
"build": "tsc -b",
"clean": "rimraf --glob dist",
"lint": "eslint ./src/ --ext .ts,.tsx",
"validate-dependencies": "core-cli-validate-dependencies",
"update-ts-references": "yarn run clean && typescript-resolve-references"
},
"dependencies": {
"@cloudbeaver/core-blocks": "^0",
"@cloudbeaver/core-di": "^0",
"@cloudbeaver/core-root": "^0",
"@cloudbeaver/core-routing": "^0",
"@cloudbeaver/core-version": "^0",
"@cloudbeaver/core-view": "^0",
"@cloudbeaver/plugin-holidays": "^0",
"@cloudbeaver/plugin-top-app-bar": "^0",
"mobx": "^6",
"mobx-react-lite": "^4",
"react": "^18"
},
"peerDependencies": {},
"devDependencies": {
"@types/react": "^18",
"typescript": "^5",
"typescript-plugin-css-modules": "^5"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ import { useService } from '@cloudbeaver/core-di';
import { ProductInfoResource } from '@cloudbeaver/core-root';
import { ScreenService } from '@cloudbeaver/core-routing';
import { useAppVersion } from '@cloudbeaver/core-version';
import { HolidaysService } from '@cloudbeaver/plugin-holidays';

export const Logo = observer(function Logo() {
const productInfoResource = useResource(Logo, ProductInfoResource, undefined);
const screenService = useService(ScreenService);
const { backendVersion, frontendVersion } = useAppVersion(true);
const { holiday } = useService(HolidaysService);

const isSameVersion = backendVersion === frontendVersion;

Expand All @@ -26,5 +28,5 @@ export const Logo = observer(function Logo() {

const title = isSameVersion ? backendVersionTitle : commonVersionTitle;

return <AppLogo title={title} onClick={() => screenService.navigateToRoot()} />;
return <AppLogo title={title} iconSrc={holiday?.logoSrc} onClick={() => screenService.navigateToRoot()} />;
});
10 changes: 10 additions & 0 deletions webapp/packages/plugin-app-logo/src/LogoLazy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { importLazyComponent } from '@cloudbeaver/core-blocks';

export const LogoLazy = importLazyComponent(() => import('./Logo.js').then(m => m.Logo));
21 changes: 21 additions & 0 deletions webapp/packages/plugin-app-logo/src/PluginBootstrap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { TopNavService } from '@cloudbeaver/plugin-top-app-bar';
import { LogoLazy } from './LogoLazy.js';

@injectable()
export class AppLogoPluginBootstrap extends Bootstrap {
constructor(private readonly topNavService: TopNavService) {
super();
}

override register() {
this.topNavService.placeholder.add(LogoLazy, 0);
}
}
13 changes: 13 additions & 0 deletions webapp/packages/plugin-app-logo/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { appLogoPlugin } from './manifest.js';

export * from './LogoLazy.js';

export { appLogoPlugin };
export default appLogoPlugin;
Wroud marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 15 additions & 0 deletions webapp/packages/plugin-app-logo/src/manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import type { PluginManifest } from '@cloudbeaver/core-di';

export const appLogoPlugin: PluginManifest = {
info: {
name: 'App Logo plugin',
},
providers: [() => import('./PluginBootstrap.js').then(m => m.AppLogoPluginBootstrap)],
};
46 changes: 46 additions & 0 deletions webapp/packages/plugin-app-logo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo"
},
"references": [
{
"path": "../core-blocks/tsconfig.json"
},
{
"path": "../core-di/tsconfig.json"
},
{
"path": "../core-root/tsconfig.json"
},
{
"path": "../core-routing/tsconfig.json"
},
{
"path": "../core-version/tsconfig.json"
},
{
"path": "../core-view/tsconfig.json"
},
{
"path": "../plugin-holidays/tsconfig.json"
},
{
"path": "../plugin-top-app-bar/tsconfig.json"
}
],
"include": [
"__custom_mocks__/**/*",
"src/**/*",
"src/**/*.json",
"src/**/*.css",
"src/**/*.scss"
],
"exclude": [
"**/node_modules",
"lib/**/*",
"dist/**/*"
]
}
17 changes: 17 additions & 0 deletions webapp/packages/plugin-holidays-administration/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# dependencies
/node_modules

# testing
/coverage

# production
/lib

# misc
.DS_Store
.env*

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
30 changes: 30 additions & 0 deletions webapp/packages/plugin-holidays-administration/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "@cloudbeaver/plugin-holidays-administration",
"type": "module",
"sideEffects": [
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
],
"version": "0.1.0",
"description": "",
"license": "Apache-2.0",
"main": "dist/index.js",
"scripts": {
"build": "tsc -b",
"clean": "rimraf --glob dist",
"lint": "eslint ./src/ --ext .ts,.tsx",
"validate-dependencies": "core-cli-validate-dependencies",
"update-ts-references": "yarn run clean && typescript-resolve-references"
},
"dependencies": {
"@cloudbeaver/core-blocks": "^0",
"@cloudbeaver/core-di": "^0",
"@cloudbeaver/plugin-administration": "^0",
"@cloudbeaver/plugin-holidays": "^0"
},
"peerDependencies": {},
"devDependencies": {
"typescript": "^5"
}
}
Loading
Loading