-
Notifications
You must be signed in to change notification settings - Fork 0
Production-level concerns #77
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
Open
skitterm
wants to merge
11
commits into
master
Choose a base branch
from
another-branch
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
73aeb4d
Dependency upgrades
mctester9 d1326c4
Dropdown added
mctester9 ba53af8
Smaller-sized avatar
mctester9 c925271
Dropdown made better
mctester9 7e19498
Packages all installed at once
mctester9 ebccfc7
Server compiles and boots on same command
mctester9 d1a8919
Demo mode UI
mctester9 9165189
ObjectID type used instead of string
mctester9 04bf90e
Extra quote removed
mctester9 3b0191a
Procfile added
mctester9 c3589ac
Update procfile
mctester9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| web: node ../server/built/server.mjs |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| import React, { | ||
| FC, | ||
| useState, | ||
| useEffect, | ||
| useRef, | ||
| MouseEvent, | ||
| ReactElement, | ||
| } from "react"; | ||
| import styled from "styled-components"; | ||
| import variables from "../../styles/variables" | ||
|
|
||
| const AnchorContainer = styled.div` | ||
| position: relative; | ||
| `; | ||
|
|
||
| const Anchor = styled.button` | ||
| position: relative; | ||
| border: none; | ||
| background-color: transparent; | ||
| padding: 2px; | ||
| cursor: pointer; | ||
|
|
||
| &:hover { | ||
| background-color: ${variables.color.offWhite}; | ||
| } | ||
| `; | ||
| const Popover = styled.ul` | ||
| position: absolute; | ||
| bottom: 0; | ||
| right: 0; | ||
| z-index: 1; | ||
| transform: translateY(100%); | ||
| min-width: 100px; | ||
| background-color: ${variables.color.white}; | ||
| box-shadow: 1px 1px 5px 1px rgba(30,30,30,0.3); | ||
| list-style-type: none; | ||
| padding: 0; | ||
| margin: 0; | ||
| `; | ||
|
|
||
| const PopoverItem = styled.li` | ||
| white-space: nowrap; | ||
|
|
||
| & + & { | ||
| border-top: 1px solid ${variables.color.offWhite}; | ||
| } | ||
| `; | ||
|
|
||
| const PopoverItemButton = styled.button` | ||
| appearance: none; | ||
| background: none; | ||
| border: none; | ||
| text-align: right; | ||
| width: 100%; | ||
| padding: 10px; | ||
| cursor: pointer; | ||
|
|
||
| &:hover { | ||
| background-color: ${variables.color.offWhite}; | ||
| } | ||
| `; | ||
|
|
||
| interface DropdownItem { | ||
| id: string; | ||
| label: string; | ||
| onClick: () => void; | ||
| } | ||
|
|
||
| interface Props { | ||
| target: ReactElement; | ||
| items: DropdownItem[]; | ||
| } | ||
|
|
||
| const Dropdown: FC<Props> = (props) => { | ||
| const [isShowing, setIsShowing] = useState(false); | ||
| const anchorRef = useRef<HTMLButtonElement | undefined>(undefined); | ||
|
|
||
| useEffect(() => { | ||
| const closeDropdown = (event: Event) => { | ||
| if (!anchorRef.current?.contains(event.target as HTMLElement)) { | ||
| setIsShowing(false); | ||
| } | ||
| }; | ||
|
|
||
| document.addEventListener("click", closeDropdown); | ||
|
|
||
| return () => { | ||
| document.removeEventListener("click", closeDropdown); | ||
| }; | ||
| }); | ||
|
|
||
| return ( | ||
| <AnchorContainer> | ||
| <Anchor | ||
| // @ts-ignore | ||
| ref={anchorRef} | ||
| onClick={(event: MouseEvent) => { | ||
| console.log("event handler"); | ||
| event.stopPropagation(); | ||
| setIsShowing(!isShowing); | ||
| }} | ||
| > | ||
| {props.target} | ||
|
|
||
| </Anchor> | ||
| {isShowing && <Popover>{props.items.map(item => ( | ||
| <PopoverItem key={item.id}> | ||
| <PopoverItemButton onClick={item.onClick}>{item.label}</PopoverItemButton> | ||
| </PopoverItem> | ||
| ))}</Popover>} | ||
| </AnchorContainer> | ||
| ); | ||
| }; | ||
|
|
||
| export default Dropdown; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import React from "react"; | ||
| import styled from "styled-components"; | ||
| import { User } from "../../types"; | ||
| import Button from "../Button"; | ||
| import Avatar from "../Avatar"; | ||
|
|
||
|
|
||
| const ListItem = styled.li` | ||
| display: flex; | ||
| align-items: center; | ||
| margin-bottom: 64px; | ||
| `; | ||
|
|
||
| const Details = styled.div` | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: flex-start; | ||
| margin-left: 16px; | ||
| `; | ||
|
|
||
| const ItemTitle = styled.h3` | ||
| margin-top: 0; | ||
| `; | ||
|
|
||
|
|
||
| interface Props { | ||
| users: User[]; | ||
| onItemClick: (user: User) => void; | ||
| itemButtonLabel: string; | ||
| } | ||
|
|
||
| class UsersList extends React.Component<Props> { | ||
| constructor(props: Props) { | ||
| super(props); | ||
| } | ||
|
|
||
| public render() { | ||
| return ( | ||
| <ul> | ||
| {this.props.users.map((user) => { | ||
| return ( | ||
| <ListItem key={user._id}> | ||
| <Avatar thumbnail={user.thumbnail} size="medium" /> | ||
| <Details> | ||
| <ItemTitle> | ||
| {user.name.first} {user.name.last} | ||
| </ItemTitle> | ||
| <Button onClick={this.props.onItemClick.bind(this, user)}> | ||
| {this.props.itemButtonLabel} | ||
| </Button> | ||
| </Details> | ||
| </ListItem> | ||
| ); | ||
| })} | ||
| </ul> | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| export default UsersList; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't needed for now.