From 151dcd1431b48001107f393d6ee22f44260a679f Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Tue, 22 Jun 2021 14:28:46 +1000 Subject: [PATCH 1/2] fix up onion path animation with no glowing nodes --- stylesheets/_session.scss | 4 +++ ts/components/OnionStatusDialog.tsx | 2 +- .../conversation/InviteContactsDialog.tsx | 2 -- ts/components/session/icon/SessionIcon.tsx | 32 ++++++++++++------- .../session/network/SessionOffline.tsx | 7 ++-- ts/hooks/useNetwork.ts | 22 ------------- 6 files changed, 29 insertions(+), 40 deletions(-) delete mode 100644 ts/hooks/useNetwork.ts diff --git a/stylesheets/_session.scss b/stylesheets/_session.scss index 261a7e36d..622277f15 100644 --- a/stylesheets/_session.scss +++ b/stylesheets/_session.scss @@ -18,6 +18,10 @@ word-break: break-all; } +.session-icon-button svg path { + transition: fill 0.3s ease; +} + input, textarea { caret-color: $session-color-green !important; diff --git a/ts/components/OnionStatusDialog.tsx b/ts/components/OnionStatusDialog.tsx index 465b77989..776e3dd17 100644 --- a/ts/components/OnionStatusDialog.tsx +++ b/ts/components/OnionStatusDialog.tsx @@ -116,7 +116,7 @@ export const ModalStatusLight = (props: StatusLightType) => { glowDuration={glowDuration} glowStartDelay={glowStartDelay} iconType={SessionIconType.Circle} - iconSize={SessionIconSize.Medium} + iconSize={SessionIconSize.Small} theme={theme} /> ); diff --git a/ts/components/conversation/InviteContactsDialog.tsx b/ts/components/conversation/InviteContactsDialog.tsx index 21702bf46..fe21a5f56 100644 --- a/ts/components/conversation/InviteContactsDialog.tsx +++ b/ts/components/conversation/InviteContactsDialog.tsx @@ -41,8 +41,6 @@ const InviteContactsDialogInner = (props: Props) => { } const chatName = convo.get('name'); - // const chatServer = convo.get('server'); - // const channelId = convo.get('channelId'); const isPublicConvo = convo.isPublic(); const [contactList, setContactList] = useState( diff --git a/ts/components/session/icon/SessionIcon.tsx b/ts/components/session/icon/SessionIcon.tsx index e698b71d5..1818cf674 100644 --- a/ts/components/session/icon/SessionIcon.tsx +++ b/ts/components/session/icon/SessionIcon.tsx @@ -62,43 +62,51 @@ const rotate = keyframes` * Creates a glow animation made for multiple element sequentially */ const glow = (color: string, glowDuration: number, glowStartDelay: number) => { - const dropShadowType = `drop-shadow(0px 0px 4px ${color}) `; - //increase shadow intensity by 3 - const dropShadow = `${dropShadowType.repeat(1)};`; + const dropShadow = `drop-shadow(0px 0px 6px ${color});`; // creating keyframe for sequential animations let kf = ''; - for (let i = 0; i <= glowDuration; i++) { - // const percent = (100 / glowDuration) * i; - const percent = (100 / glowDuration) * i; - if (i === glowStartDelay) { + const durationWithLoop = glowDuration + 1; + for (let i = 0; i <= durationWithLoop; i++) { + const percent = (100 / durationWithLoop) * i; + + if (i === glowStartDelay + 1) { kf += `${percent}% { filter: ${dropShadow} - transform: scale(1.5); + transform: scale(1.1); }`; } else { kf += `${percent}% { filter: none; - transform: scale(0.8); + transform: scale(0.9); }`; } } return keyframes`${kf}`; }; -const animation = (props: any) => { +const animation = (props: { + rotateDuration?: number; + glowDuration?: number; + glowStartDelay?: number; + iconColor?: string; +}) => { if (props.rotateDuration) { return css` ${rotate} ${props.rotateDuration}s infinite linear; `; - } else if (props.glowDuration !== undefined && props.glowStartDelay !== undefined) { + } else if ( + props.glowDuration !== undefined && + props.glowStartDelay !== undefined && + props.iconColor + ) { return css` ${glow( props.iconColor, props.glowDuration, props.glowStartDelay - )} ${props.glowDuration}s ease-in infinite; + )} ${props.glowDuration}s ease infinite; `; } else { return; diff --git a/ts/components/session/network/SessionOffline.tsx b/ts/components/session/network/SessionOffline.tsx index 8230520c3..3dbb4a6b4 100644 --- a/ts/components/session/network/SessionOffline.tsx +++ b/ts/components/session/network/SessionOffline.tsx @@ -1,6 +1,8 @@ import React from 'react'; + +// tslint:disable-next-line: no-submodule-imports +import useNetworkState from 'react-use/lib/useNetworkState'; import styled from 'styled-components'; -import { useNetwork } from '../../../hooks/useNetwork'; type ContainerProps = { show: boolean; @@ -24,8 +26,7 @@ const OfflineTitle = styled.h3` const OfflineMessage = styled.div``; export const SessionOffline = () => { - const isOnline = useNetwork(); - + const isOnline = useNetworkState().online; return ( {window.i18n('offline')} diff --git a/ts/hooks/useNetwork.ts b/ts/hooks/useNetwork.ts deleted file mode 100644 index d92fc9937..000000000 --- a/ts/hooks/useNetwork.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { useEffect, useState } from 'react'; - -export function useNetwork() { - const [isOnline, setNetwork] = useState(window.navigator.onLine); - const updateNetwork = () => { - setNetwork(window.navigator.onLine); - }; - - // there are some weird behavior with this api. - // basically, online events might not be called if the pc has a virtual machine running - // https://github.com/electron/electron/issues/11290#issuecomment-348598311 - useEffect(() => { - window.addEventListener('offline', updateNetwork); - window.addEventListener('online', updateNetwork); - - return () => { - window.removeEventListener('offline', updateNetwork); - window.removeEventListener('online', updateNetwork); - }; - }); - return isOnline; -} From feab29a4fedc589441e9d025e3b04eef7b40de0c Mon Sep 17 00:00:00 2001 From: Audric Date: Wed, 23 Jun 2021 13:17:04 +1000 Subject: [PATCH 2/2] remove file server submodule --- .eslintignore | 1 - .github/workflows/build-binaries.yml | 3 --- .github/workflows/pull-request.yml | 3 --- .github/workflows/release.yml | 3 --- .gitmodules | 4 ---- .prettierignore | 1 - tools/unusedLocalizedString.py | 4 ++-- 7 files changed, 2 insertions(+), 17 deletions(-) delete mode 100644 .gitmodules diff --git a/.eslintignore b/.eslintignore index cbc861134..3389f1dad 100644 --- a/.eslintignore +++ b/.eslintignore @@ -32,4 +32,3 @@ ts/**/*.js # Libloki specific files libloki/test/components.js libloki/modules/mnemonic.js -session-file-server/** diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml index ee7610304..f14d51fd1 100644 --- a/.github/workflows/build-binaries.yml +++ b/.github/workflows/build-binaries.yml @@ -20,9 +20,6 @@ jobs: - name: Checkout git repo uses: actions/checkout@v2 - - name: Pull git submodules - run: git submodule update --init - - name: Install node uses: actions/setup-node@v1 with: diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index fa5c758b0..1ce275553 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -22,9 +22,6 @@ jobs: - name: Checkout git repo uses: actions/checkout@v2 - - name: Pull git submodules - run: git submodule update --init - - name: Install node uses: actions/setup-node@v1 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e7fdfd45b..fa58a83fa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,9 +20,6 @@ jobs: - name: Checkout git repo uses: actions/checkout@v2 - - name: Pull git submodules - run: git submodule update --init - - name: Install node uses: actions/setup-node@v1 with: diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 69117c0be..000000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "session-file-server"] - path = session-file-server - url = https://github.com/loki-project/session-file-server/ - branch = session diff --git a/.prettierignore b/.prettierignore index b8d49a937..6d510d168 100644 --- a/.prettierignore +++ b/.prettierignore @@ -49,5 +49,4 @@ stylesheets/_intlTelInput.scss # Coverage coverage/** .nyc_output/** -session-file-server/** release/** diff --git a/tools/unusedLocalizedString.py b/tools/unusedLocalizedString.py index 32d1dd2b3..9c0cbec12 100755 --- a/tools/unusedLocalizedString.py +++ b/tools/unusedLocalizedString.py @@ -13,8 +13,8 @@ files = [y for x in os.walk(dir_path) for y in glob(os.path.join(x[0], '*.js'))] files += [y for x in os.walk(dir_path) for y in glob(os.path.join(x[0], '*.ts'))] files += [y for x in os.walk(dir_path) for y in glob(os.path.join(x[0], '*.tsx'))] -# exclude node_modules and session-file-server directories -filtered_files = [f for f in files if "node_modules" not in f and "session-file-server" not in f] +# exclude node_modules directories +filtered_files = [f for f in files if "node_modules" not in f] # search for this pattern in _locales/en/messages.json: it is a defined localized string patternLocalizedString = re.compile("^ \".*\"\: {")