Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Merge origin/dev 2021-11-25 #1780

Merged
merged 203 commits into from
Nov 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
203 commits
Select commit Hold shift + click to select a range
d633abe
Merge pull request #868 from ChainSafe/dev
FSM1 Apr 2, 2021
0392f31
Merge pull request #908 from ChainSafe/dev
FSM1 Apr 12, 2021
ef657f1
Merge pull request #964 from ChainSafe/dev
FSM1 Apr 22, 2021
c60b181
Merge pull request #983 from ChainSafe/dev
FSM1 Apr 26, 2021
4e362c8
Release latest to Stage (#988)
FSM1 Apr 27, 2021
9d7d8b1
Merge pull request #989 from ChainSafe/stage
FSM1 Apr 27, 2021
00dcb17
Merge pull request #996 from ChainSafe/dev
FSM1 Apr 27, 2021
d3fb1b1
Merge pull request #997 from ChainSafe/stage
FSM1 Apr 27, 2021
c9d65e3
Merge pull request #1009 from ChainSafe/dev
FSM1 May 7, 2021
75bbbd0
fix link (#1025)
FSM1 May 11, 2021
530b582
Merge pull request #1059 from ChainSafe/dev
FSM1 May 31, 2021
eb98743
create buckets for new users
FSM1 Jun 7, 2021
f4b1bb3
Merge pull request #1098 from ChainSafe/hotfix/create-new-user-file-s…
FSM1 Jun 7, 2021
e95ca71
Release latest to PROD (#1135)
FSM1 Jun 15, 2021
e3675be
remove depraecated files call
FSM1 Jun 15, 2021
ae88827
Merge pull request #1138 from ChainSafe/hotfix/remove-deprecated-file…
FSM1 Jun 15, 2021
fa99c60
Merge pull request #1387 from ChainSafe/dev
FSM1 Aug 2, 2021
b082dfc
Merge pull request #1435 from ChainSafe/dev
FSM1 Aug 12, 2021
1cff622
[Storage] Copy cid functionality (#1437)
RyRy79261 Aug 25, 2021
3e0ee70
[STORAGE] Rename file in bucket (#1471)
FSM1 Aug 25, 2021
58839c7
10min timeout for everyone (#1472)
Tbaut Aug 25, 2021
55251ae
Translated using Weblate (French) (#1478)
weblate Aug 30, 2021
03fc54a
add ui tests for search (#1479)
asnaith Aug 31, 2021
997e7d4
bump cypress to v8.3.1 (#1480)
asnaith Aug 31, 2021
161d0cd
Sharing feature explainer (#1477)
Tbaut Sep 2, 2021
8625789
Adding multi selects on mobile view with long press (#1470)
tanmoyAtb Sep 3, 2021
afbd421
bump to 1.18.5 (#1493)
Tbaut Sep 3, 2021
038228c
[Files] - New survey - Discord link and tiny fix (#1487)
Tbaut Sep 3, 2021
57f0feb
Translations update from Weblate (#1496)
weblate Sep 6, 2021
a56307b
update axios (#1498)
FSM1 Sep 6, 2021
fa325f5
Added docs link (#1497)
RyRy79261 Sep 7, 2021
2faecb6
upgrade (#1501)
Tbaut Sep 8, 2021
0852760
Published (#1503)
RyRy79261 Sep 13, 2021
4e2d70a
Add ui tests for file preview (#1489)
asnaith Sep 13, 2021
b70fdfa
Toasts refactor (#1495)
tanmoyAtb Sep 13, 2021
0fecdd8
Progress cancellations (#1500)
tanmoyAtb Sep 13, 2021
7d2c756
survey banner on safari fix (#1512)
tanmoyAtb Sep 13, 2021
0c731ad
fix what I broke (#1518)
Tbaut Sep 14, 2021
4732c0a
Change the survey to a call for a user interview (#1517)
Tbaut Sep 14, 2021
5ecfcce
bump cypress to v8.4 (#1521)
asnaith Sep 14, 2021
f376f59
Translations update from Weblate (#1522)
weblate Sep 14, 2021
3498d32
Adjusting login screen sizes. (#1519)
tanmoyAtb Sep 14, 2021
280b03e
Gaming Dashboard overhaul (#1504)
RyRy79261 Sep 14, 2021
4c5163e
bulk recover operation (#1526)
tanmoyAtb Sep 16, 2021
8634d7f
Add new ui tests for illogical folder and file move errors (#1520)
asnaith Sep 16, 2021
89b9632
Posthog Analytics Integration (#1514)
priom Sep 16, 2021
4c3c7d3
Translated using Weblate (French) (#1528)
weblate Sep 16, 2021
669e3a2
[Files] - Share to home or other shared folder (#1527)
Tbaut Sep 16, 2021
0e454aa
Folder uploads (#1515)
FSM1 Sep 16, 2021
22ed6e9
Translated using Weblate (French) (#1532)
weblate Sep 16, 2021
bdcd6a9
Don't track before opt-in (#1531)
Tbaut Sep 17, 2021
01999cd
Merge branch 'prod' into dev
FSM1 Sep 17, 2021
e071c9a
[Files] - Show current bucket decryption key (#1534)
Tbaut Sep 17, 2021
59bbe6c
[Files] - Get admin public key from the api (#1485)
Tbaut Sep 17, 2021
0356544
Add lint rules for test debug commands (#1535)
asnaith Sep 20, 2021
9a2c948
prevent double opening (#1538)
Tbaut Sep 20, 2021
84b195f
Add test coverage for storage summary adjustments (#1536)
asnaith Sep 20, 2021
4b936f4
Translated using Weblate (French) (#1540)
weblate Sep 21, 2021
36eefa5
Better colors for dark mode select and tagsinput components (#1550)
Tbaut Sep 21, 2021
736b881
Filter out current bucket (#1548)
Tbaut Sep 21, 2021
4919583
fix color (#1555)
Tbaut Sep 22, 2021
c92477b
Fix user lookup spamming the api, and throwing (#1553)
Tbaut Sep 22, 2021
af43f49
Upgrade Torus dependencies (#1549)
FSM1 Sep 22, 2021
22c59bc
reset fields for shared folders (#1577)
Tbaut Sep 24, 2021
5b34d21
reset forms and fix a couple error types (#1578)
Tbaut Sep 24, 2021
eed9c86
Translations update from Weblate (#1557)
weblate Sep 24, 2021
705cc71
hide when ther's no menu item (#1576)
Tbaut Sep 25, 2021
69093a6
Add "maintenance" label to weblate PRs automatically (#1581)
Tbaut Sep 25, 2021
b47bd17
Upgrade api client and fix issue with shared folder renaming (#1582)
Tbaut Sep 27, 2021
e049d76
run lint --fix (#1585)
Tbaut Sep 27, 2021
5d3ac19
Gaming dashboard - API keys as cards (#1575)
RyRy79261 Sep 28, 2021
eb463dd
New navigations buttons (#1574)
Tbaut Sep 28, 2021
a3935e9
fix tertiary buttons (#1592)
Tbaut Sep 28, 2021
d7e9980
Posthog identify user on login (#1590)
FSM1 Sep 28, 2021
ef9421c
show username if known (#1597)
Tbaut Sep 30, 2021
9c568a2
remove fade effect (#1598)
Tbaut Sep 30, 2021
1393059
Translations update from Weblate (#1599)
weblate Sep 30, 2021
6986a7c
Mv and rm batch calls (#1596)
FSM1 Sep 30, 2021
8ed0aa7
refresh buckets after deletion (#1604)
Tbaut Oct 4, 2021
3d99fe9
Toast messages update (#1602)
tanmoyAtb Oct 4, 2021
267f6c9
Translations update from Weblate (#1600)
weblate Oct 4, 2021
8c95e42
Translated using Weblate (Norwegian Bokmål) (#1607)
weblate Oct 4, 2021
bbed742
Fix move single file and test (#1608)
Tbaut Oct 4, 2021
beeb395
bump cypress to v8.5 (#1609)
asnaith Oct 5, 2021
9a961c7
Migrate to API local store cache (#1591)
RyRy79261 Oct 5, 2021
9f9880e
webkit color added (#1612)
tanmoyAtb Oct 6, 2021
600fdce
added resolve browser (#1613)
tanmoyAtb Oct 6, 2021
520bf76
Detect and dismiss toasts in ui tests (#1610)
asnaith Oct 6, 2021
920bc0e
update tests for unsupported preview
FSM1 Oct 7, 2021
99b330b
Transfer multiple files and folders (#1606)
tanmoyAtb Oct 8, 2021
4edeae2
Translations update from Weblate (#1625)
weblate Oct 12, 2021
a3ad4c8
bump cypress to v8.6 (#1628)
asnaith Oct 14, 2021
d23d305
Update api error handling (#1626)
FSM1 Oct 18, 2021
548de6a
Hide network requests from cypress test runner (#1643)
asnaith Oct 19, 2021
1ca85be
[Files] Fix survey banner and sharing explainer (#1634)
Tbaut Oct 19, 2021
5240350
Translated using Weblate (French) (#1645)
weblate Oct 21, 2021
226254c
Fix Webpack Build with node 17 (#1651)
FSM1 Oct 22, 2021
ffe6596
add ui test coverage for the survey banner (#1648)
asnaith Oct 22, 2021
697c2f8
Add Support for heic images (#1618)
FSM1 Oct 22, 2021
90ed9dd
Menu dark mode colors (#1650)
tanmoyAtb Oct 25, 2021
c5dd1c2
[EPIC] Link Sharing (#1632)
Tbaut Oct 25, 2021
9e06503
Translated using Weblate (French) (#1661)
weblate Oct 27, 2021
ea9cc10
add ui test coverage for the sharing explainer (#1659)
asnaith Oct 27, 2021
995513e
Fix toast type when no files successfully shared (#1662)
FSM1 Oct 27, 2021
02f3e17
Update maintenance mode message (#1669)
FSM1 Oct 27, 2021
ac0a204
Make intercepts in tests less version specific (#1658)
asnaith Oct 28, 2021
6e2c4c1
[Files] Fix home page and nav menu display issues on smaller screens …
Tbaut Nov 1, 2021
626ef2c
Update AppNav.tsx (#1689)
Tbaut Nov 1, 2021
bb4d719
Translations update from Weblate (#1686)
weblate Nov 1, 2021
4b6e437
mobile search (#1676)
Tbaut Nov 2, 2021
035326a
[Files] Verfy a sharing link asap and give nice error (#1674)
Tbaut Nov 2, 2021
ce2c5e0
Add basic file sharing ui tests (#1691)
asnaith Nov 3, 2021
f136df2
Show a loader for shared folder, and an error if the user doesn't hav…
Tbaut Nov 3, 2021
742545b
Translated using Weblate (French) (#1697)
weblate Nov 3, 2021
5fcd09a
Improve reliability of file moving test (#1703)
asnaith Nov 4, 2021
8e855d2
add new workflow for ui tests on demand (#1702)
asnaith Nov 4, 2021
ae12e6f
Fix Safari Nav Items invisible (#1709)
FSM1 Nov 4, 2021
dd90eb3
Tweak config of slack notifier (#1710)
asnaith Nov 5, 2021
f9cf67e
Added scroll fi (#1711)
RyRy79261 Nov 5, 2021
29d7e97
Translated using Weblate (French) (#1714)
weblate Nov 8, 2021
eccf059
second section and modal scroll
Tbaut Nov 8, 2021
d22bf0b
cleanup
Tbaut Nov 8, 2021
bee984a
Update packages/files-ui/src/Components/Modules/FileBrowsers/CreateOr…
Tbaut Nov 8, 2021
91739ac
better mobile folder creation
Tbaut Nov 8, 2021
fc4fe77
Merge branch 'fix/tbaut-modal-1664' of github.com:ChainSafe/ui-monore…
Tbaut Nov 8, 2021
1496581
better mobile view
Tbaut Nov 8, 2021
1ac9fb0
Merge branch 'dev' into fix/tbaut-modal-1664
Tbaut Nov 8, 2021
110caa5
lingui extract
actions-user Nov 8, 2021
c735dcd
fix cancel download, content not clearing, search preview content type
FSM1 Nov 8, 2021
5f1d0c7
fix line lengths
FSM1 Nov 8, 2021
c35739b
lingui extract
actions-user Nov 8, 2021
0953c5a
Merge branch 'fix/file-name-repeated-in-the-path-1499' of https://git…
FSM1 Nov 8, 2021
e0e1144
fix indentation
FSM1 Nov 8, 2021
4e2c771
CID cutoff fix (#1713)
tanmoyAtb Nov 9, 2021
4882660
Merge branch 'dev' into fix/tbaut-modal-1664
Tbaut Nov 9, 2021
a447a2a
dialog
Tbaut Nov 9, 2021
c99902c
Merge branch 'fix/tbaut-modal-1664' of github.com:ChainSafe/ui-monore…
Tbaut Nov 9, 2021
d8c1c6e
Merge branch 'dev' into fix/file-name-repeated-in-the-path-1499
FSM1 Nov 9, 2021
c9ad5ad
Header buttons and icons alignments (#1712)
tanmoyAtb Nov 10, 2021
0b667d4
Merge branch 'dev' into fix/file-name-repeated-in-the-path-1499
Tbaut Nov 10, 2021
39579a7
Update packages/files-ui/src/Contexts/FilesContext.tsx
FSM1 Nov 10, 2021
69ea59a
Merge branch 'dev' into fix/tbaut-modal-1664
Tbaut Nov 10, 2021
9ad4c69
Merge pull request #1717 from ChainSafe/fix/file-name-repeated-in-the…
FSM1 Nov 10, 2021
aa6eeeb
Merge branch 'dev' into fix/tbaut-modal-1664
Tbaut Nov 10, 2021
661db55
overflow hidden for any modal
Tbaut Nov 10, 2021
cbfe15e
Merge branch 'fix/tbaut-modal-1664' of github.com:ChainSafe/ui-monore…
Tbaut Nov 10, 2021
9d82b55
Trim email nonce submition (#1723)
Tbaut Nov 10, 2021
10ef94b
Merge branch 'dev' into fix/tbaut-modal-1664
Tbaut Nov 10, 2021
2190e90
Merge pull request #1715 from ChainSafe/fix/tbaut-modal-1664
FSM1 Nov 11, 2021
12953bb
update package
FSM1 Nov 11, 2021
3c0d8ca
fix lookup call params
FSM1 Nov 11, 2021
433961e
wire up new lookup and toggle flag
FSM1 Nov 11, 2021
7e009e1
Adding dynamic positioning to menu drop down (#1719)
RyRy79261 Nov 11, 2021
5de675c
fix close (#1735)
Tbaut Nov 11, 2021
82a7a08
update styling
FSM1 Nov 12, 2021
f34274c
Merge branch 'dev' into feat/user-lookup-flag-1601
FSM1 Nov 12, 2021
2d543d9
add translation
FSM1 Nov 12, 2021
5b4d61a
Merge branch 'feat/user-lookup-flag-1601' of https://github.com/Chain…
FSM1 Nov 12, 2021
4a06602
lingui extract
actions-user Nov 12, 2021
95292ba
fix lint
FSM1 Nov 12, 2021
9c16198
Added blockers (#1730)
RyRy79261 Nov 12, 2021
af7d6e7
Changed mobile click sensitivity (#1705)
RyRy79261 Nov 12, 2021
84f2921
Merge branch 'dev' into feat/user-lookup-flag-1601
FSM1 Nov 15, 2021
be9a994
update label
FSM1 Nov 15, 2021
5b178ca
lingui extract
actions-user Nov 15, 2021
62de2bf
resolve linting errors
FSM1 Nov 15, 2021
24ef31c
Merge pull request #1737 from ChainSafe/feat/user-lookup-flag-1601
FSM1 Nov 15, 2021
3e86cfe
Disabled auto focus safari (#1732)
RyRy79261 Nov 15, 2021
5b3a1e1
Preview Hotkeys work consistently (#1740)
FSM1 Nov 16, 2021
118337d
Fix Preview loading if interrupted (#1738)
FSM1 Nov 16, 2021
fc48fd1
add template for pull requests (#1751)
asnaith Nov 16, 2021
b21a7b8
Bump ssri from 6.0.1 to 6.0.2 (#1747)
dependabot[bot] Nov 16, 2021
92abc31
Bump merge-deep from 3.0.2 to 3.0.3 (#1744)
dependabot[bot] Nov 16, 2021
9784c12
Bump dns-packet from 1.3.1 to 1.3.4 (#1745)
dependabot[bot] Nov 16, 2021
3599ee4
Bump tmpl from 1.0.4 to 1.0.5 (#1741)
dependabot[bot] Nov 16, 2021
6337f63
Bump path-parse from 1.0.6 to 1.0.7 (#1742)
dependabot[bot] Nov 16, 2021
71e7d7e
Bump color-string from 1.5.3 to 1.6.0 (#1743)
dependabot[bot] Nov 16, 2021
4e64f03
Bump hosted-git-info from 2.8.8 to 2.8.9 (#1746)
dependabot[bot] Nov 16, 2021
9addf3e
bump cypress to v9.0 (#1749)
asnaith Nov 16, 2021
6674c0f
Bump url-parse from 1.4.7 to 1.5.3 (#1748)
dependabot[bot] Nov 16, 2021
f994607
Link sharing redesign (#1722)
Tbaut Nov 16, 2021
328b402
Resolved (#1731)
RyRy79261 Nov 16, 2021
0062f31
Add subdirectory for pr template (#1756)
asnaith Nov 17, 2021
d80d513
add test for hotkey navigation in file preview (#1755)
asnaith Nov 17, 2021
9c52fbe
fix video preview overflow (#1752)
FSM1 Nov 17, 2021
ef5e677
Share files from browser support (#1736)
tanmoyAtb Nov 18, 2021
7170268
Revert "copy working" (#1759)
FSM1 Nov 19, 2021
9dc9db8
Translations update from Hosted Weblate (#1753)
weblate Nov 22, 2021
c2ee766
[ImgBot] Optimize images (#1767)
imgbot[bot] Nov 22, 2021
4e867ca
Report modal styles and cut off fix (#1766)
tanmoyAtb Nov 23, 2021
ea0e03f
Fix Mobile Nav Drawer blocks breadcrumb (#1768)
FSM1 Nov 23, 2021
57028b1
secondary colors update (#1769)
tanmoyAtb Nov 23, 2021
99c3cce
File info modal CID and Key copy arrangements (#1773)
tanmoyAtb Nov 24, 2021
a011e6f
fix share transfer modal alignment (#1774)
FSM1 Nov 24, 2021
d1d8b62
move pr template to .github root dir (#1776)
asnaith Nov 24, 2021
484b7f1
UI fix (#1777)
tanmoyAtb Nov 25, 2021
2c1ea37
resolve double tap (#1778)
FSM1 Nov 25, 2021
1335725
Mobile sharing folder rename modal (#1779)
RyRy79261 Nov 25, 2021
558f02c
Merge remote-tracking branch 'origin/dev' into mnt/update-billing-epic
FSM1 Nov 25, 2021
3f91b18
update translations
FSM1 Nov 25, 2021
1dee523
fix lint
FSM1 Nov 25, 2021
ffa9706
Rename with split extension (#1760)
RyRy79261 Nov 25, 2021
7ebbcca
Merge remote-tracking branch 'origin/dev' into mnt/update-billing-epic
FSM1 Nov 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
closes #

---

Submission checklist:

> Remove anything below that is not applicable

- [x] Functionality
- - [x] Feature works as intended after change
- - [x] Applicable dependancies have been deployed

- [x] Layout
- - [x] Change looks good in the desktop web ui
- - [x] Change looks good in the mobile web ui

- [x] Theme
- - [x] Components / elements inspected in light mode
- - [x] Components / elements inspected in dark mode
62 changes: 62 additions & 0 deletions .github/workflows/test-files-on-demand.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Cypress tests - Files (On Demand)
on: [workflow_dispatch]
jobs:
cypress-run:
runs-on: ubuntu-latest
container: cypress/browsers:node14.17.0-chrome91-ff89
steps:
- name: Checkout
uses: actions/checkout@v2

- uses: actions/cache@v2
id: yarn-build-cache
with:
path: |
**/node_modules
~/.cache/Cypress
**/build
key: ${{ runner.os }}-node_modules-files-build-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node_modules-build-

# Install NPM dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress run
uses: cypress-io/github-action@v2
env:
REACT_APP_API_URL: ${{ secrets.GH_REACT_APP_API_URL }}
REACT_APP_BLOCKNATIVE_ID: ${{ secrets.GH_REACT_APP_BLOCKNATIVE_ID }}
REACT_APP_FILES_VERIFIER_NAME: ${{ secrets.GH_REACT_APP_FILES_VERIFIER_NAME }}
REACT_APP_FILES_UUID_VERIFIER_NAME: 'chainsafe-uuid-testnet'
REACT_APP_TEST: 'true'
DEBUG: '@cypress/github-action'
with:
start: yarn start:files-ui
# wait for 10min for the server to be ready
wait-on: 'npx wait-on --timeout 600000 http://localhost:3000'
# custom test command to run
command: yarn test:ci:files-ui
# store the screenshots if the tests fail
- name: Store screenshots
uses: actions/upload-artifact@v1
if: failure()
with:
name: cypress-screenshots
path: packages/files-ui/cypress/screenshots
# store the videos if the tests fail
# - name: Store videos
# uses: actions/upload-artifact@v1
# if: failure()
# with:
# name: cypress-videos
# path: packages/files-ui/cypress/videos

- name: Slack Notification
uses: rtCamp/action-slack-notify@v2.2.0
env:
SLACK_TITLE: 'Files UI Test Suite On-Demand Result:'
SLACK_MESSAGE: ${{ job.status }}
SLACK_COLOR: ${{ job.status }}
MSG_MINIMAL: actions url
SLACK_WEBHOOK: ${{ secrets.SLACK_UI_WEBHOOK }}
SLACK_FOOTER: 'Test run ${{ github.run_number }} was executed on branch: ${{ github.ref }}'
18 changes: 16 additions & 2 deletions packages/common-components/src/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const useStyles = makeStyles(
fill: palette.common.white.main
},
"&:hover": {
backgroundColor: palette.primary.main,
backgroundColor: palette.primary.hover,
color: palette.common.white.main,
...overrides?.Button?.variants?.secondary?.hover
},
Expand All @@ -109,6 +109,20 @@ const useStyles = makeStyles(
},
...overrides?.Button?.variants?.secondary?.root
},
text: {
backgroundColor: "transparent",
color: palette.additional["gray"][9],
"&:hover": {
...overrides?.Button?.variants?.text?.hover
},
"&:focus": {
...overrides?.Button?.variants?.text?.focus
},
"&:active": {
...overrides?.Button?.variants?.text?.active
},
...overrides?.Button?.variants?.text?.root
},
tertiary: {
backgroundColor: palette.additional["gray"][3],
color: palette.common.black.main,
Expand Down Expand Up @@ -293,7 +307,7 @@ interface IButtonProps extends Omit<ReactButton, "size"> {
className?: string
children?: ReactNode | ReactNode[]
fullsize?: boolean
variant?: "link" | "primary" | "secondary" |"tertiary" | "outline" | "dashed" | "danger"
variant?: "link" | "primary" | "secondary" |"tertiary" | "outline" | "dashed" | "danger" | "text"
iconButton?: boolean
size?: "large" | "medium" | "small"
type?: "button" | "submit" | "reset"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const useStyles = makeStyles(
root: {
cursor: "pointer",
display: "flex",
alignItems: "center",
...overrides?.CheckboxInput?.root
},
checkbox: {
Expand Down
3 changes: 0 additions & 3 deletions packages/common-components/src/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ import { Button, IButtonProps } from "../Button"

const useStyles = makeStyles(({ breakpoints, constants }: ITheme) =>
createStyles({
// JSS in CSS goes here
root: {},
inner: {
padding: constants.generalUnit * 2,
borderRadius: 2,
transform: "translate(-50%, 0)",
top: constants.generalUnit * 2,
[breakpoints.down("sm")]: {
maxWidth: `calc(100% - ${constants.generalUnit * 3}px) !important`
}
Expand Down
4 changes: 1 addition & 3 deletions packages/common-components/src/Icons/svgs/document.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 1 addition & 13 deletions packages/common-components/src/Icons/svgs/ethereum-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 59 additions & 9 deletions packages/common-components/src/MenuDropdown/MenuDropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React, { ReactNode, useRef, useState } from "react"
import React, { ReactNode, useCallback, useRef, useState } from "react"
import { makeStyles, createStyles, ITheme, useOnClickOutside } from "@chainsafe/common-theme"
import { Typography } from "../Typography"
import clsx from "clsx"
import { DirectionalDownIcon, SvgIcon } from "../Icons"
import { Paper } from "../Paper"
import { useOnScroll } from "../Scroll/useOnScroll.hook"

const useStyles = makeStyles(
({ constants, animation, typography, palette, overrides }: ITheme) =>
Expand Down Expand Up @@ -83,34 +84,64 @@ const useStyles = makeStyles(
zIndex: 1000,
padding: 0,
"&.top-left": {
top: 0,
"&.up": {
bottom: 0
},
"&.down": {
top: 0
},
left: 0,
...overrides?.MenuDropdown?.options?.position?.topLeft
},
"&.top-center": {
top: 0,
"&.up": {
bottom: 0
},
"&.down": {
top: 0
},
left: "50%",
transform: "translateX(-50%)",
...overrides?.MenuDropdown?.options?.position?.topCenter
},
"&.top-right": {
top: 0,
"&.up": {
bottom: 0
},
"&.down": {
top: 0
},
right: 0,
...overrides?.MenuDropdown?.options?.position?.topRight
},
"&.bottom-left": {
top: "100%",
"&.up": {
bottom: "100%"
},
"&.down": {
top: "100%"
},
left: 0,
...overrides?.MenuDropdown?.options?.position?.bottomLeft
},
"&.bottom-center": {
top: "100%",
"&.up": {
bottom: "100%"
},
"&.down": {
top: "100%"
},
left: "50%",
transform: "translateX(-50%)",
...overrides?.MenuDropdown?.options?.position?.bottomCenter
},
"&.bottom-right": {
top: "100%",
"&.up": {
bottom: "100%"
},
"&.down": {
top: "100%"
},
right: 0,
...overrides?.MenuDropdown?.options?.position?.bottomRight
},
Expand Down Expand Up @@ -168,7 +199,8 @@ interface IMenuDropdownProps {
| "bottom-left"
| "bottom-center"
| "bottom-right"
menuItems?: IMenuItem[]
dynamicAnchor?: boolean
menuItems: IMenuItem[]
title?: string
classNames?: {
icon?: string
Expand Down Expand Up @@ -208,6 +240,24 @@ const MenuDropdown = ({
}
})

const [dropDirection, setDropDirection] = useState<"up" | "down">("down")

const managePosition = useCallback(() => {
// TODO: Debounce
const { offsetTop } = ref.current as unknown as HTMLDivElement

if (offsetTop < window.pageYOffset + (window.innerHeight / 2)) {
setDropDirection("down")
} else {
setDropDirection("up")
}
}, [ref])


useOnScroll({
onScroll: managePosition
})

return (
<div
ref={ref}
Expand Down Expand Up @@ -239,7 +289,7 @@ const MenuDropdown = ({
</section>
<Paper
shadow="shadow2"
className={clsx(classes.options, classNames?.options, anchor, {
className={clsx(classes.options, classNames?.options, anchor, dropDirection, {
["open"]: open
})}
>
Expand Down
Loading