1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-07 21:47:02 +09:00

Merge branch 'main' into publish-test

This commit is contained in:
Anatolii Smolianinov 2024-11-12 18:07:27 +01:00
commit 33b97c3945
No known key found for this signature in database
GPG key ID: 5E259D1D468B99F4
100 changed files with 3253 additions and 1380 deletions

View file

@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os:
- macos-12
- macos-13
- ubuntu-latest
- windows-latest
@ -95,7 +95,7 @@ jobs:
CGO_ENABLED: 0
- name: Build Front Mac OS
if: matrix.os == 'macos-12'
if: matrix.os == 'macos-13'
uses: samuelmeuli/action-electron-builder@v1
with:
github_token: ${{secrets.TOKEN}}
@ -114,7 +114,7 @@ jobs:
SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN}}
- name: Build Front Other
if: matrix.os != 'macos-12'
if: matrix.os != 'macos-13'
uses: samuelmeuli/action-electron-builder@v1
with:
github_token: ${{secrets.TOKEN}}

4
.gitignore vendored
View file

@ -18,6 +18,10 @@ docs/*
electron/env.json
src/json/schema
licenses.json
dist/.rsdoctor
# generated by rspack
/compilation-stats.json
# generated by update.sh
/linux-amd*/

View file

@ -3,7 +3,6 @@ const { is } = require('electron-util');
const path = require('path');
const ConfigManager = require('./config.js');
const Util = require('./util.js');
const Separator = { type: 'separator' };
class MenuManager {
@ -21,6 +20,7 @@ class MenuManager {
const Api = require('./api.js');
const WindowManager = require('./window.js');
const UpdateManager = require('./update.js');
const isAllowedUpdate = UpdateManager.isAllowed();
config.debug = config.debug || {};
config.flagsMw = config.flagsMw || {};
@ -37,9 +37,8 @@ class MenuManager {
{ role: 'hideothers', label: Util.translate('electronMenuHideOthers') },
{ role: 'unhide', label: Util.translate('electronMenuUnhide') },
Separator,
{ label: Util.translate('electronMenuCheckUpdates'), click: () => Api.updateCheck(this.win) },
{ type: 'separator', visible: isAllowedUpdate },
{ label: Util.translate('electronMenuCheckUpdates'), click: () => Api.updateCheck(this.win), visible: isAllowedUpdate },
Separator,
@ -235,6 +234,7 @@ class MenuManager {
{ label: Util.translate('electronMenuDebugProcess'), click: () => Util.send(this.win, 'commandGlobal', 'debugProcess') },
{ label: Util.translate('electronMenuDebugStat'), click: () => Util.send(this.win, 'commandGlobal', 'debugStat') },
{ label: Util.translate('electronMenuDebugReconcile'), click: () => Util.send(this.win, 'commandGlobal', 'debugReconcile') },
{ label: Util.translate('electronMenuDebugNet'), click: () => Util.send(this.win, 'commandGlobal', 'debugNet') },
Separator,
@ -307,6 +307,8 @@ class MenuManager {
const { config } = ConfigManager;
const WindowManager = require('./window.js');
const Api = require('./api.js');
const UpdateManager = require('./update.js');
const isAllowedUpdate = UpdateManager.isAllowed();
this.destroy();
@ -325,7 +327,7 @@ class MenuManager {
Separator,
{ label: Util.translate('electronMenuCheckUpdates'), click: () => { this.winShow(); Api.updateCheck(this.win); } },
{ label: Util.translate('electronMenuCheckUpdates'), click: () => { this.winShow(); Api.updateCheck(this.win); }, visible: isAllowedUpdate },
{ label: Util.translate('commonSettings'), submenu: this.menuSettings() },
Separator,

View file

@ -39,7 +39,7 @@ contextBridge.exposeInMainWorld('Electron', {
getGlobal: key => getGlobal(key),
showOpenDialog: dialog.showOpenDialog,
webFilePath: file => webUtils.getPathForFile(file),
webFilePath: file => webUtils && webUtils.getPathForFile(file),
fileWrite: (name, data, options) => {
name = String(name || 'temp');

View file

@ -100,6 +100,10 @@ class UpdateManager {
return false;
};
if (is.macos && (major <= 10)) {
return false;
};
return true;
};

View file

@ -8,7 +8,8 @@ const protocol = 'anytype';
const ConfigManager = require('./config.js');
const Constant = require('../json/constant.json');
log.transports.rendererConsole.level = 'error';
log.initialize();
log.transports.console.level = 'error';
class Util {
@ -240,4 +241,4 @@ class Util {
};
module.exports = new Util();
module.exports = new Util();

View file

@ -1 +1 @@
0.36.5
0.37.0-alpha04

2948
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "anytype",
"version": "0.43.2",
"version": "0.43.14-alpha",
"description": "Anytype",
"main": "electron.js",
"scripts": {
@ -9,26 +9,28 @@
"lint": "eslint .",
"electron": "npx electron .",
"electron-win": "npx electron.cmd .",
"start:watch": "cross-env-shell webpack-dev-server --progress --mode=development --node-env=development --env SERVER_PORT=$SERVER_PORT --env DATA_PATH=$DATA_PATH --history-api-fallback --cache",
"start:electron-wait-webpack": "cross-env-shell wait-for-localhost $SERVER_PORT && npm run electron",
"start:electron-wait-webpack-win": "cross-env-shell wait-for-localhost $SERVER_PORT && npm run electron-win",
"start:dev": "npm-run-all --parallel start:watch start:electron-wait-webpack",
"start:dev-win": "npm-run-all --parallel start:watch start:electron-wait-webpack-win",
"build": "webpack --mode=production --node-env=production --config webpack.config.js",
"build:dev": "webpack --mode=development --node-env=development --config webpack.config.js",
"build:deps": "webpack --config webpack.node.config.js --stats detailed | grep 'node_modules' | sed -E 's/.*(node_modules[\\/][^\\\\/[:space:]]{1,})[\\\\/].*/\\1/' | uniq | node save-node-deps.js",
"doctor:start:dev": "RSDOCTOR=true npm run start:dev",
"doctor:build:dev": "RSDOCTOR=true npm run build:dev",
"start:watch": "cross-env-shell rspack serve --mode=development --node-env=development --env SERVER_PORT=$SERVER_PORT --env DATA_PATH=$DATA_PATH",
"start:electron-wait-rspack": "cross-env-shell wait-for-localhost $SERVER_PORT && npm run electron",
"start:electron-wait-rspack-win": "cross-env-shell wait-for-localhost $SERVER_PORT && npm run electron-win",
"start:dev": "npm-run-all --parallel start:watch start:electron-wait-rspack",
"start:dev-win": "npm-run-all --parallel start:watch start:electron-wait-rspack-win",
"build": "rspack --mode=production --node-env=production --config rspack.config.js",
"build:dev": "rspack --mode=development --node-env=development --config rspack.config.js",
"build:deps": "rspack build --config rspack.node.config.js --json=compilation-stats.json && cat compilation-stats.json | grep -o '[^\"]\\+node_modules[^\"]\\+' | sed -E 's/.*(node_modules[\\/][^\\\\/[:space:]]{1,})[\\\\/].*/\\1/' | uniq | node save-node-deps.js",
"build:nmh": "go build -o dist/nativeMessagingHost ./go/nativeMessagingHost.go",
"build:nmh-win": "go build -o dist/nativeMessagingHost.exe ./go/nativeMessagingHost.go",
"dist:mac": "npm run build:deps && webpack --progress --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` electron-builder --macos --arm64 --x64",
"dist:macarm": "npm run build:deps && webpack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` electron-builder --macos --arm64",
"dist:macamd": "npm run build:deps && webpack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` electron-builder --macos --x64",
"dist:win": "webpack --mode=production --node-env=production && electron-builder --windows",
"dist:linux": "npm run build:deps && webpack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` electron-builder --linux --arm64 --x64",
"dist:linuxamd": "npm run build:deps && webpack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` electron-builder --linux --x64",
"dist:linuxarm": "npm run build:deps && webpack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` electron-builder --linux --arm64",
"publish:mac": "webpack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` BUILD_NUMBER=`git rev-parse --short HEAD` electron-builder --macos --publish always",
"publish:linux": "webpack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` BUILD_NUMBER=`git rev-parse --short HEAD` electron-builder --linux --publish always",
"publish:win": "webpack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` BUILD_NUMBER=`git rev-parse --short HEAD` electron-builder --windows --publish always",
"dist:mac": "npm run build:deps && rspack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` electron-builder --macos --arm64 --x64",
"dist:macarm": "npm run build:deps && rspack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` electron-builder --macos --arm64",
"dist:macamd": "npm run build:deps && rspack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` electron-builder --macos --x64",
"dist:win": "rspack --mode=production --node-env=production && electron-builder --windows",
"dist:linux": "npm run build:deps && rspack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` electron-builder --linux --arm64 --x64",
"dist:linuxamd": "npm run build:deps && rspack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` electron-builder --linux --x64",
"dist:linuxarm": "npm run build:deps && rspack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` electron-builder --linux --arm64",
"publish:mac": "rspack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` BUILD_NUMBER=`git rev-parse --short HEAD` electron-builder --macos --publish always",
"publish:linux": "rspack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` BUILD_NUMBER=`git rev-parse --short HEAD` electron-builder --linux --publish always",
"publish:win": "rspack --mode=production --node-env=production && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` BUILD_NUMBER=`git rev-parse --short HEAD` electron-builder --windows --publish always",
"postinstall": "npx patch-package && electron-builder install-app-deps",
"prepare": "husky install",
"update:locale": "node ./electron/hook/locale.js"
@ -47,12 +49,16 @@
},
"homepage": "https://anytype.io",
"devDependencies": {
"@electron/notarize": "^2.1.0",
"@electron/notarize": "^2.5.0",
"@rsdoctor/rspack-plugin": "^0.4.8",
"@rspack/cli": "^1.1.0",
"@rspack/core": "^1.1.0",
"@rspack/plugin-react-refresh": "^1.0.0",
"@types/history": "^4.7.8",
"@types/jquery": "^3.5.14",
"@types/katex": "^0.14.0",
"@types/lodash": "^4.14.165",
"@types/node": "^12.19.4",
"@types/node": "^22.9.0",
"@types/prismjs": "^1.16.1",
"@types/raf": "^3.4.0",
"@types/react": "^16.14.31",
@ -66,6 +72,7 @@
"electron-builder": "^24.13.3",
"eslint": "^8.29.0",
"eslint-plugin-react": "^7.31.11",
"fork-ts-checker-webpack-plugin": "^9.0.2",
"husky": "^8.0.3",
"license-checker": "^25.0.1",
"lint-staged": "^13.0.3",
@ -73,19 +80,14 @@
"npm": "^10.5.0",
"npm-run-all": "^4.1.5",
"patch-package": "^6.4.7",
"react-refresh": "^0.14.2",
"sass": "1.77.6",
"sass-loader": "^8.0.2",
"source-map-loader": "^0.2.4",
"style-loader": "^1.2.1",
"ts-loader": "^6.2.2",
"typescript": "^5.3.3",
"typescript-eslint": "^0.0.1-alpha.0",
"url-loader": "^4.1.1",
"wait-for-localhost-cli": "^3.0.0",
"webpack": "^5.74.0",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.13.1"
"wait-for-localhost-cli": "^3.0.0"
},
"dependencies": {
"@electron/remote": "^2.1.2",
@ -97,7 +99,6 @@
"amplitude-js": "^5.11.0",
"array-move": "^2.2.2",
"blueimp-load-image": "^2.31.0",
"copy-webpack-plugin": "^12.0.2",
"d3": "^7.0.1",
"d3-force": "^3.0.0",
"d3-force-cluster": "^0.1.2",
@ -105,7 +106,7 @@
"dompurify": "^3.0.6",
"electron-dl": "^1.14.0",
"electron-json-storage": "^4.5.0",
"electron-log": "^3.0.9",
"electron-log": "^5.2.0",
"electron-updater": "^6.2.1",
"electron-util": "^0.12.3",
"electron-window-state": "^5.0.3",
@ -646,4 +647,4 @@
"pre-commit": "npm run precommit && git add licenses.json"
}
}
}
}

View file

@ -1,14 +1,16 @@
const path = require('path');
const process = require('process');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const rspack = require('@rspack/core');
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const { RsdoctorRspackPlugin } = require('@rsdoctor/rspack-plugin');
const pdfjsDistPath = path.dirname(require.resolve('pdfjs-dist/package.json'));
const cMapsDir = path.join(pdfjsDistPath, 'cmaps');
module.exports = (env, argv) => {
const port = process.env.SERVER_PORT;
const prod = argv.mode === 'production';
return {
mode: 'development',
@ -53,16 +55,18 @@ module.exports = (env, argv) => {
path.resolve('./node_modules')
]
},
watchOptions: {
ignored: /node_modules/,
poll: false,
},
devServer: {
hot: true,
static: {
directory: path.join(__dirname, 'dist'),
watch: {
ignored: [
path.resolve(__dirname, 'dist'),
path.resolve(__dirname, 'node_modules')
],
static: ['dist'],
watchFiles: {
paths: ['src'],
options: {
usePolling: false,
},
},
@ -86,9 +90,49 @@ module.exports = (env, argv) => {
module: {
rules: [
{
test: /\.ts(x?)$/,
exclude: /node_modules/,
loader: 'ts-loader'
test: /\.(j|t)s$/,
exclude: [/[\\/]node_modules[\\/]/],
loader: 'builtin:swc-loader',
options: {
jsc: {
parser: {
syntax: 'typescript',
},
transform: {
react: {
runtime: 'automatic',
development: !prod,
refresh: !prod,
},
},
},
env: {
targets: 'Chrome >= 48',
},
},
},
{
test: /\.(j|t)sx$/,
loader: 'builtin:swc-loader',
exclude: [/[\\/]node_modules[\\/]/],
options: {
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
transform: {
react: {
runtime: 'automatic',
development: !prod,
refresh: !prod,
},
},
},
env: {
targets: 'Chrome >= 48', // browser compatibility
},
},
},
{
enforce: 'pre',
@ -97,11 +141,11 @@ module.exports = (env, argv) => {
},
{
test: /\.(eot|ttf|otf|woff|woff2)$/,
loader: 'url-loader'
type: 'asset/inline'
},
{
test: /\.(jpe?g|png|gif|svg)$/,
loader: 'url-loader'
type: 'asset/inline'
},
{
test: /\.s?css/,
@ -113,18 +157,26 @@ module.exports = (env, argv) => {
}
]
},
plugins: [
//new BundleAnalyzerPlugin(),
new webpack.optimize.LimitChunkCountPlugin({
plugins: [
!prod && new ReactRefreshPlugin(),
process.env.RSDOCTOR && new RsdoctorRspackPlugin({}),
new ForkTsCheckerWebpackPlugin(),
// new rspack.IgnorePlugin({
// resourceRegExp: /osx-temperature-sensor/,
// }),
new rspack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
}),
new CopyWebpackPlugin({
new rspack.CopyRspackPlugin({
patterns: [
{ from: cMapsDir, to: './cmaps/' },
],
}),
],
].filter(Boolean),
};
};

View file

@ -1,3 +1,5 @@
const rspack = require('@rspack/core');
module.exports = (env) => {
return {
target: 'node',
@ -18,7 +20,14 @@ module.exports = (env) => {
rules: [
{ test: /\.node$/, loader: 'node-loader' },
]
}
},
plugins: [
new rspack.IgnorePlugin({
resourceRegExp: /osx-temperature-sensor/,
}),
],
stats: 'detailed',
};
};

View file

@ -1,4 +1,3 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.46967 4.46967C4.76256 4.17678 5.23744 4.17678 5.53033 4.46967L15.5303 14.4697C15.8232 14.7626 15.8232 15.2374 15.5303 15.5303C15.2374 15.8232 14.7626 15.8232 14.4697 15.5303L4.46967 5.53033C4.17678 5.23744 4.17678 4.76256 4.46967 4.46967Z" fill="#b6b6b6"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.5303 4.46967C15.2374 4.17678 14.7626 4.17678 14.4697 4.46967L4.46967 14.4697C4.17678 14.7626 4.17678 15.2374 4.46967 15.5303C4.76256 15.8232 5.23744 15.8232 5.53033 15.5303L15.5303 5.53033C15.8232 5.23744 15.8232 4.76256 15.5303 4.46967Z" fill="#b6b6b6"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 18.9902C14.9706 18.9902 19 14.9608 19 9.99023C19 5.01967 14.9706 0.990234 10 0.990234C5.02944 0.990234 1 5.01967 1 9.99023C1 14.9608 5.02944 18.9902 10 18.9902ZM6.48659 6.44494C6.7802 6.15276 7.25507 6.15392 7.54725 6.44753L10.0078 8.92014L12.4684 6.44753C12.7606 6.15392 13.2354 6.15276 13.529 6.44494C13.8226 6.73712 13.8238 7.21199 13.5316 7.5056L11.0659 9.9834L13.5316 12.4612C13.8238 12.7548 13.8226 13.2297 13.529 13.5219C13.2354 13.814 12.7606 13.8129 12.4684 13.5193L10.0078 11.0467L7.54725 13.5193C7.25507 13.8129 6.7802 13.814 6.48659 13.5219C6.19298 13.2297 6.19182 12.7548 6.484 12.4612L8.94973 9.9834L6.484 7.5056C6.19182 7.21199 6.19298 6.73712 6.48659 6.44494Z" fill="#b6b6b6"/>
</svg>

Before

Width:  |  Height:  |  Size: 720 B

After

Width:  |  Height:  |  Size: 849 B

Before After
Before After

View file

@ -1,5 +1,5 @@
<svg shape-rendering="geometricPrecision" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.42654 13.2986C5.21668 13.1517 4.98994 13 4.73378 13H3C2.44771 13 2 12.5523 2 12V8.00003C2 7.44774 2.44772 7.00003 3 7.00003H4.73378C4.98994 7.00003 5.21668 6.84835 5.42654 6.70145L8.42654 4.60145C9.08931 4.13751 10 4.61166 10 5.42068V14.5794C10 15.3884 9.08932 15.8625 8.42654 15.3986L5.42654 13.2986Z" fill="#a09f92"/>
<rect x="12.5" y="7.85718" width="1.21218" height="7.27311" rx="0.606092" transform="rotate(-45 12.5 7.85718)" fill="#a09f92"/>
<rect x="17.6428" y="7" width="1.21218" height="7.27311" rx="0.606092" transform="rotate(45 17.6428 7)" fill="#a09f92"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.42654 13.2986C5.21668 13.1517 4.98994 13 4.73378 13H3C2.44771 13 2 12.5523 2 12V8.00003C2 7.44774 2.44772 7.00003 3 7.00003H4.73378C4.98994 7.00003 5.21668 6.84835 5.42654 6.70145L8.42654 4.60145C9.08931 4.13751 10 4.61166 10 5.42068V14.5794C10 15.3884 9.08932 15.8625 8.42654 15.3986L5.42654 13.2986Z" fill="#9A9A9A"/>
<rect x="12.5" y="7.85718" width="1.21218" height="7.27311" rx="0.606092" transform="rotate(-45 12.5 7.85718)" fill="#9A9A9A"/>
<rect x="17.6428" y="7" width="1.21218" height="7.27311" rx="0.606092" transform="rotate(45 17.6428 7)" fill="#9A9A9A"/>
</svg>

Before

Width:  |  Height:  |  Size: 761 B

After

Width:  |  Height:  |  Size: 761 B

Before After
Before After

View file

@ -1,3 +1,3 @@
<svg shape-rendering="geometricPrecision" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 3C4.44772 3 4 3.44772 4 4V16C4 16.5523 4.44772 17 5 17H7C7.55228 17 8 16.5523 8 16V4C8 3.44772 7.55228 3 7 3H5ZM13 3C12.4477 3 12 3.44772 12 4V16C12 16.5523 12.4477 17 13 17H15C15.5523 17 16 16.5523 16 16V4C16 3.44772 15.5523 3 15 3H13Z" fill="#a09f92"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 3C4.44772 3 4 3.44772 4 4V16C4 16.5523 4.44772 17 5 17H7C7.55228 17 8 16.5523 8 16V4C8 3.44772 7.55228 3 7 3H5ZM13 3C12.4477 3 12 3.44772 12 4V16C12 16.5523 12.4477 17 13 17H15C15.5523 17 16 16.5523 16 16V4C16 3.44772 15.5523 3 15 3H13Z" fill="#9A9A9A"/>
</svg>

Before

Width:  |  Height:  |  Size: 447 B

After

Width:  |  Height:  |  Size: 447 B

Before After
Before After

View file

@ -1,3 +1,3 @@
<svg shape-rendering="geometricPrecision" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4 16.2143V3.79347C4 3.01115 4.85783 2.5318 5.5241 2.94181L15.6161 9.15225C16.2506 9.54273 16.2506 10.4651 15.6161 10.8556L5.5241 17.066C4.85783 17.476 4 16.9967 4 16.2143Z" fill="#a09f92"/>
<path d="M4 16.2143V3.79347C4 3.01115 4.85783 2.5318 5.5241 2.94181L15.6161 9.15225C16.2506 9.54273 16.2506 10.4651 15.6161 10.8556L5.5241 17.066C4.85783 17.476 4 16.9967 4 16.2143Z" fill="#9A9A9A"/>
</svg>

Before

Width:  |  Height:  |  Size: 340 B

After

Width:  |  Height:  |  Size: 340 B

Before After
Before After

View file

@ -1,4 +1,4 @@
<svg shape-rendering="geometricPrecision" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.0208 4.50971C15.7362 4.16672 15.2221 4.16893 14.9069 4.48397C14.5915 4.79922 14.5957 5.30793 14.8729 5.65723C15.8197 6.8502 16.3851 8.3592 16.3851 10.0002C16.3851 11.6412 15.8197 13.1502 14.8729 14.3432C14.5957 14.6925 14.5915 15.2012 14.9069 15.5165C15.2221 15.8315 15.7362 15.8337 16.0208 15.4907C17.2568 14.0006 17.9998 12.0871 17.9998 10.0002C17.9998 7.91329 17.2568 5.99983 16.0208 4.50971ZM12.2428 12.8536C12.5579 13.1686 13.0754 13.1718 13.3343 12.809C13.8996 12.0169 14.2322 11.0474 14.2322 10.0002C14.2322 8.95304 13.8996 7.98351 13.3343 7.1914C13.0754 6.82868 12.5579 6.83181 12.2428 7.14684C11.9274 7.46209 11.9383 7.97016 12.1662 8.35345C12.4529 8.83557 12.6175 9.39868 12.6175 10.0002C12.6175 10.6018 12.4529 11.1649 12.1662 11.647C11.9383 12.0303 11.9274 12.5383 12.2428 12.8536Z" fill="#a09f92"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.42654 13.2986C5.21668 13.1517 4.98994 13 4.73378 13H3C2.44771 13 2 12.5523 2 12V8.00003C2 7.44774 2.44772 7.00003 3 7.00003H4.73378C4.98994 7.00003 5.21668 6.84835 5.42654 6.70145L8.42654 4.60145C9.08931 4.13751 10 4.61166 10 5.42068V14.5794C10 15.3884 9.08932 15.8625 8.42654 15.3986L5.42654 13.2986Z" fill="#a09f92"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.0208 4.50971C15.7362 4.16672 15.2221 4.16893 14.9069 4.48397C14.5915 4.79922 14.5957 5.30793 14.8729 5.65723C15.8197 6.8502 16.3851 8.3592 16.3851 10.0002C16.3851 11.6412 15.8197 13.1502 14.8729 14.3432C14.5957 14.6925 14.5915 15.2012 14.9069 15.5165C15.2221 15.8315 15.7362 15.8337 16.0208 15.4907C17.2568 14.0006 17.9998 12.0871 17.9998 10.0002C17.9998 7.91329 17.2568 5.99983 16.0208 4.50971ZM12.2428 12.8536C12.5579 13.1686 13.0754 13.1718 13.3343 12.809C13.8996 12.0169 14.2322 11.0474 14.2322 10.0002C14.2322 8.95304 13.8996 7.98351 13.3343 7.1914C13.0754 6.82868 12.5579 6.83181 12.2428 7.14684C11.9274 7.46209 11.9383 7.97016 12.1662 8.35345C12.4529 8.83557 12.6175 9.39868 12.6175 10.0002C12.6175 10.6018 12.4529 11.1649 12.1662 11.647C11.9383 12.0303 11.9274 12.5383 12.2428 12.8536Z" fill="#9A9A9A"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.42654 13.2986C5.21668 13.1517 4.98994 13 4.73378 13H3C2.44771 13 2 12.5523 2 12V8.00003C2 7.44774 2.44772 7.00003 3 7.00003H4.73378C4.98994 7.00003 5.21668 6.84835 5.42654 6.70145L8.42654 4.60145C9.08931 4.13751 10 4.61166 10 5.42068V14.5794C10 15.3884 9.08932 15.8625 8.42654 15.3986L5.42654 13.2986Z" fill="#9A9A9A"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

View file

@ -6,6 +6,7 @@ export default {
appName: 'Anytype',
blankRouteId: '_blank_',
storeSpaceId: '_anytype_marketplace',
localLoversSpaceId: 'bafyreigyfkt6rbv24sbv5aq2hko3bhmv5xxlf22b4bypdu6j7hnphm3psq.23me69r569oi1',
anytypeProfileId: '_anytype_profile',
fontCode: 'plex',
popupPinIds: [ 'search' ],
@ -127,7 +128,6 @@ export default {
date: 'ot-date',
profile: 'ot-profile',
chat: 'ot-chat',
chatDerived: 'ot-chatDerived',
},
templateId: {

View file

@ -13,6 +13,21 @@ export default {
LIMIT_OF_ROWS_OR_RELATIONS_EXCEEDED: 7,
FILE_LOAD_ERROR: 8,
INSUFFICIENT_PERMISSIONS: 9,
Import: {
INTERNAL_ERROR: 3,
NOTION_NO_OBJECTS_IN_INTEGRATION: 5,
IMPORT_IS_CANCELED: 6,
CSV_LIMIT_OF_ROWS_OR_RELATIONS_EXCEEDED: 7,
FILE_LOAD_ERROR: 8,
INSUFFICIENT_PERMISSIONS: 9,
HTML_WRONG_HTML_STRUCTURE: 10,
PB_NOT_ANYBLOCK_FORMAT: 11,
NOTION_SERVER_IS_UNAVAILABLE: 12,
NOTION_RATE_LIMIT_EXCEEDED: 13,
FILE_IMPORT_NO_OBJECTS_IN_ZIP_ARCHIVE: 14,
FILE_IMPORT_NO_OBJECTS_IN_DIRECTORY: 17,
}
},
'Error: net::ERR_TIMED_OUT': 'Network time-out',

View file

@ -137,7 +137,7 @@ export default {
'targetSpaceId',
'creator',
'createdDate',
'spaceMainChatId'
'chatId',
],
participant: [

View file

@ -23,7 +23,6 @@
"commonHome": "Home",
"commonSubmit": "Submit",
"commonValue": "Value",
"commonProgress": "Processing...",
"commonArchived": "Object is in the bin",
"commonEmpty": "Empty",
"commonBack": "Back",
@ -168,7 +167,8 @@
"commonNothingFound": "Nothing found",
"commonEntrySpace": "My First Space",
"commonSystem": "System",
"commonMainChat": "Main сhat",
"commonProgress": "Progress",
"commonMainChat": "Chat",
"commonMenu": "Menu",
"pluralDay": "day|days",
@ -229,6 +229,7 @@
"electronMenuDebugTree": "Tree diagnostics",
"electronMenuDebugStat": "Statistics",
"electronMenuDebugReconcile": "Reconcile",
"electronMenuDebugNet": "Network",
"electronMenuClose": "Close Window",
"electronMenuEdit": "Edit",
"electronMenuUndo": "Undo",
@ -322,12 +323,13 @@
"viewName4": "Calendar",
"viewName5": "Graph",
"progress0": "Copying files %s\/%s",
"progress1": "Import in progress",
"progress2": "Export in progress",
"progress3": "Download in progress",
"progress4": "Recovering vault",
"progress5": "Migration in progress",
"progressDropFiles": "Copying files...",
"progressImport": "Import in progress...",
"progressExport": "Export in progress...",
"progressSaveFile": "Download in progress...",
"progressMigration": "Recovering vault...",
"progressRecoverAccount": "Migration in progress...",
"progressUpdateCheck": "Checking for update...",
"spellcheckAdd": "Add to dictionary",
@ -1072,8 +1074,8 @@
"popupConfirmOpenExternalLinkTitle": "Are you sure?",
"popupConfirmOpenExternalLinkText": "You are trying to open url that is potentially harmful. Are you sure you want to proceed?",
"popupConfirmChatDeleteMessageTitle": "Delete message",
"popupConfirmChatDeleteMessageText": "Are you sure you want to delete this message?",
"popupConfirmChatDeleteMessageTitle": "Delete this message?",
"popupConfirmChatDeleteMessageText": "It cannot be restored after confirmation",
"popupInviteRequestTitle": "Join a space",
"popupInviteRequestText": "You've been invited to join <b>%s</b> space, created by <b>%s</b>. Send a request so space owner can let you in.",
@ -1514,6 +1516,7 @@
"menuHelpTutorial": "Help and Tutorials",
"menuHelpContact": "Contact Us",
"menuHelpTech": "Technical Information",
"menuHelpNet": "Network Information",
"menuHelpTerms": "Terms of Use",
"menuHelpPrivacy": "Privacy Policy",
"menuHelpGallery": "ANY Experience Gallery",
@ -1760,7 +1763,6 @@
"widgetRecentOpen": "Recently opened",
"widgetSet": "Sets",
"widgetCollection": "Collections",
"widgetChat": "Chats",
"widgetEdit": "Edit widgets",
"widgetAdd": "Add widget",
"widgetLibrary": "Library",
@ -1918,6 +1920,7 @@
"libKeyboardAnalyticsId": "Analytics ID",
"libKeyboardDeviceId": "Device ID",
"libKeyboardTechInformation": "Tech information",
"libKeyboardNetInformation": "Network information",
"libRelationSmall": "Small",
"libRelationMedium": "Medium",
@ -2135,16 +2138,18 @@
"notificationGalleryErrorTitle": "Something went wrong",
"notificationGalleryErrorText": "Oops! <b>'%s'</b> wasn't installed. Please check your Internet connection and try again or post a report in our community.",
"notificationImportErrorTitle5": "No Items to Import",
"notificationImportErrorText5": "There are no items to import. Please check your file type or Import selection and try again.",
"notificationImportErrorTitle6": "Import Canceled",
"notificationImportErrorText6": "The import has been canceled.",
"notificationImportErrorTitle7": "Import Limit Exceeded",
"notificationImportErrorText7": "The file exceeds the import limit of 1,000 rows or 10 columns. Please adjust your file and try again.",
"notificationImportErrorTitle8": "File Load Error",
"notificationImportErrorText8": "We couldnt load your files. Please check your files and try again, or manually transfer the files.",
"notificationImportErrorTitle9": "Permission Denied",
"notificationImportErrorText3": "Internal error during import. Please report it to Anytype devs using Help -> Report a Bug. We will check.",
"notificationImportErrorText5": "No objects found in the provided Notion integration. Open Notion and check that you have added the integration to the pages you want to export. Check our FAQ for more details.",
"notificationImportErrorText6": "The import was canceled by the user.",
"notificationImportErrorText7": "The number of lines of the CSV file exceeds 1000. Try splitting the file into smaller parts.",
"notificationImportErrorText8": "Error when uploading a file. Check if you have enough space and try again.",
"notificationImportErrorText9": "We dont have permission to import into this Anytype space.",
"notificationImportErrorText10": "An error occurred during HTML rendering. Check the format of your HTML file.",
"notificationImportErrorText11": "The imported AnyBlock file has an unsupported format. It may have been exported from an old or unsupported version of Anytype. Update it and try exporting again.",
"notificationImportErrorText12": "Notion API returned an internal error. Most likely something is broken on the Notion side. Try running the import again later.",
"notificationImportErrorText13": "Notion API returned an exceeded limits error. Wait a few minutes and try running the import again.",
"notificationImportErrorText14": "No objects of the required format were found in the imported archive. Make sure you have selected the correct import format, such as HTML or Markdown",
"notificationImportErrorText17": "No objects of the required format were found in the imported folder. Make sure you have selected the correct file format, such as HTML or Markdown",
"notificationJoinSuccessText": "<b>%s</b> has requested to join <b>'%s'</b> space",

View file

@ -15,7 +15,7 @@
background: var(--color-shape-tertiary);
}
.head {
.side.left { flex-grow: 1; display: flex; align-items: center; gap: 0px 8px; }
.side.left { flex-grow: 1; display: flex; align-items: center; gap: 0px 8px; overflow: hidden; }
.side.left {
.icon,
.iconObject { flex-shrink: 0; width: 32px; height: 32px; }

View file

@ -2,6 +2,17 @@
.blocks {
.block.blockDataview {
.rowHead, #rowHeadClone { display: grid; white-space: nowrap; height: 36px; }
.rowHead { width: calc(100% - 4px); margin-left: 2px; }
.rowHead.fixed { opacity: 0; visibility: hidden; pointer-events: none; }
#rowHeadClone { position: fixed !important; background: var(--color-bg-primary); z-index: 1; }
#rowHeadClone::after { content: ''; height: 1px; width: 100%; background: var(--color-shape-secondary); position: absolute; bottom: -1px; }
#rowHeadClone {
.rowHead { margin: 0px; width: 100%; }
}
.cellHead {
@include text-small; text-align: left; color: var(--color-text-secondary); font-weight: 400; line-height: 20px; position: relative; height: 38px;
display: inline-block; vertical-align: top; transition: background-color $transitionCommon;
@ -45,20 +56,18 @@
.resize { display: none; }
}
.cellHead.cellKeyHover::after, .cellHead.active::after {
.cellHead.cellKeyHover::after, .cellHead.hover::after {
content: ""; display: block; width: 100%; height: 100%; position: absolute; left: 0px; top: 0px; z-index: 0; pointer-events: none;
background-color: var(--color-shape-highlight-light);
}
.cellHead.last::after, .cellHead.active::after { background: none; }
.cellHead.last:hover, .cellHead.last.active {
.cellHead.last::after, .cellHead.hover::after { background: none; }
.cellHead.last:hover, .cellHead.last.hover {
.icon.plus { background-image: url('~img/icon/plus/menu1.svg'); }
}
.viewContent.viewGrid { width: 100%; position: relative; padding: 0px 0px 80px 0px; }
.viewContent.viewGrid {
.rowHead { display: grid; white-space: nowrap; width: calc(100% - 4px); margin-left: 2px; height: 36px; }
.loadMore { padding: 10px 2px; box-shadow: 0px 1px var(--color-shape-secondary) inset; }
.icon.checkbox { vertical-align: top; }

View file

@ -66,7 +66,7 @@
}
.cellContent.c-object {
.iconObject { display: inline-block; vertical-align: middle; margin: -1px 6px 0px 0px !important; }
.iconObject { display: inline-block; vertical-align: top; margin: 2px 6px 0px 0px !important; }
}
.cellContent.c-checkbox {

View file

@ -152,29 +152,22 @@
/* Human */
.editorWrapper.isHuman.withIcon,
.editorWrapper.isParticipant.withIcon
{
.blocks { margin-top: -94px; }
.editorControls { height: 164px; }
}
.editorWrapper.isHuman,
.editorWrapper.isParticipant {
&.withIcon {
.blocks { margin-top: -94px; }
.editorControls { height: 164px; }
}
.editorWrapper.isHuman.withIcon,
.editorWrapper.isHuman.withIconAndCover,
.editorWrapper.isParticipant.withIcon,
.editorWrapper.isParticipant.withIconAndCover
{
.controlButtons { left: 144px !important; }
}
&.withIcon,
&.withIconAndCover {
.controlButtons { left: 144px !important; }
}
.editorWrapper.isHuman.withIconAndCover,
.editorWrapper.isParticipant.withIconAndCover
{ padding-top: 214px; }
.editorWrapper.isHuman.withIconAndCover,
.editorWrapper.isParticipant.withIconAndCover
{
.controlButtons { bottom: 26px; }
&.withIconAndCover { padding-top: 214px; }
&.withIconAndCover {
.controlButtons { bottom: 26px; }
}
}
.editorWrapper.align1,
@ -216,8 +209,10 @@
}
}
.editorWrapper.isChat.withIcon {
.controlButtons { left: 0px; }
.editorWrapper.isChat {
&.withIcon {
.controlButtons { left: 0px; }
}
}
/* Set, Collection, Date */
@ -245,35 +240,32 @@
}
}
.editorWrapper.isSet.withIcon,
.editorWrapper.isCollection.withIcon {
.controlButtons { left: 14px; }
}
.editorWrapper.isSet.withIconAndCover,
.editorWrapper.isCollection.withIconAndCover,
.editorWrapper.isChat.withIconAndCover { padding-top: 356px; }
.editorWrapper.isSet.withIconAndCover,
.editorWrapper.isCollection.withIconAndCover,
.editorWrapper.isChat.withIconAndCover {
.controlButtons { left: 0px !important; }
}
.editorWrapper.isSet.withIcon,
.editorWrapper.isSet.withIconAndCover,
.editorWrapper.isCollection.withIcon,
.editorWrapper.isCollection.withIconAndCover {
.headSimple {
.side.left { width: 96px; }
.side.center { width: calc(100% - 128px); }
.editorWrapper.isSet,
.editorWrapper.isCollection {
&.withIcon {
.controlButtons { left: 14px; }
}
&.withIcon,
&.withIconAndCover {
.headSimple {
.side.left { width: 96px; }
.side.center { width: calc(100% - 128px); }
}
#button-icon { display: none; }
}
&.withCover,
&.withIconAndCover {
.editorControls { display: none; }
}
#button-icon { display: none; }
}
.editorWrapper.isSet.withCover,
.editorWrapper.isSet.withIconAndCover,
.editorWrapper.isCollection.withCover,
.editorWrapper.isCollection.withIconAndCover {
.editorControls { display: none; }
.editorWrapper.isSet,
.editorWrapper.isCollection,
.editorWrapper.isChat {
&.withIconAndCover { padding-top: 356px; }
&.withIconAndCover {
.controlButtons { left: 0px !important; }
}
}

View file

@ -13,7 +13,9 @@
a { text-decoration: none; color: unset; }
}
.iconWrap { width: 36px; height: 36px; position: relative; z-index: 10; position: absolute; bottom: 14px; }
.buttons { z-index: 10; position: absolute; bottom: 14px; right: 14px; display: flex; flex-direction: row; gap: 0px 8px; align-items: center; }
.iconWrap { width: 36px; height: 36px; position: relative; }
.iconWrap {
.bg {
background-color: var(--color-bg-primary); border: 1px solid var(--color-shape-secondary); border-radius: 50%; width: 100%; height: 100%;
@ -23,10 +25,17 @@
}
.iconWrap:hover .bg { transform: scale(0.95); }
#button-help { right: 14px; }
#button-help {
.icon { background-image: url('~img/icon/footer/help.svg'); }
}
#button-progress {
.inner {
position: absolute; left: 3px; top: 3px; width: calc(100% - 6px); height: calc(100% - 6px); background-color: var(--color-bg-primary);
z-index: 1; border-radius: 50%; @include text-small; font-weight: 500; color: var(--color-text-secondary); display: flex; text-align: center;
align-items: center; justify-content: center;
}
}
}
.footer.mainGraph { display: block !important; position: absolute; }

View file

@ -9,9 +9,7 @@
.controls { display: flex; align-items: center; column-gap: 10px; }
@container media-audio (max-width: 500px) {
.controls { column-gap: 5px; };
}
@container media-audio (max-width: 208px) { .controls { column-gap: 5px; }}
.controls {
div { flex: 0 1 auto; }
@ -28,7 +26,7 @@
.icon.volume.muted { background-image: url('~img/icon/audio/mute.svg'); }
.time { @include text-small; text-wrap: nowrap; width: 36px; text-align: center; }
@container media-audio (max-width: 500px) { .time { display: none; }}
@container media-audio (max-width: 208px) { .time { display: none; }}
.input-drag-horizontal { display: inline-block; vertical-align: top; height: 20px; }
.input-drag-horizontal {

View file

@ -1,32 +1,52 @@
@import "~scss/_mixins";
.progress {
position: fixed; left: 0px; top: 0px; z-index: 110; width: 100%; height: 100%; background: rgba(0,0,0,0.4);
transition: background 0.05s ease-in-out; user-select: none;
}
.progress.isUnlocked { background: none; pointer-events: none; }
.progress.isUnlocked {
.inner { top: auto; left: 10px; top: 40px; margin: 0px; }
}
.progress { position: fixed; left: 0px; top: 0px; z-index: 110; width: 100%; height: 100%; pointer-events: none; user-select: none; }
.progress {
.inner {
position: absolute; left: 50%; top: 50%; box-shadow: 0px 6px 24px rgba(0, 0, 0, 0.2); height: 72px; width: 384px; cursor: grab;
border-radius: 12px; text-align: center; background: var(--color-bg-primary); overflow: hidden; margin: -36px 0px 0px -192px; padding: 12px 16px;
transition-property: opacity, transform; transition-duration: 0.05s; transition-timing-function: ease-in-out; pointer-events: all;
position: absolute; box-shadow: 0px 6px 24px rgba(0, 0, 0, 0.2); cursor: grab; width: 288px; border-radius: 12px; text-align: center;
background: var(--color-bg-primary); overflow: hidden; transition-property: opacity, transform; transition-duration: 0.05s;
transition-timing-function: ease-in-out; pointer-events: all; display: flex; flex-direction: column; bottom: 56px; right: 56px;
}
.inner {
.label { position: absolute; left: 16px; top: 12px; z-index: 1; color: var(--color-text-primary); white-space: nowrap; @include text-paragraph; }
.bar { width: calc(100% - 32px); height: 8px; background: var(--color-shape-tertiary); overflow: hidden; border-radius: 8px; position: absolute; bottom: 16px; left: 16px; }
.fill { position: absolute; left: 0px; top: 0px; height: 100%; background: var(--color-control-accent); transition: width 0.2s linear; }
.titleWrap { font-weight: 600; display: flex; gap: 0px 6px; padding: 11px 16px 3px 16px; }
.titleWrap {
.label.percent { font-weight: 400; color: var(--color-text-secondary); }
}
.icon.close {
width: 24px; height: 24px; position: absolute; top: 14px; right: 14px; background-image: url('~img/icon/progress/close.svg');
cursor: default; background-size: 20px; border-radius: 4px;
.item {
padding: 8px 16px; position: relative; border-bottom: 1px solid var(--color-shape-secondary); gap: 4px 0px; display: flex;
flex-direction: column;
}
.icon.close:hover { background-color: var(--color-shape-highlight-medium); }
.item {
.nameWrap { display: flex; flex-direction: row; gap: 0px 6px; justify-content: space-between; align-items: center; }
.nameWrap {
.label { color: var(--color-text-primary); @include text-overflow-nw; @include text-common; line-height: 28px; }
.icon.close { width: 20px; height: 20px; background-image: url('~img/icon/progress/close.svg'); cursor: default; flex-shrink: 0; opacity: 0; }
}
.bar { width: 100%; height: 4px; background: var(--color-shape-secondary); overflow: hidden; border-radius: 8px; position: relative; }
.fill { position: absolute; left: 0px; top: 0px; height: 100%; background: var(--color-system-accent-25); transition: width 0.2s linear; }
.fill::after {
content: ''; width: 100%; height: 100%; position: absolute; left: 0px; top: 0px;
background-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, var(--color-system-accent-50) 50%, rgba(0,0,0,0) 100%);
animation: animateGradient 2s linear infinite;
}
@keyframes animateGradient {
0% { opacity: 1; transform: translateX(-100%); }
50% { transform: translateX(100%); }
50.01% { opacity: 0; }
100% { opacity: 0; }
}
}
.item:hover {
.nameWrap {
.icon.close { opacity: 1; }
}
}
.item:last-child { border-bottom: 0px; }
}
.progress.hide { background: rgba(0,0,0,0); }

View file

@ -8,7 +8,10 @@
gap: 0px 8px; overflow: hidden;
}
> .head {
.name { @include text-overflow-nw; opacity: 0; transform: translate3d(0px,30px,0px); transition: all 0.2s $easeInQuint; }
.name {
@include text-overflow-nw; opacity: 0; transform: translate3d(0px,30px,0px); transition: all 0.2s $easeInQuint;
max-width: calc(100% - 88px);
}
}
> .head.show {
.name { opacity: 1; transform: translate3d(0px,0px,0px); }

View file

@ -1,16 +1,14 @@
@import "~scss/_mixins";
.input-drag-vertical { padding: 8px 2px; width: 20px; height: 88px; border-radius: 8px; background-color: var(--color-control-bg); box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.2); }
.input-drag-vertical { padding: 8px 2px; width: 20px; height: 88px; border-radius: 8px; background-color: var(--color-bg-primary); box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.2); border: 1px solid var(--color-shape-secondary); }
.input-drag-vertical {
.vertical-range,
.vertical-range::-webkit-slider-runnable-track,
.vertical-range::-webkit-slider-thumb { -webkit-appearance: none; }
.vertical-range { position: absolute; width: 14px; height: 72px; cursor: pointer; writing-mode: vertical-lr; padding: unset; }
.vertical-range::-webkit-slider-runnable-track { height: 100%; width: 10px;
background: linear-gradient(180deg, var(--color-control-accent) 0%, var(--color-control-accent) var(--background-size, 0%),
var(--color-control-inactive) var(--background-size, 0%), var(--color-control-inactive) 100%);;
transform: scaleY(-1); /* Flips the background vertically */
background-size: 4px 100%; background-repeat: no-repeat; border-radius: 2px; background-position: 4px 0px; }
.vertical-range { position: absolute; width: 14px; height: 72px; cursor: pointer; writing-mode: vertical-rl; padding: unset; cursor: auto; }
.vertical-range::-webkit-slider-runnable-track { height: 100%; width: 10px; }
.vertical-range::-webkit-slider-thumb { width: 0px; height: 0px; background: transparent; border: none; }
.slider-track { pointer-events: none; position: absolute; left: 8px; bottom: 8px; background-color: var(--color-control-accent); width: 4px; border-radius: 2px; }
.slider-bg { pointer-events: none; position: absolute; left: 8px; bottom: 8px; background-color: var(--color-shape-secondary); width: 4px; border-radius: 2px; height: 72px; }
}

View file

@ -44,7 +44,7 @@
}
.popup.popupConfirm.isWide {
.innerWrap { width: 640px; }
.innerWrap { width: 640px; max-height: 640px; }
}
.popup.popupConfirm.shareMoreInfo {

View file

@ -734,7 +734,7 @@
span { font-weight: 600; text-decoration: underline; }
}
.swiper { margin: 0px -31px 8px -31px; }
.swiper { margin: 0px -31px 8px -31px; flex-shrink: 0; }
.swiper {
.swiper-wrapper { margin-bottom: 10px; }
.swiper-slide { width: calc(100% - 64px); min-width: 396px; }

View file

@ -170,6 +170,8 @@ html.themeDark {
}
.inputWithFile { border-color: transparent; background-color: var(--color-shape-highlight-medium); }
.input-drag-vertical { background-color: var(--color-bg-secondary); }
.input-drag-horizontal {
.fill { background: var(--color-text-primary); }
.icon { border-color: var(--color-text-secondary); }

View file

@ -75,3 +75,7 @@
}
}
}
.button.widget {
.icon.bin { background-image: url('#{$themePath}/icon/widget/button/bin.svg'); }
}

View file

@ -257,7 +257,7 @@ class App extends React.Component<object, State> {
Renderer.on('update-available', this.onUpdateAvailable);
Renderer.on('update-confirm', this.onUpdateConfirm);
Renderer.on('update-not-available', this.onUpdateUnavailable);
Renderer.on('update-downloaded', () => S.Common.progressClear());
Renderer.on('update-downloaded', () => S.Progress.delete('update'));
Renderer.on('update-error', this.onUpdateError);
Renderer.on('download-progress', this.onUpdateProgress);
Renderer.on('spellcheck', this.onSpellcheck);
@ -422,12 +422,12 @@ class App extends React.Component<object, State> {
onUpdateCheck (e: any, auto: boolean) {
if (!auto) {
S.Common.progressSet({ status: translate('progressUpdateCheck'), current: 0, total: 1, isUnlocked: true });
S.Progress.add({ id: I.ProgressType.UpdateCheck, type: I.ProgressType.UpdateCheck, current: 0, total: 1 });
};
};
onUpdateConfirm (e: any, auto: boolean) {
S.Common.progressClear();
S.Progress.delete(I.ProgressType.UpdateCheck);
Storage.setHighlight('whatsNew', true);
if (auto) {
@ -453,7 +453,7 @@ class App extends React.Component<object, State> {
};
onUpdateAvailable (e: any, auto: boolean) {
S.Common.progressClear();
S.Progress.delete(I.ProgressType.UpdateCheck);
if (auto) {
return;
@ -478,7 +478,7 @@ class App extends React.Component<object, State> {
};
onUpdateUnavailable (e: any, auto: boolean) {
S.Common.progressClear();
S.Progress.delete(I.ProgressType.UpdateCheck);
if (auto) {
return;
@ -499,7 +499,7 @@ class App extends React.Component<object, State> {
onUpdateError (e: any, err: string, auto: boolean) {
console.error(err);
S.Common.progressClear();
S.Progress.delete(I.ProgressType.UpdateCheck);
if (auto) {
return;
@ -524,11 +524,11 @@ class App extends React.Component<object, State> {
};
onUpdateProgress (e: any, progress: any) {
S.Common.progressSet({
status: U.Common.sprintf(translate('commonUpdateProgress'), U.File.size(progress.transferred), U.File.size(progress.total)),
S.Progress.update({
id: I.ProgressType.Update,
type: I.ProgressType.Update,
current: progress.transferred,
total: progress.total,
isUnlocked: true,
});
};

View file

@ -209,6 +209,10 @@ const BlockChat = observer(class BlockChat extends React.Component<I.BlockCompon
const rootId = this.getRootId();
const list = this.getMessages();
if (!rootId) {
return;
};
if (clear) {
C.ChatSubscribeLastMessages(rootId, J.Constant.limit.chat.messages, (message: any) => {
if (!message.error.code) {
@ -328,7 +332,7 @@ const BlockChat = observer(class BlockChat extends React.Component<I.BlockCompon
const { rootId } = this.props;
const object = S.Detail.get(rootId, rootId, [ 'chatId' ]);
return object.chatId || rootId;
return object.chatId;
};
getBlockId () {

View file

@ -216,8 +216,8 @@ const ChatButtons = observer(class ChatButtons extends React.Component<Props, St
{ type: I.MarkType.Underline, icon: 'underline', name: translate('commonUnderline'), caption: `${cmd} + U` },
{ type: I.MarkType.Link, icon: 'link', name: translate('commonLink'), caption: `${cmd} + K` },
{ type: I.MarkType.Code, icon: 'kbd', name: translate('commonCode'), caption: `${cmd} + L` },
{ type: I.MarkType.Color, icon: 'color', name: translate('commonColor'), caption: `${cmd} + Shift + C`, inner: color },
{ type: I.MarkType.BgColor, icon: 'color', name: translate('commonBackground'), caption: `${cmd} + Shift + H`, inner: background },
//{ type: I.MarkType.Color, icon: 'color', name: translate('commonColor'), caption: `${cmd} + Shift + C`, inner: color },
//{ type: I.MarkType.BgColor, icon: 'color', name: translate('commonBackground'), caption: `${cmd} + Shift + H`, inner: background },
].map((it: any) => {
it.isActive = false;
if (it.type == I.MarkType.Link) {
@ -248,8 +248,8 @@ const ChatButtons = observer(class ChatButtons extends React.Component<Props, St
});
};
let data;
let menuItem;
let menuId = '';
let data: any = {};
if (menu) {
if (menu == 'upload') {
@ -257,7 +257,7 @@ const ChatButtons = observer(class ChatButtons extends React.Component<Props, St
return;
};
menuItem = 'searchObject';
menuId = 'searchObject';
data = {
skipIds: attachments.map(it => it.id),
filters: [
@ -268,6 +268,9 @@ const ChatButtons = observer(class ChatButtons extends React.Component<Props, St
}
};
if (menu == 'object') {
data.filters.push({ relationKey: 'layout', condition: I.FilterCondition.NotIn, value: U.Object.getFileLayouts() });
} else
if ([ 'file', 'media' ].includes(menu)) {
const layouts = {
media: [ I.ObjectLayout.Image, I.ObjectLayout.Audio, I.ObjectLayout.Video ],
@ -285,9 +288,9 @@ const ChatButtons = observer(class ChatButtons extends React.Component<Props, St
});
};
} else {
menuItem = 'select';
menuId = 'select';
data = {
options: options,
options,
onSelect: (e: React.MouseEvent, option: any) => {
this.onAttachment(option.id);
}
@ -295,7 +298,7 @@ const ChatButtons = observer(class ChatButtons extends React.Component<Props, St
};
S.Menu.closeAll(null, () => {
S.Menu.open(menuItem, {
S.Menu.open(menuId, {
element: `#block-${blockId} #button-${blockId}-${I.ChatButton.Object}`,
className: 'chatAttachment',
offsetY: -8,

View file

@ -712,6 +712,7 @@ const ChatForm = observer(class ChatForm extends React.Component<Props, State> {
this.marks = [];
this.updateMarkup('', 0, 0);
this.setState({ attachments: [] }, () => this.refEditable.setRange(this.range));
this.refButtons.setButtons();
};
onReply (message: I.ChatMessage) {
@ -741,7 +742,7 @@ const ChatForm = observer(class ChatForm extends React.Component<Props, State> {
bgColor: 'red',
title: translate('popupConfirmChatDeleteMessageTitle'),
text: translate('popupConfirmChatDeleteMessageText'),
textConfirm: translate('commonYes'),
textConfirm: translate('commonDelete'),
onConfirm: () => {
C.ChatDeleteMessage(rootId, id, () => {
if (this.editingId == id) {

View file

@ -56,6 +56,7 @@ const ChatMessage = observer(class ChatMessage extends React.Component<Props> {
let reply = null;
if (replyToMessageId) {
const replyToMessage = S.Chat.getReply(rootId, replyToMessageId);
if (replyToMessage) {
const { text, attachment, isMultiple } = getReplyContent(replyToMessage);
const author = U.Space.getParticipant(U.Space.getParticipantId(space, replyToMessage.creator));
@ -85,7 +86,8 @@ const ChatMessage = observer(class ChatMessage extends React.Component<Props> {
};
};
let text = U.Common.sanitize(U.Common.lbBr(Mark.toHtml(content.text, content.marks)));
let text = content.text.replace(/\r?\n$/, '');
text = U.Common.sanitize(U.Common.lbBr(Mark.toHtml(text, content.marks)));
if (modifiedAt) {
const cnl = [ 'label', 'small' ];

View file

@ -923,7 +923,7 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
};
if (!view.isGrid() && Relation.isUrl(relation.format)) {
Action.openUrl(Relation.getUrlScheme(relation.format, record[relationKey]) + record[relationKey]);
Action.openUrl(Relation.checkUrlScheme(relation.format, record[relationKey]));
return;
};

View file

@ -187,7 +187,7 @@ const Cell = observer(class Cell extends React.Component<Props> {
if (!canEdit) {
if (Relation.isUrl(relation.format) && value) {
Action.openUrl(Relation.getUrlScheme(relation.format, value) + value);
Action.openUrl(Relation.checkUrlScheme(relation.format, value));
return;
};
@ -380,8 +380,7 @@ const Cell = observer(class Cell extends React.Component<Props> {
});
if (e.shiftKey && value) {
const scheme = Relation.getUrlScheme(relation.format, value);
Action.openUrl(scheme + value);
Action.openUrl(Relation.checkUrlScheme(relation.format, value));
ret = true;
break;
@ -409,11 +408,9 @@ const Cell = observer(class Cell extends React.Component<Props> {
return;
};
const scheme = Relation.getUrlScheme(relation.format, value);
switch (item.id) {
case 'go': {
Action.openUrl(scheme + value);
Action.openUrl(Relation.checkUrlScheme(relation.format, value));
analytics.event('RelationUrlOpen');
break;
};

View file

@ -1,10 +1,11 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import $ from 'jquery';
import arrayMove from 'array-move';
import { observer } from 'mobx-react';
import { AutoSizer, WindowScroller, List, InfiniteLoader } from 'react-virtualized';
import { Icon, LoadMore } from 'Component';
import { I, C, S, U, J, translate, keyboard, Relation, sidebar } from 'Lib';
import { I, C, S, U, J, translate, keyboard, Relation } from 'Lib';
import HeadRow from './grid/head/row';
import BodyRow from './grid/body/row';
@ -23,7 +24,6 @@ const ViewGrid = observer(class ViewGrid extends React.Component<I.ViewComponent
this.onResizeStart = this.onResizeStart.bind(this);
this.onSortStart = this.onSortStart.bind(this);
this.onSortEnd = this.onSortEnd.bind(this);
this.onScroll = this.onScroll.bind(this);
this.loadMoreRows = this.loadMoreRows.bind(this);
this.getColumnWidths = this.getColumnWidths.bind(this);
};
@ -152,7 +152,8 @@ const ViewGrid = observer(class ViewGrid extends React.Component<I.ViewComponent
componentDidUpdate () {
this.rebind();
this.resize();
this.onScroll();
this.onScrollHorizontal();
this.onScrollVertical();
U.Common.triggerResizeEditor(this.props.isPopup);
};
@ -162,21 +163,96 @@ const ViewGrid = observer(class ViewGrid extends React.Component<I.ViewComponent
};
rebind () {
const { isPopup, block } = this.props;
const node = $(this.node);
const scroll = node.find('#scroll');
const container = U.Common.getScrollContainer(isPopup);
this.unbind();
node.find('#scroll').on('scroll', () => this.onScroll());
scroll.on('scroll', () => this.onScrollHorizontal());
container.off(`scroll.${block.id}`).on(`scroll.${block.id}`, () => this.onScrollVertical());
};
unbind () {
const { isPopup, block } = this.props;
const node = $(this.node);
const scroll = node.find('#scroll');
const container = U.Common.getScrollContainer(isPopup);
node.find('#scroll').off('scroll');
scroll.off('scroll');
container.off(`scroll.${block.id}`);
};
onScroll () {
onScrollHorizontal () {
S.Menu.resizeAll();
this.resizeColumns('', 0);
const { isInline } = this.props;
if (isInline) {
return;
};
const node = $(this.node);
const clone = node.find('#rowHeadClone');
if (clone.length) {
const scroll = node.find('#scroll');
clone.css({ transform: `translate3d(${-scroll.scrollLeft()}px,0px,0px)` });
};
};
onScrollVertical () {
const { isPopup, isInline } = this.props;
if (isInline) {
return;
};
const container = U.Common.getScrollContainer(isPopup);
const node = $(this.node);
const rowHead = node.find('#rowHead');
if (!rowHead.length) {
return;
};
const scroll = node.find('#scroll');
const hh = J.Size.header;
const st = container.scrollTop();
const { left, top } = rowHead.offset();
const sl = scroll.scrollLeft();
rowHead.removeClass('fixed');
node.find('#rowHeadClone').remove();
if (top - st <= hh) {
const clone = $('<div id="rowHeadClone"></div>');
node.append(clone);
ReactDOM.render((
<HeadRow
{...this.props}
onCellAdd={this.onCellAdd}
onSortStart={this.onSortStart}
onSortEnd={this.onSortEnd}
onResizeStart={this.onResizeStart}
getColumnWidths={this.getColumnWidths}
/>
), clone.get(0));
clone.find('.rowHead').attr({ id: '' });
clone.css({
left: left + sl,
top: hh,
width: rowHead.width(),
transform: `translate3d(${-sl}px,0px,0px)`
});
rowHead.addClass('fixed');
};
};
resizeColumns (relationKey: string, width: number) {
@ -303,11 +379,15 @@ const ViewGrid = observer(class ViewGrid extends React.Component<I.ViewComponent
onCellAdd (e: any) {
const { rootId, block, readonly, loadData, getView, isInline, isCollection } = this.props;
const blockEl = `#block-${block.id}`;
const cellLast = $(`${blockEl} .cellHead.last`);
S.Menu.open('dataviewRelationList', {
element: `#block-${block.id} #cell-add`,
element: `${blockEl} #cell-add`,
horizontal: I.MenuDirection.Center,
offsetY: 10,
onOpen: () => cellLast.addClass('hover'),
onClose: () => cellLast.removeClass('hover'),
data: {
readonly,
loadData,

View file

@ -78,7 +78,11 @@ const HeadCell = observer(class HeadCell extends React.Component<Props> {
return;
};
const element = `#block-${block.id} #${Relation.cellId('head', relationKey, '')}`;
const blockEl = `#block-${block.id}`;
const rowHead = $(`${blockEl} #rowHead`);
const isFixed = rowHead.hasClass('fixed');
const headEl = isFixed ? `#rowHeadClone` : `#rowHead`;
const element = `${blockEl} ${headEl} #${Relation.cellId('head', relationKey, '')}`;
const obj = $(element);
window.setTimeout(() => {
@ -88,6 +92,7 @@ const HeadCell = observer(class HeadCell extends React.Component<Props> {
noFlipY: true,
onOpen: () => obj.addClass('active'),
onClose: () => obj.removeClass('active'),
className: isFixed ? 'fixed' : '',
data: {
...this.props,
blockId: block.id,

View file

@ -25,6 +25,7 @@ const HeadRow = observer(class HeadRow extends React.Component<Props> {
const Row = SortableContainer((item: any) => (
<div
id="rowHead"
className="rowHead"
style={{ gridTemplateColumns: str }}
>

View file

@ -223,7 +223,7 @@ const Block = observer(class Block extends React.Component<Props> {
};
case I.BlockType.Chat: {
canDrop = canSelect = !U.Object.isChatLayout(root.layout);
canDrop = canSelect = false;
blockComponent = (
<BlockChat
key={key}

View file

@ -507,7 +507,7 @@ const BlockText = observer(class BlockText extends React.Component<Props> {
if (block.isText() && !block.isTextCode() && pressed.match('shift')) {
pd = false;
};
if (block.isTextCallout()) {
if (block.isTextCallout() || block.isTextQuote()) {
pd = true;
};

View file

@ -1389,7 +1389,7 @@ const EditorPage = observer(class EditorPage extends React.Component<Props, Stat
if (!block.isText() && keyboard.isFocused) {
return;
};
if (block.isText() && !(block.isTextCode() || block.isTextCallout()) && isShift) {
if (block.isText() && !(block.isTextCode() || block.isTextCallout() || block.isTextQuote()) && isShift) {
return;
};
@ -2083,6 +2083,7 @@ const EditorPage = observer(class EditorPage extends React.Component<Props, Stat
const isTitle = focused.isTextTitle();
const isToggle = focused.isTextToggle();
const isCallout = focused.isTextCallout();
const isQuote = focused.isTextQuote();
const isList = focused.isTextList();
const isCode = focused.isTextCode();
const isOpen = Storage.checkToggle(rootId, focused.id);
@ -2108,7 +2109,7 @@ const EditorPage = observer(class EditorPage extends React.Component<Props, Stat
mode = I.BlockSplitMode.Top;
};
if (isCallout && !isShift) {
if ((isCallout || isQuote) && !isShift) {
mode = I.BlockSplitMode.Inner;
style = I.TextStyle.Paragraph;
};

View file

@ -1,22 +1,48 @@
import * as React from 'react';
import { observer } from 'mobx-react';
import { PieChart } from 'react-minimal-pie-chart';
import { Icon } from 'Component';
import { I, Preview, translate } from 'Lib';
import { I, S, Preview, translate } from 'Lib';
const FooterMainEdit = class FooterMainEdit extends React.Component<I.FooterComponent> {
const FooterMainEdit = observer(class FooterMainEdit extends React.Component<I.FooterComponent> {
render () {
const { onHelp } = this.props;
const { show } = S.Progress;
const current = S.Progress.getCurrent();
const total = S.Progress.getTotal();
const percent = Math.round((current / total) * 100);
return (
<div
id="button-help"
className="iconWrap"
onClick={onHelp}
onMouseEnter={e => this.onTooltipShow(e, translate('commonHelp'))}
onMouseLeave={() => Preview.tooltipHide(false)}
>
<Icon />
<div className="bg" />
<div className="buttons">
{total ? (
<div
id="button-progress"
className="iconWrap"
onClick={() => S.Progress.showSet(!show)}
>
<div className="inner">{percent}</div>
<PieChart
totalValue={100}
startAngle={270}
lengthAngle={-360}
data={[
{ title: '', value: 100 - percent, color: '#ebebeb' },
{ title: '', value: percent, color: '#ffd15b' },
]}
/>
</div>
) : ''}
<div
id="button-help"
className="iconWrap"
onClick={onHelp}
onMouseEnter={e => this.onTooltipShow(e, translate('commonHelp'))}
onMouseLeave={() => Preview.tooltipHide(false)}
>
<Icon />
<div className="bg" />
</div>
</div>
);
};
@ -28,6 +54,6 @@ const FooterMainEdit = class FooterMainEdit extends React.Component<I.FooterComp
};
};
};
});
export default FooterMainEdit;

View file

@ -1,5 +1,5 @@
import * as React from 'react';
import { useEffect, useImperativeHandle, useRef } from 'react';
import { useImperativeHandle, useRef } from 'react';
import { Input } from 'Component';
interface Props {
@ -27,27 +27,17 @@ const DragVertical = React.forwardRef<Input, Props>(({
}, forwardedRef) => {
const inputRef = useRef(null);
const divRef = useRef(null);
useImperativeHandle(forwardedRef, () => divRef.current);
const setBackgroundSize = () => {
if (inputRef) {
const mn = min || 0;
const mx = max || 100;
const size = Math.round((value - mn) / (mx - mn) * 100);
inputRef.current?.node.style?.setProperty('--background-size', `${size}%`);
}
};
useImperativeHandle(forwardedRef, () => divRef.current);
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
e.preventDefault();
e.stopPropagation();
if (onChange) {
onChange(e, Number(e.target.value));
}
};
useEffect(() => { setBackgroundSize(); }, [value]);
if (onChange) {
onChange(e, 1 - Number(e.target.value));
};
};
return (
<div
@ -71,8 +61,10 @@ const DragVertical = React.forwardRef<Input, Props>(({
e.stopPropagation();
}}
/>
<div className="slider-bg"></div>
<div className="slider-track" style={{ height: `${Math.round(value * 72)}px` }}></div>
</div>
);
});
export default DragVertical;
export default DragVertical;

View file

@ -4,6 +4,7 @@ import { Icon } from 'Component';
import HeaderAuthIndex from './auth';
import HeaderMainObject from './main/object';
import HeaderMainChat from './main/chat';
import HeaderMainHistory from './main/history';
import HeaderMainGraph from './main/graph';
import HeaderMainNavigation from './main/navigation';
@ -17,6 +18,7 @@ interface Props extends I.HeaderComponent {
const Components = {
authIndex: HeaderAuthIndex,
mainObject: HeaderMainObject,
mainChat: HeaderMainChat,
mainHistory: HeaderMainHistory,
mainGraph: HeaderMainGraph,
mainNavigation: HeaderMainNavigation,
@ -56,17 +58,19 @@ class Header extends React.Component<Props> {
return (
<div id="header" className={cn.join(' ')} onDoubleClick={this.onDoubleClick}>
<Component
ref={ref => this.refChild = ref}
{...this.props}
onSearch={this.onSearch}
onTooltipShow={this.onTooltipShow}
onTooltipHide={this.onTooltipHide}
menuOpen={this.menuOpen}
renderLeftIcons={this.renderLeftIcons}
renderTabs={this.renderTabs}
onRelation={this.onRelation}
/>
{Component ? (
<Component
ref={ref => this.refChild = ref}
{...this.props}
onSearch={this.onSearch}
onTooltipShow={this.onTooltipShow}
onTooltipHide={this.onTooltipHide}
menuOpen={this.menuOpen}
renderLeftIcons={this.renderLeftIcons}
renderTabs={this.renderTabs}
onRelation={this.onRelation}
/>
) : ''}
</div>
);
};
@ -134,7 +138,9 @@ class Header extends React.Component<Props> {
};
onDoubleClick () {
Renderer.send('winCommand', 'maximize');
if (U.Common.isPlatformMac()) {
Renderer.send('winCommand', 'maximize');
};
};
menuOpen (id: string, elementId: string, param: Partial<I.MenuParam>) {

View file

@ -0,0 +1,60 @@
import * as React from 'react';
import { observer } from 'mobx-react';
import { Sync } from 'Component';
import { I, S, U, J, keyboard } from 'Lib';
interface State {
templatesCnt: number;
};
const HeaderMainChat = observer(class HeaderMainChat extends React.Component<I.HeaderComponent, State> {
state = {
templatesCnt: 0
};
constructor (props: I.HeaderComponent) {
super(props);
this.onSync = this.onSync.bind(this);
this.onOpen = this.onOpen.bind(this);
};
render () {
const { rootId, renderLeftIcons } = this.props;
return (
<React.Fragment>
<div className="side left">
{renderLeftIcons(this.onOpen)}
<Sync id="button-header-sync" rootId={rootId} onClick={this.onSync} />
</div>
<div className="side center" />
<div className="side right" />
</React.Fragment>
);
};
onOpen () {
const { rootId } = this.props;
const object = S.Detail.get(rootId, rootId, []);
keyboard.disableClose(true);
S.Popup.closeAll(null, () => U.Object.openRoute(object));
};
onSync () {
const { rootId, menuOpen } = this.props;
menuOpen('syncStatus', '#button-header-sync', {
subIds: [ 'syncStatusInfo' ],
data: {
rootId,
}
});
};
});
export default HeaderMainChat;

View file

@ -142,7 +142,6 @@ const HeaderMainObject = observer(class HeaderMainObject extends React.Component
const { rootId, menuOpen } = this.props;
menuOpen('syncStatus', '#button-header-sync', {
horizontal: I.MenuDirection.Left,
subIds: [ 'syncStatusInfo' ],
data: {
rootId,

View file

@ -324,7 +324,7 @@ const MenuTemplateList = observer(class MenuTemplateList extends React.Component
const { getId, param } = this.props;
const { data } = param;
const { onTypeChange } = data;
const allowedLayouts = U.Object.getPageLayouts().concat(U.Object.getSetLayouts()).concat(I.ObjectLayout.Chat);
const allowedLayouts = U.Object.getPageLayouts().concat(U.Object.getSetLayouts());
S.Menu.open('typeSuggest', {
element: `#${getId()} #defaultType`,

View file

@ -119,6 +119,7 @@ class MenuObject extends React.Component<I.Menu> {
let pagePublish = { id: 'pagePublish', icon: 'publish', name: translate('menuObjectPublish') };
let downloadFile = { id: 'downloadFile', icon: 'download', name: translate('commonDownload') };
let openFile = { id: 'openFile', icon: 'expand', name: translate('menuObjectDownloadOpen') };
let openObject = { id: 'openAsObject', icon: 'expand', name: translate('commonOpenObject') };
if (isTemplate) {
template = { id: 'pageCreate', icon: 'template', name: translate('commonCreateObject') };
@ -184,26 +185,28 @@ class MenuObject extends React.Component<I.Menu> {
const allowedPublish = config.experimental;
const allowedDownloadFile = U.Object.isInFileLayouts(object.layout);
const allowedOpenFile = U.Object.isInFileLayouts(object.layout);
const allowedOpenObject = isFilePreview;
if (!allowedArchive) archive = null;
if (!allowedLock) pageLock = null;
if (!allowedCopy) pageCopy = null;
if (!allowedReload) pageReload = null;
if (!allowedSearch) search = null;
if (!allowedHistory) history = null;
if (!allowedFav) fav = null;
if (!allowedArchive) archive = null;
if (!allowedLock) pageLock = null;
if (!allowedCopy) pageCopy = null;
if (!allowedReload) pageReload = null;
if (!allowedSearch) search = null;
if (!allowedHistory) history = null;
if (!allowedFav) fav = null;
if (!allowedInstall && !allowedUninstall) pageInstall = null;
if (!isTemplate && !allowedTemplate) template = null;
if (allowedUninstall) archive = null;
if (!allowedWidget) createWidget = null;
if (!allowedLinkTo) linkTo = null;
if (!allowedPageLink) pageLink = null;
if (allowedUninstall) archive = null;
if (!allowedWidget) createWidget = null;
if (!allowedLinkTo) linkTo = null;
if (!allowedPageLink) pageLink = null;
if (!allowedAddCollection) addCollection = null;
if (!allowedExport) pageExport = null;
if (!allowedPrint) print = null;
if (!allowedPublish) pagePublish = null;
if (!allowedDownloadFile) downloadFile = null;
if (!allowedOpenFile) openFile = null;
if (!allowedExport) pageExport = null;
if (!allowedPrint) print = null;
if (!allowedDownloadFile) downloadFile = null;
if (!allowedOpenFile) openFile = null;
if (!allowedOpenObject) openObject = null;
if (!canWrite) {
template = null;
@ -217,33 +220,37 @@ class MenuObject extends React.Component<I.Menu> {
pageCopy = null;
};
sections = [
sections = sections.concat([
{ children: [ openObject ] },
{ children: [ createWidget, fav, pageLock, history ] },
{ children: [ linkTo, addCollection ] },
{ children: [ search, pageLink, pageInstall, pageCopy, archive, remove ] },
{ children: [ print ] },
{ children: [ openFile, downloadFile ] },
];
]);
} else {
if (isTemplate) {
sections = [
sections = sections.concat([
{ children: [ openObject ] },
{ children: [ search, template, pageCopy, setDefaultTemplate, pageExport, archive, history ] },
{ children: [ print ] },
];
]);
} else
if (object.isArchived) {
sections = [
sections = sections.concat([
{ children: [ openObject ] },
{ children: [ search, pageExport, remove, archive ] },
{ children: [ print ] },
];
]);
} else {
sections = [
sections = sections.concat([
{ children: [ openObject ] },
{ children: [ createWidget, fav, pageLock ] },
{ children: [ linkTo, addCollection, template ] },
{ children: [ search, history, pageCopy, archive ] },
{ children: [ pageLink, pageReload ] },
{ children: [ print, pageExport, pagePublish ] },
];
]);
};
sections = sections.map((it: any, i: number) => ({ ...it, id: 'page' + i }));
@ -547,6 +554,11 @@ class MenuObject extends React.Component<I.Menu> {
Action.downloadFile(object.id, route, U.Object.isImageLayout(object.layout));
break;
};
case 'openAsObject': {
U.Object.openAuto(object);
break;
};
};
if (close) {
@ -556,4 +568,4 @@ class MenuObject extends React.Component<I.Menu> {
};
export default MenuObject;
export default MenuObject;

View file

@ -218,7 +218,7 @@ class MenuQuickCapture extends React.Component<I.Menu, State> {
load (clear: boolean, callBack?: (message: any) => void) {
const filter = String(this.filter || '');
const layouts = U.Object.getPageLayouts().concat(U.Object.getSetLayouts()).concat(I.ObjectLayout.Chat);
const layouts = U.Object.getPageLayouts().concat(U.Object.getSetLayouts());
const filters: any[] = [
{ relationKey: 'layout', condition: I.FilterCondition.In, value: I.ObjectLayout.Type },
@ -316,7 +316,7 @@ class MenuQuickCapture extends React.Component<I.Menu, State> {
} else {
const pinned = pinnedIds.map(id => S.Record.getTypeById(id)).filter(it => it).slice(0, LIMIT_PINNED);
items = U.Data.getObjectTypesForNewObject({ withChat: true }).filter(it => !pinnedIds.includes(it.id));
items = U.Data.getObjectTypesForNewObject().filter(it => !pinnedIds.includes(it.id));
items = items.slice(0, LIMIT_PINNED - pinned.length);
items.push(S.Record.getSetType());
items.push(S.Record.getCollectionType());

View file

@ -97,7 +97,7 @@ const PageAuthDeleted = observer(class PageAuthDeleted extends React.Component<I
</Frame>
<div className="animation small bottom" onClick={this.onLogout}>
Log out
{translate('popupSettingsLogout')}
</div>
</div>
);

View file

@ -22,7 +22,6 @@ const PageMainChat = observer(class PageMainChat extends React.Component<I.PageC
refControls: any = null;
loading = false;
timeout = 0;
blockRefs: any = {};
state = {
isLoading: false,
@ -38,8 +37,8 @@ const PageMainChat = observer(class PageMainChat extends React.Component<I.PageC
render () {
const { isLoading, isDeleted } = this.state;
const rootId = this.getRootId();
const check = U.Data.checkDetails(rootId);
const readonly = this.isReadonly();
const object = S.Detail.get(rootId, rootId, [ 'chatId' ]);
if (isDeleted) {
return <Deleted {...this.props} />;
@ -50,39 +49,22 @@ const PageMainChat = observer(class PageMainChat extends React.Component<I.PageC
if (isLoading) {
content = <Loader id="loader" />;
} else {
const children = S.Block.getChildren(rootId, rootId, it => it.isChat());
const cover = new M.Block({ id: rootId + '-cover', type: I.BlockType.Cover, childrenIds: [], fields: {}, content: {} });
const chat = new M.Block({ id: J.Constant.blockId.chat, type: I.BlockType.Chat, childrenIds: [], fields: {}, content: {} });
content = (
<React.Fragment>
{check.withCover ? <Block {...this.props} key={cover.id} rootId={rootId} block={cover} /> : ''}
<div className="blocks">
<Controls ref={ref => this.refControls = ref} key="editorControls" {...this.props} rootId={rootId} resize={this.resize} />
<HeadSimple
{...this.props}
ref={ref => this.refHead = ref}
placeholder={translate('defaultNamePage')}
rootId={rootId}
readonly={readonly}
/>
{children.map((block: I.Block, i: number) => (
<Block
{...this.props}
ref={ref => this.blockRefs[block.id] = ref}
key={block.id}
rootId={rootId}
iconSize={20}
block={block}
className="noPlus"
isSelectionDisabled={true}
isContextMenuDisabled={true}
readonly={readonly}
/>
))}
</div>
</React.Fragment>
<div className="blocks">
<Block
{...this.props}
key={chat.id}
rootId={rootId}
iconSize={20}
block={chat}
className="noPlus"
isSelectionDisabled={true}
isContextMenuDisabled={true}
readonly={readonly}
/>
</div>
);
};
@ -90,13 +72,13 @@ const PageMainChat = observer(class PageMainChat extends React.Component<I.PageC
<div ref={node => this.node = node}>
<Header
{...this.props}
component="mainObject"
component="mainChat"
ref={ref => this.refHeader = ref}
rootId={rootId}
rootId={object.chatId}
/>
<div id="bodyWrapper" className="wrapper">
<div className={[ 'editorWrapper', check.className ].join(' ')}>
<div className="editorWrapper isChat">
{content}
</div>
</div>

View file

@ -68,7 +68,7 @@ const PageMainType = observer(class PageMainType extends React.Component<I.PageC
const allowedDetails = object.isInstalled && S.Block.checkFlags(rootId, rootId, [ I.RestrictionObject.Details ]);
const allowedRelation = object.isInstalled && S.Block.checkFlags(rootId, rootId, [ I.RestrictionObject.Relation ]) && !U.Object.isParticipantLayout(object.recommendedLayout);
const allowedTemplate = object.isInstalled && allowedObject && showTemplates && canWrite && !isTemplate;
const allowedLayout = ![ I.ObjectLayout.Bookmark, I.ObjectLayout.Chat, I.ObjectLayout.Participant ].includes(object.recommendedLayout);
const allowedLayout = ![ I.ObjectLayout.Bookmark, I.ObjectLayout.Participant ].includes(object.recommendedLayout);
const subIdObject = this.getSubIdObject();
const totalObject = S.Record.getMeta(subIdObject, '').total;

View file

@ -83,14 +83,13 @@ const PopupSettingsPageLogout = observer(class PopupSettingsPageLogout extends R
onLogout () {
this.props.setPinConfirmed(false);
analytics.event('LogOut');
U.Router.go('/', {
replace: true,
animate: true,
onRouteChange: () => {
S.Auth.logout(true, false);
analytics.event('LogOut');
},
});
};

View file

@ -58,7 +58,7 @@ const PopupSettingsSpaceIndex = observer(class PopupSettingsSpaceIndex extends R
const hasLink = cid && key;
const isOwner = U.Space.isMyOwner();
const canWrite = U.Space.canMyParticipantWrite();
const canDelete = !space.isPersonal && isOwner;
const canDelete = !space.isPersonal;
const isShareActive = U.Space.isShareActive();
let bytesUsed = 0;
@ -446,9 +446,9 @@ const PopupSettingsSpaceIndex = observer(class PopupSettingsSpaceIndex extends R
const space = U.Space.getSpaceview();
if (space.isShared && !cid && !key) {
C.SpaceInviteGetCurrent(S.Common.space, (message: any) => {
if (!message.error.code) {
this.setInvite(message.inviteCid, message.inviteKey);
U.Space.getInvite(S.Common.space, (cid: string, key: string) => {
if (cid && key) {
this.setInvite(cid, key);
};
});
};
@ -471,7 +471,7 @@ const PopupSettingsSpaceIndex = observer(class PopupSettingsSpaceIndex extends R
data: {
filter: '',
filters: [
{ relationKey: 'recommendedLayout', condition: I.FilterCondition.In, value: U.Object.getPageLayouts().concat(I.ObjectLayout.Chat) },
{ relationKey: 'recommendedLayout', condition: I.FilterCondition.In, value: U.Object.getPageLayouts() },
{ relationKey: 'uniqueKey', condition: I.FilterCondition.NotEqual, value: J.Constant.typeKey.template },
],
onClick: (item: any) => {

View file

@ -271,9 +271,9 @@ const PopupSettingsSpaceShare = observer(class PopupSettingsSpaceShare extends R
const space = U.Space.getSpaceview();
if (space.isShared && !cid && !key) {
C.SpaceInviteGetCurrent(S.Common.space, (message: any) => {
if (!message.error.code) {
this.setInvite(message.inviteCid, message.inviteKey);
U.Space.getInvite(S.Common.space, (cid: string, key: string) => {
if (cid && key) {
this.setInvite(cid, key);
};
});
};
@ -332,6 +332,8 @@ const PopupSettingsSpaceShare = observer(class PopupSettingsSpaceShare extends R
onInitLink () {
const btn = this.refButton;
const space = U.Space.getSpaceview();
if (!btn || btn.state.isLoading) {
return;
};
@ -348,9 +350,13 @@ const PopupSettingsSpaceShare = observer(class PopupSettingsSpaceShare extends R
btn.setLoading(false);
if (!this.setError(message.error)) {
this.setInvite(message.inviteCid, message.inviteKey);
return;
};
Preview.toastShow({ text: translate('toastInviteGenerate') });
this.setInvite(message.inviteCid, message.inviteKey);
Preview.toastShow({ text: translate('toastInviteGenerate') });
if (!space.isShared) {
analytics.event('ShareSpace');
};
});

View file

@ -136,6 +136,7 @@ class PopupUsecasePageItem extends React.Component<I.PopupUsecase, State> {
};
onMenu () {
const { config } = S.Common;
const { getId, close } = this.props;
const object = this.getObject();
const route = this.getRoute();
@ -159,12 +160,13 @@ class PopupUsecasePageItem extends React.Component<I.PopupUsecase, State> {
noVirtualisation: true,
onSelect: (e: any, item: any) => {
const isNew = item.id == 'add';
const withChat = U.Common.isChatAllowed();
this.setState({ isLoading: true });
analytics.event('ClickGalleryInstallSpace', { type: isNew ? 'New' : 'Existing', route });
if (isNew) {
C.WorkspaceCreate({ name: object.title, iconOption: U.Common.rand(1, J.Constant.count.icon) }, I.Usecase.None, (message: any) => {
C.WorkspaceCreate({ name: object.title, iconOption: U.Common.rand(1, J.Constant.count.icon) }, I.Usecase.None, withChat, (message: any) => {
if (!message.error.code) {
cb(message.objectId, true);

View file

@ -28,6 +28,7 @@ const PopupSpaceCreate = observer(class PopupSpaceCreate extends React.Component
this.onKeyDown = this.onKeyDown.bind(this);
this.onChange = this.onChange.bind(this);
this.onIcon = this.onIcon.bind(this);
};
render () {
@ -52,6 +53,7 @@ const PopupSpaceCreate = observer(class PopupSpaceCreate extends React.Component
object={space}
canEdit={false}
menuParam={{ horizontal: I.MenuDirection.Center }}
onClick={this.onIcon}
/>
</div>
@ -118,13 +120,14 @@ const PopupSpaceCreate = observer(class PopupSpaceCreate extends React.Component
this.setLoading(true);
const withChat = U.Common.isChatAllowed();
const details = {
name,
iconOption,
spaceDashboardId: I.HomePredefinedId.Last,
};
C.WorkspaceCreate(details, I.Usecase.GetStarted, (message: any) => {
C.WorkspaceCreate(details, I.Usecase.GetStarted, withChat, (message: any) => {
this.setLoading(false);
if (message.error.code) {
@ -169,6 +172,17 @@ const PopupSpaceCreate = observer(class PopupSpaceCreate extends React.Component
this.setState({ isLoading });
};
onIcon () {
let { iconOption } = this.state;
iconOption++;
if (iconOption > J.Constant.count.icon) {
iconOption = 1;
};
this.setState({ iconOption });
};
});
export default PopupSpaceCreate;

View file

@ -484,6 +484,15 @@ const SidebarObject = observer(class SidebarObject extends React.Component<{}, S
subId: J.Constant.subId.allObject,
route: analytics.route.allObjects,
allowedLinkTo: true,
onSelect: id => {
switch (id) {
case 'archive': {
this.selected = [];
this.renderSelection();
break;
};
};
}
}
});
};

View file

@ -23,7 +23,7 @@ const SidebarWidget = observer(class SidebarWidget extends React.Component<{}, S
position: I.BlockPosition = null;
isDragging = false;
frame = 0;
isSubcribed = false;
isSubcribed = '';
constructor (props) {
super(props);
@ -231,7 +231,11 @@ const SidebarWidget = observer(class SidebarWidget extends React.Component<{}, S
);
};
componentDidMount(): void {
componentDidMount (): void {
this.subscribeArchive();
};
componentDidUpdate (): void {
this.subscribeArchive();
};
@ -531,21 +535,23 @@ const SidebarWidget = observer(class SidebarWidget extends React.Component<{}, S
};
subscribeArchive () {
if (this.isSubcribed) {
const { space } = S.Common
if (this.isSubcribed == space) {
return;
};
this.isSubcribed = true;
U.Data.searchSubscribe({
subId: SUB_ID,
spaceId: S.Common.space,
spaceId: space,
withArchived: true,
filters: [
{ relationKey: 'isArchived', condition: I.FilterCondition.Equal, value: true },
],
limit: 1,
}, () => {});
}, () => {
this.isSubcribed = space;
});
};
});

View file

@ -93,18 +93,18 @@ const FontSize = {
};
const DefaultIcons = [ 'page', 'task', 'set', 'chat', 'bookmark', 'type' ];
const Ghost = require('img/icon/ghost.svg').default;
const Ghost = require('img/icon/ghost.svg');
const CheckboxTask = {
'': {
0: require('img/icon/object/checkbox0.svg').default,
1: require('img/icon/object/checkbox1.svg').default,
2: require('img/icon/object/checkbox2.svg').default,
0: require('img/icon/object/checkbox0.svg'),
1: require('img/icon/object/checkbox1.svg'),
2: require('img/icon/object/checkbox2.svg'),
},
dark: {
0: require('img/icon/object/checkbox0.svg').default,
1: require('img/theme/dark/icon/object/checkbox1.svg').default,
2: require('img/icon/object/checkbox2.svg').default,
0: require('img/icon/object/checkbox0.svg'),
1: require('img/theme/dark/icon/object/checkbox1.svg'),
2: require('img/icon/object/checkbox2.svg'),
},
};
@ -162,28 +162,23 @@ const IconObject = observer(class IconObject extends React.Component<Props> {
switch (layout) {
default:
case I.ObjectLayout.Chat:
case I.ObjectLayout.Page: {
if (iconImage) {
cn.push('withImage');
};
if (iconEmoji || iconImage || iconClass) {
icon = <IconEmoji {...this.props} className={icn.join(' ')} iconClass={iconClass} size={iconSize} icon={iconEmoji} objectId={iconImage} />;
} else {
defaultIcon('page');
};
break;
};
case I.ObjectLayout.Chat: {
if (iconImage) {
cn.push('withImage');
let di = 'page';
switch (layout) {
case I.ObjectLayout.Chat: di = 'chat'; break;
case I.ObjectLayout.Collection:
case I.ObjectLayout.Set: di = 'set'; break;
};
if (iconEmoji || iconImage || iconClass) {
icon = <IconEmoji {...this.props} className={icn.join(' ')} iconClass={iconClass} size={iconSize} icon={iconEmoji} objectId={iconImage} />;
} else {
defaultIcon('chat');
defaultIcon(di);
};
break;
};
@ -244,10 +239,8 @@ const IconObject = observer(class IconObject extends React.Component<Props> {
break;
};
const src = require(`img/icon/relation/${Relation.typeName(relationFormat)}.svg`).default;
icn = icn.concat([ 'iconCommon', 'c' + iconSize ]);
icon = <img src={src} className={icn.join(' ')} />;
icon = <img src={`./img/icon/relation/${Relation.typeName(relationFormat)}.svg`} className={icn.join(' ')} />;
break;
};
@ -268,7 +261,7 @@ const IconObject = observer(class IconObject extends React.Component<Props> {
icon = <img src={S.Common.imageUrl(id, iconSize * 2)} className={icn.join(' ')} />;
} else {
icn = icn.concat([ 'iconFile', 'c' + iconSize ]);
icon = <img src={U.File.iconImage(object)} className={icn.join(' ')} />;
icon = <img src={U.File.iconPath(object)} className={icn.join(' ')} />;
};
break;
};
@ -278,7 +271,7 @@ const IconObject = observer(class IconObject extends React.Component<Props> {
case I.ObjectLayout.Pdf:
case I.ObjectLayout.File: {
icn = icn.concat([ 'iconFile', 'c' + iconSize ]);
icon = <img src={U.File.iconImage(object)} className={icn.join(' ')} />;
icon = <img src={U.File.iconPath(object)} className={icn.join(' ')} />;
break;
};
@ -507,7 +500,7 @@ const IconObject = observer(class IconObject extends React.Component<Props> {
};
defaultIcon (type: string) {
return require(`img/icon/default/${type}.svg`).default;
return require(`img/icon/default/${type}.svg`);
};
});

View file

@ -15,28 +15,28 @@ interface Props {
const Icons = {
checkbox: {
0: require('img/icon/marker/checkbox0.svg').default,
1: require('img/icon/marker/checkbox1.svg').default,
2: require('img/icon/marker/checkbox2.svg').default,
0: require('img/icon/marker/checkbox0.svg'),
1: require('img/icon/marker/checkbox1.svg'),
2: require('img/icon/marker/checkbox2.svg'),
},
task: {
0: require('img/icon/object/checkbox0.svg').default,
1: require('img/icon/object/checkbox1.svg').default,
2: require('img/icon/object/checkbox2.svg').default,
0: require('img/icon/object/checkbox0.svg'),
1: require('img/icon/object/checkbox1.svg'),
2: require('img/icon/object/checkbox2.svg'),
},
};
const Theme = {
dark: {
checkbox: {
0: require('img/icon/marker/checkbox0.svg').default,
1: require('img/theme/dark/icon/marker/checkbox1.svg').default,
2: require('img/icon/marker/checkbox2.svg').default,
0: require('img/icon/marker/checkbox0.svg'),
1: require('img/theme/dark/icon/marker/checkbox1.svg'),
2: require('img/icon/marker/checkbox2.svg'),
},
task: {
0: require('img/icon/object/checkbox0.svg').default,
1: require('img/theme/dark/icon/object/checkbox1.svg').default,
2: require('img/icon/object/checkbox2.svg').default,
0: require('img/icon/object/checkbox0.svg'),
1: require('img/theme/dark/icon/object/checkbox1.svg'),
2: require('img/icon/object/checkbox2.svg'),
},
},
};

View file

@ -34,7 +34,7 @@ class MediaAudio extends React.PureComponent<Props, State> {
playOnSeek = false;
current: PlaylistItem = { name: '', src: '' };
resizeObserver: ResizeObserver;
fadeOutVolumeSlider = _.debounce(() => this.setState({ showVolumeSlider: false }), 500);
fadeOutVolumeSlider = _.debounce(() => this.setState({ showVolumeSlider: false }), 250);
startedPlaying = false;
@ -93,9 +93,7 @@ class MediaAudio extends React.PureComponent<Props, State> {
<div className="time">
<span id="timeMetric" className="metric">{this.state.timeMetric}</span>
</div>
<div
onMouseLeave={this.fadeOutVolumeSlider}
>
<div onMouseLeave={this.fadeOutVolumeSlider}>
<Icon
onMouseEnter={() => {
this.fadeOutVolumeSlider.cancel();
@ -275,6 +273,7 @@ class MediaAudio extends React.PureComponent<Props, State> {
};
const t = this.startedPlaying ? this.getTime(el.currentTime) : this.getTime(el.duration);
this.setState({ timeMetric: `${U.Common.sprintf('%02d', t.m)}:${U.Common.sprintf('%02d', t.s)}`});
this.timeDragRef.setValue(el.currentTime / el.duration);
};

View file

@ -1,8 +1,8 @@
import * as React from 'react';
import { observer } from 'mobx-react';
import $ from 'jquery';
import { Icon, Label } from 'Component';
import { S, U, C, J, Storage, keyboard } from 'Lib';
import { observer } from 'mobx-react';
import { Icon, Label, Error } from 'Component';
import { I, S, U, C, J, Storage, keyboard, translate } from 'Lib';
const Progress = observer(class Progress extends React.Component {
@ -22,26 +22,49 @@ const Progress = observer(class Progress extends React.Component {
};
render () {
const { progress } = S.Common;
const { status, current, total, isUnlocked, canCancel } = progress || {};
const { show } = S.Progress;
const list = S.Progress.getList();
const cn = [ 'progress' ];
if (!status) {
if (!show || !list.length) {
return null;
};
const text = U.Common.sprintf(status, current, total);
const cn = [ 'progress', (isUnlocked ? 'isUnlocked' : '') ];
const Item = (item: any) => {
const percent = item.total > 0 ? Math.min(100, Math.ceil(item.current / item.total * 100)) : 0;
const isError = item.state == I.ProgressState.Error;
const canCancel = item.canCancel && !isError;
return (
<div className="item">
<div className="nameWrap">
<Label text={translate(U.Common.toCamelCase(`progress-${item.type}`))} />
{canCancel ? <Icon className="close" onClick={() => this.onCancel(item.id)} /> : ''}
</div>
{isError ? (
<Error text={item.error} />
) : (
<div className="bar">
<div className="fill" style={{width: `${percent}%` }} />
</div>
)}
</div>
);
};
return (
<div
ref={node => this.node = node}
className={cn.join(' ')}
>
<div id="inner" className="inner" onMouseDown={this.onDragStart}>
<Label text={text} />
{canCancel ? <Icon className="close" onClick={this.onCancel} /> : ''}
<div className="bar">
<div className="fill" style={{width: (Math.ceil(current / total * 100)) + '%'}} />
<div className="titleWrap">
<Label text={translate('commonProgress')} />
<Label className="percent" text={`${S.Progress.getPercent()}%`} />
</div>
<div className="items">
{list.map(item => <Item key={item.id} {...item} />)}
</div>
</div>
</div>
@ -50,39 +73,22 @@ const Progress = observer(class Progress extends React.Component {
componentDidMount () {
this._isMounted = true;
this.resize();
};
componentDidUpdate () {
const { progress } = S.Common;
if (!progress) {
return;
};
const { current, total } = progress;
const win = $(window);
const node = $(this.node);
node.removeClass('hide');
this.resize();
win.off('resize.progress').on('resize.progress', () => this.resize());
if (total && (current >= total)) {
node.addClass('hide');
win.off('resize.progress');
window.setTimeout(() => S.Common.progressClear(), 200);
};
};
componentWillUnmount () {
this._isMounted = false;
$(window).off('resize.progress');
};
onCancel (e: any) {
const { progress } = S.Common;
const { id } = progress;
onCancel (id: string) {
C.ProcessCancel(id);
};
@ -107,6 +113,7 @@ const Progress = observer(class Progress extends React.Component {
const y = e.pageY - this.dy - win.scrollTop();
this.setStyle(x, y);
Storage.set('progress', { x, y }, true);
};
onDragEnd (e: any) {
@ -119,6 +126,9 @@ const Progress = observer(class Progress extends React.Component {
checkCoords (x: number, y: number): { x: number, y: number } {
const { ww, wh } = U.Common.getWindowDimensions();
this.width = Number(this.width) || 0;
this.height = Number(this.height) || 0;
x = Number(x) || 0;
x = Math.max(0, x);
x = Math.min(ww - this.width, x);
@ -139,6 +149,10 @@ const Progress = observer(class Progress extends React.Component {
const coords = Storage.get('progress');
this.obj = node.find('#inner');
if (!this.obj.length) {
return;
};
this.height = this.obj.outerHeight();
this.width = this.obj.outerWidth();
@ -150,10 +164,7 @@ const Progress = observer(class Progress extends React.Component {
setStyle (x: number, y: number) {
const coords = this.checkCoords(x, y);
if ((coords.x !== null) && (coords.y !== null)) {
this.obj.css({ margin: 0, left: coords.x, top: coords.y });
Storage.set('progress', coords, true);
};
this.obj.css({ margin: 0, left: coords.x, top: coords.y, bottom: 'auto' });
};
});

View file

@ -52,11 +52,7 @@ const Toast = observer(class Toast extends React.Component<object, State> {
};
case I.ToastAction.Lock: {
if (!object) {
break;
};
textObject = <Element {...object} />;
textObject = object ? <Element {...object} /> : translate('commonObject');
textAction = translate(value ? 'toastIsLocked' : 'toastIsUnlocked');
break;
};

View file

@ -66,7 +66,7 @@ const WidgetButtons = observer(class WidgetSpace extends React.Component<I.Widge
ret.unshift({ id: 'member', name: translate('commonMembers') });
};
if (space.spaceMainChatId) {
if (space.chatId && U.Common.isChatAllowed()) {
ret.push({ id: 'chat', name: translate('commonMainChat') });
};
@ -91,7 +91,7 @@ const WidgetButtons = observer(class WidgetSpace extends React.Component<I.Widge
};
case 'chat': {
U.Object.openAuto({ id: space.spaceMainChatId, layout: I.ObjectLayout.Chat });
U.Object.openAuto({ id: S.Block.workspace, layout: I.ObjectLayout.Chat });
break;
};
};

View file

@ -418,12 +418,6 @@ const WidgetIndex = observer(class WidgetIndex extends React.Component<Props> {
typeKey = J.Constant.typeKey.collection;
break;
};
case J.Constant.widgetId.chat: {
details.layout = I.ObjectLayout.Chat;
typeKey = J.Constant.typeKey.chat;
break;
};
};
};
@ -627,11 +621,6 @@ const WidgetIndex = observer(class WidgetIndex extends React.Component<Props> {
filters.push({ relationKey: 'layout', condition: I.FilterCondition.Equal, value: I.ObjectLayout.Collection });
break;
};
case J.Constant.widgetId.chat: {
filters.push({ relationKey: 'layout', condition: I.FilterCondition.Equal, value: I.ObjectLayout.Chat });
break;
};
};
U.Data.searchSubscribe({

View file

@ -24,6 +24,7 @@ export interface AccountInfo {
widgetsId: string;
analyticsId: string;
networkId: string;
workspaceObjectId: string;
};
export interface AccountConfig {

View file

@ -20,8 +20,8 @@ export enum ObjectLayout {
SpaceView = 18,
Participant = 19,
Pdf = 20,
Chat = 21,
ChatDerived = 22,
ChatOld = 21,
Chat = 22,
Empty = 100,
Navigation = 101,

View file

@ -1,26 +1,28 @@
export enum ProgressType {
File = 0,
Import = 1,
Export = 2,
Download = 3,
Recover = 4,
Migration = 5,
Drop = 'dropFiles',
Import = 'import',
Export = 'export',
Save = 'saveFile',
Migrate = 'migration',
Update = 'update',
UpdateCheck = 'updateCheck',
};
export enum ProgressState {
None = 0,
Running = 1,
Done = 2,
Canceled = 3,
Error = 4,
None = 0,
Running = 1,
Done = 2,
Canceled = 3,
Error = 4,
};
export interface Progress {
id?: string;
spaceId?: string;
type?: ProgressType;
status?: string;
current?: number;
total?: number;
isUnlocked?: boolean;
state?: ProgressState;
canCancel?: boolean;
error?: string;
};

View file

@ -3,7 +3,7 @@ import $ from 'jquery';
import { I } from 'Lib';
const Duration = {
Normal: 0.1,
Normal: 0.05,
Word: 0.01,
};

View file

@ -107,19 +107,21 @@ export const WalletCloseSession = (token: string, callBack?: (message: any) => v
// ---------------------- WORKSPACE ---------------------- //
export const WorkspaceCreate = (details: any, usecase: I.Usecase, callBack?: (message: any) => void) => {
export const WorkspaceCreate = (details: any, usecase: I.Usecase, withChat: boolean, callBack?: (message: any) => void) => {
const request = new Rpc.Workspace.Create.Request();
request.setDetails(Encode.struct(details));
request.setUsecase(usecase as number);
request.setWithchat(withChat);
dispatcher.request(WorkspaceCreate.name, request, callBack);
};
export const WorkspaceOpen = (spaceId: string, callBack?: (message: any) => void) => {
export const WorkspaceOpen = (spaceId: string, withChat: boolean, callBack?: (message: any) => void) => {
const request = new Rpc.Workspace.Open.Request();
request.setSpaceid(spaceId);
request.setWithchat(withChat);
dispatcher.request(WorkspaceOpen.name, request, callBack);
};
@ -1922,6 +1924,14 @@ export const DebugStat = (callBack?: (message: any) => void) => {
dispatcher.request(DebugStat.name, request, callBack);
};
export const DebugNetCheck = (config: string, callBack?: (message: any) => void) => {
const request = new Rpc.Debug.NetCheck.Request();
request.setClientyml(config);
dispatcher.request(DebugNetCheck.name, request, callBack);
};
// ---------------------- NOTIFICATION ---------------------- //
export const NotificationList = (includeRead: boolean, limit: number, callBack?: (message: any) => void) => {

View file

@ -244,7 +244,6 @@ class Dispatcher {
if (id == rootId) {
S.Block.checkBlockType(rootId);
S.Block.checkBlockChat(rootId);
};
updateParents = true;
@ -816,7 +815,6 @@ class Dispatcher {
S.Detail.delete(rootId, id, keys);
S.Block.checkBlockType(rootId);
S.Block.checkBlockChat(rootId);
updateMarkup = true;
break;
@ -977,40 +975,38 @@ class Dispatcher {
break;
};
case 'ProcessNew':
case 'ProcessUpdate':
case 'ProcessDone': {
case 'ProcessNew': {
const { process } = mapped;
const { id, progress, state, type } = process;
const { progress, type } = process;
switch (state) {
case I.ProgressState.Running: {
let canCancel = true;
let isUnlocked = true;
S.Progress.update({
...process,
current: progress.done,
total: progress.total,
canCancel: [
I.ProgressType.Migrate,
I.ProgressType.Import,
I.ProgressType.Export,
I.ProgressType.Drop,
].includes(type),
});
break;
};
if ([ I.ProgressType.Recover, I.ProgressType.Migration ].includes(type)) {
canCancel = false;
isUnlocked = false;
};
case 'ProcessUpdate': {
const { process } = mapped;
const { progress } = process;
S.Common.progressSet({
id,
status: translate(`progress${type}`),
current: progress.done,
total: progress.total,
isUnlocked,
canCancel,
});
break;
};
S.Progress.update({
...process,
current: progress.done,
total: progress.total,
});
break;
};
case I.ProgressState.Error:
case I.ProgressState.Done:
case I.ProgressState.Canceled: {
S.Common.progressClear();
break;
};
};
case 'ProcessDone': {
S.Progress.delete(mapped.process.id);
break;
};
@ -1073,7 +1069,6 @@ class Dispatcher {
};
S.Block.checkBlockType(rootId);
S.Block.checkBlockChat(rootId);
};
if (undefined !== details.setOf) {
@ -1178,7 +1173,6 @@ class Dispatcher {
S.Block.updateNumbers(contextId);
S.Block.updateMarkup(contextId);
S.Block.checkBlockType(contextId);
S.Block.checkBlockChat(contextId);
keyboard.setWindowTitle();
};

View file

@ -57,6 +57,19 @@ export const Mapper = {
return t;
},
ProcessType (v: Events.Model.Process.MessageCase) {
const V = Events.Model.Process.MessageCase;
let t = '';
if (v == V.DROPFILES) t = 'dropFiles';
if (v == V.IMPORT) t = 'import';
if (v == V.EXPORT) t = 'export';
if (v == V.SAVEFILE) t = 'saveFile';
if (v == V.MIGRATION) t = 'migration';
return t;
},
From: {
Account: (obj: Model.Account): I.Account => {
@ -81,6 +94,7 @@ export const Mapper = {
widgetsId: obj.getWidgetsid(),
analyticsId: obj.getAnalyticsid(),
networkId: obj.getNetworkid(),
workspaceObjectId: obj.getWorkspaceobjectid(),
};
},
@ -590,11 +604,15 @@ export const Mapper = {
},
Process: (obj: Events.Model.Process) => {
const type = Mapper.ProcessType(obj.getMessageCase());
return {
id: obj.getId(),
state: obj.getState() as number,
type: obj.getType() as number,
progress: Mapper.From.Progress(obj.getProgress())
type,
spaceId: obj.getSpaceid(),
progress: Mapper.From.Progress(obj.getProgress()),
error: obj.getError(),
};
},

View file

@ -56,6 +56,12 @@ export const DebugStat = (response: Rpc.Debug.Stat.Response) => {
return res;
};
export const DebugNetCheck = (response: Rpc.Debug.NetCheck.Response) => {
return {
result: response.getResult(),
};
};
export const Export = (response: any) => {
return {
path: response.getPath(),

View file

@ -99,11 +99,11 @@ class Focus {
const ch = container.height();
const no = node.offset().top;
const hh = J.Size.header;
const o = J.Size.lastBlock + ch / 2 + hh;
const o = J.Size.lastBlock + hh;
const st = container.scrollTop();
const y = isPopup ? (no - container.offset().top + st) : no;
if ((y >= st) && (y <= st + ch / 2 - o)) {
if ((y >= st) && (y <= st + ch - o)) {
return;
};

View file

@ -592,6 +592,34 @@ class Keyboard {
break;
};
case 'debugNet': {
const { networkConfig } = S.Auth;
const { path } = networkConfig;
C.DebugNetCheck(path, (message: any) => {
const result = String(message.result || '').trim();
if (!result) {
return;
};
S.Popup.open('confirm', {
className: 'isWide techInfo isLeft',
data: {
title: translate('menuHelpNet'),
text: U.Common.lbBr(result),
textConfirm: translate('commonCopy'),
colorConfirm: 'blank',
canCancel: false,
onConfirm: () => {
U.Common.copyToast(translate('libKeyboardNetInformation'), result);
},
}
});
});
break;
};
case 'resetOnboarding': {
Storage.delete('onboarding');
break;

View file

@ -494,7 +494,7 @@ class Relation {
value = String(value || '');
let ret = '';
if (type == I.RelationType.Url && !value.match(/:\/\//)) {
if (type == I.RelationType.Url) {
ret = 'http://';
};
if (type == I.RelationType.Email) {
@ -506,6 +506,17 @@ class Relation {
return ret;
};
public checkUrlScheme (type: I.RelationType, value: string): string {
value = String(value || '');
if (!value) {
return '';
};
const scheme = U.Common.getScheme(value);
return scheme ? value : this.getUrlScheme(type, value) + value;
};
public getSetOfObjects (rootId: string, objectId: string, layout: I.ObjectLayout): any[] {
const object = S.Detail.get(rootId, objectId, [ 'setOf' ]);
const setOf = this.getArrayValue(object.setOf);

View file

@ -441,7 +441,7 @@ class UtilCommon {
const scheme = this.getScheme(url);
if (!scheme) {
url = 'http://' + url;
url = `http://${url}`;
};
return url;
@ -636,7 +636,9 @@ class UtilCommon {
getScheme (url: string): string {
url = String(url || '');
return url.indexOf('://') >= 0 ? String(url.split('://')[0] || '') : '';
const m = url.match(/^([a-z]+):/);
return m ? m[1] : '';
};
intercept (obj: any, change: any) {
@ -1007,6 +1009,22 @@ class UtilCommon {
};
};
isAlphaVersion (): boolean {
return !!this.getElectron().version.app.match(/alpha/);
};
isBetaVersion (): boolean {
return !!this.getElectron().version.app.match(/beta/);
};
isChatAllowed () {
const { config, space } = S.Common;
return config.experimental;
//return config.experimental || (space == J.Constant.localLoversSpaceId);
//return this.isAlphaVersion() || this.isBetaVersion() || !this.getElectron().isPackaged;
};
};
export default new UtilCommon();

View file

@ -160,6 +160,7 @@ class UtilData {
S.Block.widgetsSet(info.widgetsId);
S.Block.profileSet(info.profileObjectId);
S.Block.spaceviewSet(info.spaceViewId);
S.Block.workspaceSet(info.workspaceObjectId);
S.Common.gatewaySet(info.gatewayUrl);
S.Common.spaceSet(info.accountSpaceId);
@ -548,7 +549,7 @@ class UtilData {
};
getObjectTypesForNewObject (param?: any) {
const { withSet, withCollection, withChat, limit } = param || {};
const { withSet, withCollection, limit } = param || {};
const { space, config } = S.Common;
const pageLayouts = U.Object.getPageLayouts();
const skipLayouts = U.Object.getSetLayouts();
@ -570,10 +571,6 @@ class UtilData {
items.push(S.Record.getSetType());
};
if (withChat && config.experimental) {
items.push(S.Record.getChatType());
};
if (withCollection) {
items.push(S.Record.getCollectionType());
};
@ -788,9 +785,10 @@ class UtilData {
const { config } = S.Common;
const { ignoreHidden, ignoreDeleted, withArchived } = param;
const filters = param.filters || [];
const chatDerivedType = S.Record.getChatDerivedType();
const skipLayouts = [ I.ObjectLayout.Chat, I.ObjectLayout.ChatOld ];
filters.push({ relationKey: 'uniqueKey', condition: I.FilterCondition.NotEqual, value: J.Constant.typeKey.chatDerived });
filters.push({ relationKey: 'layout', condition: I.FilterCondition.NotIn, value: skipLayouts });
filters.push({ relationKey: 'recommendedLayout', condition: I.FilterCondition.NotIn, value: skipLayouts });
if (ignoreHidden && !config.debug.hiddenObject) {
filters.push({ relationKey: 'isHidden', condition: I.FilterCondition.NotEqual, value: true });
@ -805,20 +803,6 @@ class UtilData {
filters.push({ relationKey: 'isArchived', condition: I.FilterCondition.NotEqual, value: true });
};
if (!config.experimental) {
const chatType = S.Record.getChatType();
if (chatType) {
filters.push({ relationKey: 'type', condition: I.FilterCondition.NotEqual, value: chatType?.id });
};
filters.push({ relationKey: 'uniqueKey', condition: I.FilterCondition.NotEqual, value: J.Constant.typeKey.chat });
};
if (chatDerivedType) {
filters.push({ relationKey: 'type', condition: I.FilterCondition.NotEqual, value: chatDerivedType.id });
};
return filters;
};

View file

@ -121,13 +121,7 @@ class UtilFile {
};
iconPath (object: any) {
const tp = S.Common.getThemePath();
return `img/${tp}icon/file/${this.icon(object)}.svg`;
};
iconImage (object: any): string {
const tp = S.Common.getThemePath();
return require(`img/${tp}icon/file/${this.icon(object)}.svg`).default;
return `./img/${S.Common.getThemePath()}icon/file/${this.icon(object)}.svg`;
};
loadPreviewCanvas (file: any, param: any, success?: (canvas: any) => void) {

View file

@ -109,7 +109,7 @@ class UtilMenu {
};
getBlockObject () {
const items = U.Data.getObjectTypesForNewObject({ withSet: true, withCollection: true, withChat: true });
const items = U.Data.getObjectTypesForNewObject({ withSet: true, withCollection: true });
const ret: any[] = [
{ type: I.BlockType.Page, id: 'existingPage', icon: 'existing', lang: 'ExistingPage', arrow: true, aliases: [ 'link' ] },
{ type: I.BlockType.File, id: 'existingFile', icon: 'existing', lang: 'ExistingFile', arrow: true, aliases: [ 'file' ] }
@ -426,7 +426,6 @@ class UtilMenu {
if ([
J.Constant.widgetId.set,
J.Constant.widgetId.collection,
J.Constant.widgetId.chat,
].includes(id)) {
options = options.filter(it => it != I.WidgetLayout.Tree);
};
@ -855,7 +854,6 @@ class UtilMenu {
const { config } = S.Common;
return [
{ id: J.Constant.widgetId.favorite, name: translate('widgetFavorite'), iconEmoji: '⭐' },
config.experimental ? { id: J.Constant.widgetId.chat, name: translate('widgetChat'), iconEmoji: '💬' } : null,
{ id: J.Constant.widgetId.set, name: translate('widgetSet'), iconEmoji: '🔍' },
{ id: J.Constant.widgetId.collection, name: translate('widgetCollection'), iconEmoji: '🗂️' },
{ id: J.Constant.widgetId.recentEdit, name: translate('widgetRecent'), iconEmoji: '📝' },

View file

@ -24,6 +24,7 @@ class UtilObject {
case I.ObjectLayout.Archive: r = 'archive'; break;
case I.ObjectLayout.Block: r = 'block'; break;
case I.ObjectLayout.Empty: r = 'empty'; break;
case I.ObjectLayout.Space:
case I.ObjectLayout.Chat: r = 'chat'; break;
};
return r;
@ -138,6 +139,9 @@ class UtilObject {
window.setTimeout(() => S.Popup.open('page', param), S.Popup.getTimeout());
};
/**
Opens object based on user setting 'Open objects in fullscreen mode'
*/
openConfig (object: any, param?: any) {
S.Common.fullscreenObject ? this.openAuto(object, param) : this.openPopup(object, param);
};
@ -295,6 +299,10 @@ class UtilObject {
return layout == I.ObjectLayout.SpaceView;
};
isSpaceLayout (layout: I.ObjectLayout): boolean {
return layout == I.ObjectLayout.Space;
};
isSetLayout (layout: I.ObjectLayout): boolean {
return layout == I.ObjectLayout.Set;
};
@ -392,7 +400,6 @@ class UtilObject {
I.ObjectLayout.Dashboard,
I.ObjectLayout.Space,
I.ObjectLayout.SpaceView,
I.ObjectLayout.ChatDerived,
];
};
@ -430,7 +437,6 @@ class UtilObject {
I.ObjectLayout.Option,
I.ObjectLayout.SpaceView,
I.ObjectLayout.Space,
I.ObjectLayout.ChatDerived,
];
};
@ -445,7 +451,7 @@ class UtilObject {
};
isAllowedObject (layout: I.ObjectLayout): boolean {
return this.getPageLayouts().concat(I.ObjectLayout.Chat).includes(layout);
return this.getPageLayouts().includes(layout);
};
};

View file

@ -4,6 +4,7 @@ import { I, C, S, U, J, Preview, analytics, Storage } from 'Lib';
class UtilRouter {
history: any = null;
isOpening = false;
init (history: any) {
this.history = history;
@ -129,18 +130,29 @@ class UtilRouter {
};
switchSpace (id: string, route: string, sendEvent: boolean, routeParam: any) {
if (this.isOpening) {
return;
};
if (!id) {
console.log('[UtilRouter].swithSpace: id is empty');
return;
};
const withChat = U.Common.isChatAllowed();
S.Menu.closeAllForced();
S.Progress.showSet(false);
if (sendEvent) {
analytics.event('SwitchSpace');
};
C.WorkspaceOpen(id, (message: any) => {
this.isOpening = true;
C.WorkspaceOpen(id, withChat, (message: any) => {
this.isOpening = false;
if (message.error.code) {
U.Data.onAuthWithoutSpace();
return;

View file

@ -1,4 +1,4 @@
import { I, S, U, J, Storage, translate } from 'Lib';
import { I, C, S, U, J, Storage, translate } from 'Lib';
class UtilSpace {
@ -248,6 +248,12 @@ class UtilSpace {
};
};
getInvite (id: string, callBack: (cid: string, key: string) => void) {
C.SpaceInviteGetCurrent(id, (message: any) => {
callBack(message.inviteCid, message.inviteKey);
});
};
};
export default new UtilSpace();
export default new UtilSpace();

View file

@ -14,6 +14,7 @@ class AccountInfo implements I.AccountInfo {
widgetsId = '';
analyticsId = '';
networkId = '';
workspaceObjectId = '';
constructor (props: I.AccountInfo) {
this.homeObjectId = String(props.homeObjectId || '');
@ -27,6 +28,7 @@ class AccountInfo implements I.AccountInfo {
this.widgetsId = String(props.widgetsId || '');
this.analyticsId = String(props.analyticsId || '');
this.networkId = String(props.networkId || '');
this.workspaceObjectId = String(props.workspaceObjectId || '');
makeObservable(this, {
homeObjectId: observable,
@ -40,6 +42,7 @@ class AccountInfo implements I.AccountInfo {
widgetsId: observable,
analyticsId: observable,
networkId: observable,
workspaceObjectId: observable,
});
intercept(this as any, change => U.Common.intercept(this, change));

View file

@ -42,16 +42,8 @@ class Notification implements I.Notification {
switch (this.type) {
case I.NotificationType.Import: {
const codes = [
J.Error.Code.NO_OBJECTS_TO_IMPORT,
J.Error.Code.IMPORT_IS_CANCELED,
J.Error.Code.LIMIT_OF_ROWS_OR_RELATIONS_EXCEEDED,
J.Error.Code.FILE_LOAD_ERROR,
J.Error.Code.INSUFFICIENT_PERMISSIONS,
];
if (codes.includes(errorCode)) {
this.title = translate(`notificationImportErrorTitle${errorCode}`);
if (Object.values(J.Error.Code.Import).includes(errorCode)) {
this.title = translate('commonError');
this.text = translate(`notificationImportErrorText${errorCode}`);
};
break;

View file

@ -8,6 +8,7 @@ class BlockStore {
public widgetsId = '';
public rootId = '';
public spaceviewId = '';
public workspaceId = '';
public treeMap: Map<string, Map<string, I.BlockStructure>> = new Map();
public blockMap: Map<string, Map<string, I.Block>> = new Map();
@ -20,16 +21,20 @@ class BlockStore {
profileId: observable,
spaceviewId: observable,
widgetsId: observable,
workspaceId: observable,
profile: computed,
root: computed,
spaceview: computed,
widgets: computed,
workspace: computed,
rootSet: action,
profileSet: action,
widgetsSet: action,
spaceviewSet: action,
workspaceSet: action,
set: action,
clear: action,
clearAll: action,
@ -57,6 +62,10 @@ class BlockStore {
return String(this.spaceviewId || '');
};
get workspace (): string {
return String(this.workspaceId || '');
};
profileSet (id: string) {
this.profileId = String(id || '');
};
@ -72,6 +81,10 @@ class BlockStore {
spaceviewSet (id: string) {
this.spaceviewId = String(id || '');
};
workspaceSet (id: string) {
this.workspaceId = String(id || '');
};
set (rootId: string, blocks: I.Block[]) {
const map: Map<string, I.Block> = new Map();
@ -572,8 +585,9 @@ class BlockStore {
checkBlockType (rootId: string) {
const { header, type } = J.Constant.blockId;
const element = this.getMapElement(rootId, header);
const canWrite = U.Space.canMyParticipantWrite();
if (!element) {
if (!element || !canWrite) {
return;
};
@ -593,32 +607,6 @@ class BlockStore {
return header ? header.childrenIds.includes(J.Constant.blockId.type) : false;
};
checkBlockChat (rootId: string) {
return;
const element = this.getMapElement(rootId, rootId);
if (!element) {
return;
};
const object = S.Detail.get(rootId, rootId, [ 'layout', 'chatId' ], true);
if (U.Object.isChatLayout(object.layout)) {
return;
};
if (object.chatId && !this.checkBlockChatExists(rootId)) {
const childrenIds = element.childrenIds.concat(J.Constant.blockId.chat);
this.updateStructure(rootId, rootId, childrenIds);
};
};
checkBlockChatExists (rootId: string): boolean {
const element = this.getMapElement(rootId, rootId);
return element ? element.childrenIds.includes(J.Constant.blockId.chat) : false;
};
getLayoutIds (rootId: string, ids: string[]) {
if (!ids.length) {
return [];

View file

@ -106,7 +106,6 @@ class CommonStore {
spaceId: observable,
membershipTiersList: observable,
config: computed,
progress: computed,
preview: computed,
toast: computed,
filter: computed,
@ -119,8 +118,6 @@ class CommonStore {
shareTooltip: computed,
showVault: computed,
gatewaySet: action,
progressSet: action,
progressClear: action,
filterSetFrom: action,
filterSetText: action,
filterSet: action,
@ -153,10 +150,6 @@ class CommonStore {
return config;
};
get progress (): I.Progress {
return this.progressObj;
};
get preview (): I.Preview {
return this.previewObj;
};
@ -295,14 +288,6 @@ class CommonStore {
return [ this.gateway, 'image', String(id || '') ].join('/') + `?width=${Number(width) || 0}`;
};
progressSet (v: I.Progress) {
this.progressObj = v;
};
progressClear () {
this.progressObj = null;
};
filterSetFrom (from: number) {
this.filterObj.from = from;
};

View file

@ -286,8 +286,8 @@ class DetailStore {
object.readersLimit = Number(object.readersLimit) || 0;
object.writersLimit = Number(object.writersLimit) || 0;
object.spaceId = Relation.getStringValue(object.spaceId);
object.spaceMainChatId = Relation.getStringValue(object.spaceMainChatId);
object.spaceDashboardId = Relation.getStringValue(object.spaceDashboardId);
object.chatId = Relation.getStringValue(object.chatId);
object.targetSpaceId = Relation.getStringValue(object.targetSpaceId);
object.iconOption = Number(object.iconOption) || 1;

View file

@ -8,6 +8,7 @@ import { Popup } from './popup';
import { Notification } from './notification';
import { Extension } from './extension';
import { Chat } from './chat';
import { Progress } from './progress';
export {
Common,
@ -20,4 +21,5 @@ export {
Notification,
Extension,
Chat,
Progress,
};

84
src/ts/store/progress.ts Normal file
View file

@ -0,0 +1,84 @@
import { observable, action, makeObservable, set, computed } from 'mobx';
import { I, S } from 'Lib';
class ProgressStore {
public showValue = false;
public listValue: I.Progress[] = [];
constructor () {
makeObservable(this, {
listValue: observable,
showValue: observable,
list: computed,
show: computed,
add: action,
update: action,
delete: action,
showSet: action,
});
};
get show (): boolean {
return this.showValue;
};
get list (): I.Progress[] {
return this.listValue || [];
};
add (item: Partial<I.Progress>): void {
this.listValue.unshift(item);
};
update (param: Partial<I.Progress>): void {
const item = this.getItem(param.id);
if (item) {
set(item, param);
} else {
this.add(param);
};
};
delete (id: string) {
this.listValue = this.listValue.filter(it => it.id != id);
};
showSet (v: boolean): void {
this.showValue = Boolean(v);
};
getList () {
const { space } = S.Common;
const skip = [ I.ProgressState.Done, I.ProgressState.Canceled ];
return this.list.filter(it => (!it.spaceId || (it.spaceId == space)) && !skip.includes(it.state));
};
getItem (id: string): I.Progress {
return this.getList().find(it => it.id == id);
};
getField (field: string): number {
return this.getList().reduce((acc, it) => acc + (Number(it[field]) || 0), 0);
};
getCurrent (): number {
return this.getField('current');
};
getTotal (): number {
return this.getField('total');
};
getPercent (): number {
const current = this.getCurrent();
const total = this.getTotal();
return total > 0 ? Math.min(100, Math.ceil(current / total * 100)) : 0;
};
};
export const Progress: ProgressStore = new ProgressStore();

View file

@ -282,10 +282,6 @@ class RecordStore {
return this.getTypeByKey(J.Constant.typeKey.chat);
};
getChatDerivedType () {
return this.getTypeByKey(J.Constant.typeKey.chatDerived);
};
getSpaceType () {
return this.getTypeByKey(J.Constant.typeKey.space);
};

View file

@ -13,6 +13,9 @@
"allowJs": true,
"baseUrl": "./src",
"lib": [ "es5", "dom" ],
"isolatedModules": true,
"incremental": true,
"types": [ "node", "@rspack/core/module" ],
"paths": {
"json": [

View file

@ -13,7 +13,7 @@ folder="build";
if [ "$platform" = "ubuntu-latest" ]; then
arch="linux-$arch";
folder="$arch";
elif [ "$platform" = "macos-12" ]; then
elif [ "$platform" = "macos-13" ]; then
arch="darwin-$arch";
folder="$arch";
elif [ "$platform" = "windows-latest" ]; then
@ -36,7 +36,7 @@ mwv=`cat middleware.version`
version=`curl -u "$user:$token" -H "Accept: application/vnd.github.v3+json" -sL https://$GITHUB/repos/$REPO/releases/tags/v$mwv | jq .`
tag=`echo $version | jq ".tag_name"`
asset_id=`echo $version | jq ".assets | map(select(.name | match(\"js_v[0-9]+.[0-9]+.[0-9]+(-rc[0-9]+)?_$arch\";\"i\")))[0].id"`
asset_id=`echo $version | jq ".assets | map(select(.name | match(\"js_v[0-9]+.[0-9]+.[0-9]+([^_]+)?_$arch\";\"i\")))[0].id"`
if [ "$asset_id" = "" ]; then
echo "ERROR: version not found"

View file

@ -11,7 +11,7 @@ folder="build";
if [ "$platform" = "ubuntu-latest" ]; then
arch="linux-$arch";
folder="$arch";
elif [ "$platform" = "macos-12" ]; then
elif [ "$platform" = "macos-13" ]; then
arch="darwin-$arch";
folder="$arch";
elif [ "$platform" = "windows-latest" ]; then
@ -34,7 +34,7 @@ mwv=`cat middleware.version`
version=`curl -H "Accept: application/vnd.github.v3+json" -sL https://$GITHUB/repos/$REPO/releases/tags/v$mwv | jq .`
tag=`echo $version | jq ".tag_name"`
asset_id=`echo $version | jq ".assets | map(select(.name | match(\"js_v[0-9]+.[0-9]+.[0-9]+(-rc[0-9]+)?_$arch\";\"i\")))[0].id"`
asset_id=`echo $version | jq ".assets | map(select(.name | match(\"js_v[0-9]+.[0-9]+.[0-9]+([^_]+)?_$arch\";\"i\")))[0].id"`
if [ "$asset_id" = "" ]; then
echo "ERROR: version not found"