diff --git a/Dockerfile b/Dockerfile index 4cc9e00c..04ab5d36 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,10 @@ FROM node:7.5 +ARG SOURCE_COMMIT +ENV SOURCE_COMMIT ${SOURCE_COMMIT} +ARG DOCKER_TAG +ENV DOCKER_TAG ${DOCKER_TAG} + # yarn > npm #RUN npm install --global yarn diff --git a/README.md b/README.md index c2238465..31fd851e 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ # Condenser -Condenser is the react.js web interface to the world's first and best blockchain-based social media platform, smoke.io. It uses [STEEM](https://github.com/steemit/steem), a blockchain powered by Graphene 2.0 technology to store JSON-based content for a plethora of web applications. +Condenser is the react.js web interface to the world's first and best blockchain-based social media platform, smoke.io. It uses [SMOKE](https://github.com/steemit/steem), a blockchain powered by Graphene 2.0 technology to store JSON-based content for a plethora of web applications. ## Why would I want to use Condenser (smoke.io front-end)? -* Learning how to build blockchain-based web applications using STEEM as a content storage mechanism in react.js +* Learning how to build blockchain-based web applications using SMOKE as a content storage mechanism in react.js * Reviewing the inner workings of the smoke.io social media platform * Assisting with software development for smoke.io @@ -49,19 +49,12 @@ mkdir tmp Install at least Node v7.5 if you don't already have it. We recommend using `nvm` to do this as it's both the simplest way to install and manage installed version(s) of node. If you need `nvm`, you can get it at [https://github.com/creationix/nvm](https://github.com/creationix/nvm). -Condenser is known to successfully build using node 7.5, npm 4.1.2, and yarn 1.1.0. - -Using nvm, you would install like this: -```bash -nvm install v7.5 -``` - -We use the yarn package manager instead of the default `npm`. There are multiple reasons for this, one being that we have `steem-js` built from source pulling the github repo as part of the build process and yarn supports this. This way the library that handles keys can be loaded by commit hash instead of a version name and cryptographically verified to be exactly what we expect it to be. Yarn can be installed with `npm`, but afterwards you will not need to use `npm` further. +We use the yarn package manager instead of the default `npm`. There are multiple reasons for this, one being that we have `smoke-js` built from source pulling the github repo as part of the build process and yarn supports this. This way the library that handles keys can be loaded by commit hash instead of a version name and cryptographically verified to be exactly what we expect it to be. Yarn can be installed with `npm`, but afterwards you will not need to use `npm` further. ```bash npm install -g yarn yarn global add babel-cli -yarn install +yarn install --frozen-lockfile yarn run build ``` To run condenser in production mode, run: @@ -80,7 +73,7 @@ yarn run start It will take quite a bit longer to start in this mode (~60s) as it needs to build and start the webpack-dev-server. -By default you will be connected to smoke.io's public steem node at `wss://steemd.steeemit.com`. This is actually on the real blockchain and you would use your regular account name and credentials to login - there is not an official separate testnet at this time. If you intend to run a full-fledged site relying on your own, we recommend looking into running a copy of `steemd` locally instead [https://github.com/steemit/steem](https://github.com/steemit/steem). +By default you will be connected to smoke.io's public steem node. This is actually on the real blockchain and you would use your regular account name and credentials to login - there is not an official separate testnet at this time. If you intend to run a full-fledged site relying on your own, we recommend looking into running a copy of `smoked` locally instead [https://github.com/smokenetwork/smoke](https://github.com/smokenetwork/smoke). #### Configuration @@ -113,7 +106,7 @@ Once set up, you can set the mysql server configuration option for condenser usi Example: ```bash -export SDC_DATABASE_URL="mysql://root:password@127.0.0.1/steemit_dev" +export SDC_DATABASE_URL="mysql://root:password@127.0.0.1/smoke_dev" ``` Here are instructions for setting up a mysql server and running the necessary migrations by operating system: @@ -146,10 +139,10 @@ GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; FLUSH PRIVILEGES; ``` -Now launch mysql client and create steemit_dev database: +Now launch mysql client and create smoke_dev database: ```bash mysql -u root -> create database steemit_dev; +> create database smoke_dev; > quit ``` @@ -188,6 +181,12 @@ Test the interactive console: ```bash user@example:~$ tarantool ``` +#### Debugging SSR code + +`yarn debug` will build a development version of the codebase and then start the +local server with `--inspect-brk` so that you can connect a debugging client. +You can use Chromium to connect by finding the remote client at +`chrome://inspect/#devices`. #### Style Guides For Submitting Pull Requests diff --git a/config/default.json b/config/default.json index 54fb36bf..a8a7e27a 100644 --- a/config/default.json +++ b/config/default.json @@ -32,9 +32,9 @@ "google_analytics_id": "UA-106330268-3", "helmet": { "directives": { - "childSrc": "'self' www.youtube.com staticxx.facebook.com w.soundcloud.com open.spotify.com player.vimeo.com www.theweedtube.com emb.d.tube player.twitch.tv www.twitch.tv gleam.io js.gleam.io", + "childSrc": "'self' emb.d.tube player.twitch.tv www.youtube.com staticxx.facebook.com w.soundcloud.com open.spotify.com player.vimeo.com www.theweedtube.com emb.d.tube player.twitch.tv www.twitch.tv gleam.io js.gleam.io", "connectSrc": "'self' smoke.io rpc.smoke.io https://rpc.smoke.io wss://rpc.smoke.io pubrpc.smoke.io api.smoke.io", - "defaultSrc": "'self' www.youtube.com staticxx.facebook.com player.vimeo.com open.spotify.com", + "defaultSrc": "'self' emb.d.tube www.youtube.com staticxx.facebook.com player.vimeo.com open.spotify.com", "fontSrc": "data: fonts.gstatic.com", "frameAncestors": "'none'", "imgSrc": "* data:", @@ -78,9 +78,9 @@ } }, "server_session_secret": "exiKdyF+IwRIXJDmtGIl4vWUz4i3eVSISpfZoeYc0s4=", - "session_cookie_key": "stm-dev", - "session_key": "steemses", - "site_domain": "steemitdev.com", + "session_cookie_key": "smk-dev", + "session_key": "smokeses", + "site_domain": "smoke.io", "tarantool": { "host": "localhost", "password": "", diff --git a/doc/LICENSE.md b/doc/LICENSE.md index b5494d99..cd538fae 100644 --- a/doc/LICENSE.md +++ b/doc/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) 2016 Smoke, Inc., and contributors. +Copyright (c) 2020 Smoke, Inc., and contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/doc/release-notes.txt b/doc/release-notes.txt deleted file mode 100644 index 06bc6d33..00000000 --- a/doc/release-notes.txt +++ /dev/null @@ -1,336 +0,0 @@ ---------------------------------------------------------------------- -0.1.170324 ---------------------------------------------------------------------- - -New features --------- - - use twilio to verify phone numbers #1232 - - show order ops in wallet #1144 - - switch to invisible recaptcha #1244 - - votes icon refresh #1110 - - add busy to external links #1117 - - simplified/refreshed post hero #1207 - - add post json routes #1122 - - markdown headings in sans #1184 - - add payout sorts #1137 - -Bug fixes --------- - - replace usage of mode prop #1260 - - fix account recovery issue #1257 - - update login dialog titles, copy #1251 - - handle double-encoded json bug #1249 - - disable spellcheck on transfer #1248 - - use blue circle stroke on upvote #1242 - - show follow mute button for guests #1217 - - prevent anchor tags breaking #1218 - - support ctrl clicking on authors #1220 - - show apr in saving balance #1228 - - update README.md #1208 - - add TOC to FAQ Page #1106 - - conv tracking for banner signup #1183 - - no signup link authenticate #1176 - - post quote update #1198 - - add Banner & TOC to Welcome page #1130 - - fix depth check on Comments #1204 - - add commas to view count #1199 - - update CONTRIBUTING.md #1193 - - critical telesign bugfix #1191 - - add fb and ga config env #1185 - - update readme for tarantool #1142 - - hide signup prompt on active key login #1265 - - add app manifest #1266 - - ---------------------------------------------------------------------- -0.1.170216 ---------------------------------------------------------------------- - -New features --------- - - markdown image upload #1026 - - create CONTRIBUTING.md #1141 - - dockerization, config module, node 7.5 #1108 - - add phist to alternative post viewers #1150 - - do not linkify exe and zip urls #1087 - -Bug fixes --------- - - fetch more followers in batch #1097 - - fall back to rshares sort for comments #1099 - - adjust author heading #1101 - - move the "Smoke Chat" link higher in the main menu #1102 - - adjust graying and post collapsing rules #1124 - - move witness proxy to bottom of page #1104 - - restore page title when closing modal with ESC #1123 - - cleanup unused import, eslint #1125 - - improve byline handling in mobile view #1112 - - FollowSaga: fix ternary op, eslint #1111 - - update json profile #1120 - - rollback to loading fb plugin on page load #1151 - - disable autocorrect on wallet page #1143 - - address large svgs problem #1152 - - fix HtmlReady regression #1157 - - wrap transfer memo text properly #1156 - - fix invalid vote state bug #1154 - - ---------------------------------------------------------------------- -0.1.170201 ---------------------------------------------------------------------- - -New features --------- - - show author's userpic below the title on post page #1051 - - smaller server response size & flag refactor #1054 - - remove flag count on posts #1039 - - post performance #1016 - - lighten post link color #1044 - - setting page consistency #1056 - - load fb sdk only when needed #1049 - - link to block explorer from post #1063, #1077 - - Parse metadata when returning user JSON #1037 - - use large twitter card, fallback to profile image #1053 - -Bug fixes --------- - - fix web push notifications undefined url issue on Android #1079 - - fix scrollable close sign on post modal #1078 - - cannot read property bug #1060 - - fix Comments tab truncation #1085 - - use on chain account reg fee instead of config if larger #1069 - - fix upvote slider positioning on mobile & state #1068 - - capitalized steem verbiage for consistency #1048 - - ---------------------------------------------------------------------- -0.1.170121 ---------------------------------------------------------------------- - -New features --------- - - Add plain description meta tag #982 - - Remove filtering of trending options for time being #983 - - Do not confirm clearing of reply form when body is empty #985 - - Meta description should be name, not property #989 - - Show Author dropdown for non-logged in users #991 - - Adjust rephide -- add threshold #1010 - - Update profile header for semantic upgrade, adjust styling to match old #1001 - - #844 protect for invalid user pages allow for short post urls #1011 - - 958 web push notifications #1007 - - Add profile pics support to notifications #1017 - - Support blacklisted phone prefixes #1015 - -Bug fixes --------- - - Save json_metadata youtube preview image url for iframe embedds. fix #995 - - Clarify wording of wallet actions, fix #990 - - Usernames element for reblogged_by array compat #994 - - ---------------------------------------------------------------------- -0.1.161261 ---------------------------------------------------------------------- - -New features --------- - - Strict checking of profile url #979 - - TagsIndex revamp #806 - - Parse block quote from text if preview text is rendered as comment #955 - - Prepend nested comments with dots #942 - - Welcome Page Copyedit Changes for #923 - - Update default wallet estimated balance tip message, update en and ru… #921 - - Add a last-minute check to ensure one phone per account #917 - - Add 3x support for thumbnail previews for post previews to remove fuz… #940 - - 914 user thumbnails #934 - - 915 resteem button feeds mobile #937 - - Add metadata to nsfw post summaries #956 - - Update verbiage for flag tooltip for distribution/rewards, update loc… #957 - -Bug fixes --------- - - Fix phone verification issue #922 - - Fix translation issue on account recovery page #908 - - Patch route user #883 - - Fix account page 500 error #897 - - Comment edit bug 895 #954 - - Confirm clearing of post form. fix #970 - - ---------------------------------------------------------------------- -0.1.161221 ---------------------------------------------------------------------- - -New features --------- - - Mixpanel Social Sharing Tracking #881 - - Json route user #869 - - nsfw handling #861 - - ability to sort comments by upvotes #808 - - username routes 404 #851 - - utilize new get follow count #845 - - update react & babel #843 - - never hide flags #858 - - allow refetching of pages #593 - - make cookie name configurable #852 - -Bug fixes --------- - - Patch route user #883 - - Increase nodejs framesize #873 - - should fix some inconsistent post overlay scrolling behavior #863 - - mark fsevents as optional dep (fixes linux instal issue with npm ~4.0.3) #850 - - phone is considered to be used only if there is account created with it #841 - - username should appear in header prefixed with #855 - - typesafe json metadata #868 - - Refactor class name for best practice conventional naming #871 - - ---------------------------------------------------------------------- -0.1.161214 ---------------------------------------------------------------------- - - - ability to set witness proxy voter #797 - - add muted user list on Settings page #834 - - add zebra stripes to wallet page #818 - - allow votes dropdown to expand past post modal #836 - - always show comment collapser #835 - - fix phone verification issue #839 - - clarify power down error message #838 - - disable follow buttons while pending #832 - - translation of markets #604 - - mixpanel - track more events #828 - - add contributors.md #825 - - support for secure server sessions #823 - - fix post footer promo text #822 - - translation of blocktrades deposit #821 - - display pending conversions & add them to account value #804 - - fix follow counts #802 - - fix unknown account flashing #801 - - login/transfer updates, autofill username #798 - - prevent post footer wrapping #781 - - ---------------------------------------------------------------------- -0.1.161205 ---------------------------------------------------------------------- - - - proper inflection for vote count #794 - - update econ rules copy #793 - - remove high security key in overlay #791 - - @author/permlink redirect #786 - - normalize profile url #785 - - enforce display names not starting with `@` #780 - - show 'since date' for view counts on old posts #779 - - handle off screen click on resteem confirm #778 - - revert youtube previews to lower resolution #777 - - remove 0.15.0 compat layer, re-enable Promoted posts #776 - - refactor follow data structure #774 - - fix prop warnings - npm cleanup #773 - - fix potential firefox bug - not able to scroll a post #767 - - refactoring of market state #758 - - ---------------------------------------------------------------------- -0.1.161202 ---------------------------------------------------------------------- - -New features --------- - - views counter #744 - - profile customization #737 - - full power badge #748 - - add current open orders to wallet balances #740 - -Bug fixes --------- - - various market bug fixes and price warning #728 - - performance tweaks: minimize rendering and API calls #738 - - fix witness votes not appearing for logged in user #741 - - add support for vimeo auto embed #731 - - fix obscure bug which causes certain keys to trigger back event #754 - - fix follow mute button alignment for mobile display #753 - - do not show dropdown for comments with 0 votes #747 - - fix bug preventing declined payout post from being edited #743 - - handle malformed categories in url #742 - - fix share menu scrolling behavior #739 - - adjust password data-entry error wording #736 - - clarify dangerous-html flag usage #733 - - remove fastclick for JS dropdown conflicts #727 - - allow links to open in new tab without closing menu #726 - - add padding for avatar on collapsed state #717 - - display previous title when closing post modal #709 - - remove negative top margin on comment footer #714 - - ---------------------------------------------------------------------- -0.1.161123 ---------------------------------------------------------------------- - - - Add welcome page #585 (@timcliff, @bitcoiner) - - Fix joined date on mobile #629 (@bitcoiner) - - Add a "settings" link to the drop-down menu #618 (@bitcoiner) - - Fix wallet UI glitches on mobile #633 (@bitcoiner) - - Hide follow counts until loaded #632 - - Hamburger menu clarifications #635 (@bitcoiner) - - Add support for renamed API key #637 - - Do not hide dropdown menu on ctrl-click #641 - - Strikethrough payout amount for declined payout posts #644 - - Fix reputation (float) bug #643 - - i18n: fix reply count var and singular counts #649 - - Better support for non-lowercase tags and mentions #659 - - Fix showing of category error #659 - - Fix auto-vote + decline payout bug #650 - - Remove dup exports #657 - - Update follows api logic with backwards compat for share-db upgrade #669 - - Fix react-addons-perf and update shrinkwrap #670 - - Ensure lowercase user names for page titles #661 - - Fix comment sort order label #671 - - Properly handle relative links #603 - - Support for new tags and tag_idx state #689 - - Fix multiple account creation per verification issue #692 - - Cleanup & i18n for awards pages #658 (@bitcoiner) - - Replace showSignUp with redirect to sign up's first step #694 - - Fix follow loading status, invert shared-db follows api fix #695 - - Replace showSignUp with redirect to sign up's first step #694 - - Allow email verification resend if expired #691 - - Fix sign up issue that could allow attacker to create up to 8 accounts per single verification #625 - - ---------------------------------------------------------------------- -0.1.161109 ---------------------------------------------------------------------- - -New features and improvements --------- -- custom user profile images -- show dynamic sbd interest in user's wallet -- new submenu on the wallet page - -Bug fixes --------- -- remove estimates, just show 7-day summary #600 -- own reply notifications appear on other users' account pages #595 - - ---------------------------------------------------------------------- -0.1.161104 ---------------------------------------------------------------------- - -New features and improvements --------- -- In app notifications #584 -- New confirmation dialog for resteeming action #572 -- New Profile display user join steem date #582 -- New hyperlink on post timestamp for content -- Inclusive of Smoke API docs sub menu -- Youtube preview improvements #588 - -Bug fixes --------- -- fixes for user wallet views/actions #528 -- fixes rewards balances #528 -- TypeError: Cannot read property 'get' of undefined #238 -- remove ReplyEditor__title padding #570 -- Show message when no post results #571 -- do not display invalid cashout_time #532 diff --git a/package.json b/package.json index 6d98632b..061b40ac 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,11 @@ "type": "git", "url": "https://github.com/smokenetwork/webapp.git" }, - "version": "0.1.0", + "version": "0.1.2", "description": "smoke.io is the koa web server & middleware and react.js in-browser code for the world's first blockchain content + social media monetization platform!", "main": "index.js", "scripts": { - "build": "NODE_ENV=production ./node_modules/babel-cli/bin/babel-node.js ./node_modules/.bin/webpack --config ./webpack/prod.config.js; rm -rf ./lib; NODE_ENV=production babel --plugins transform-runtime,transform-inline-environment-variables src --out-dir lib -Dq", + "build": "NODE_ENV=production ./node_modules/babel-cli/bin/babel-node.js ./node_modules/.bin/webpack --config ./webpack/prod.config.js; rm -rf ./lib; mkdir lib; rm -rf tmp; mkdir tmp; NODE_ENV=production babel --plugins transform-runtime,transform-inline-environment-variables src --out-dir lib -Dq", "mocha": "NODE_ENV=test mocha ./mocha.setup.js", "test": "npm run mocha -- src/app/**/*.test.js src/shared/**/*.test.js", "test:watch:all": "npm test -- --watch --watch-extensions jsx", @@ -23,8 +23,7 @@ "license": "MIT", "dependencies": { "@sendgrid/mail": "^6.2.1", - "@smokenetwork/smoke-js": "^0.1.2", - "@steem/crypto-session": "git+https://github.com/steemit/crypto-session.git#83a90b319ce5bc6a70362d52a15a815de7e729bb", + "@smokenetwork/smoke-js": "^0.1.5", "assert": "^1.3.0", "autoprefixer-loader": "^3.2.0", "aws-sdk": "^2.409.0", @@ -83,6 +82,8 @@ "koa-router": "^5.4.0", "koa-session": "^3.3.1", "koa-static-cache": "^3.1.2", + "libsodium": "0.4.8", + "libsodium-wrappers": "0.4.8", "lodash.debounce": "^4.0.7", "medium-editor-insert-plugin": "^2.3.2", "mem-stat": "^1.0.5", @@ -110,7 +111,7 @@ "react-portal": "^2.2.1", "react-prop-types": "^0.3.0", "react-qr": "0.0.2", - "react-rangeslider": "1.0.3", + "react-rangeslider": "2.2.0", "react-redux": "^5.0.6", "react-router": "^3.0.5", "react-router-redux": "^4.0.0", diff --git a/src/app/assets/stylesheets/app.scss b/src/app/assets/stylesheets/app.scss index a16071cb..4a622f32 100644 --- a/src/app/assets/stylesheets/app.scss +++ b/src/app/assets/stylesheets/app.scss @@ -16,7 +16,6 @@ @import "./forms"; @import "./markdown"; -@import "./notifications"; @import "src/app/components/all"; /* Small only */ @@ -150,5 +149,3 @@ h1, h2, h3, h4, h5, h6 { display: inline; color: red; } - - diff --git a/src/app/assets/stylesheets/foundation-overrides.scss b/src/app/assets/stylesheets/foundation-overrides.scss index 97c81219..8f4dcd38 100644 --- a/src/app/assets/stylesheets/foundation-overrides.scss +++ b/src/app/assets/stylesheets/foundation-overrides.scss @@ -66,7 +66,12 @@ hr { } .close-button { + position: absolute; + cursor: pointer; transition: color 0.2s ease-in-out; + top: 0.5rem; + font-size: 2em; + line-height: 1; @include themify($themes) { color: themed('textColorSecondary'); } @@ -121,6 +126,22 @@ tbody tr:nth-child(even) { } } +.progress { + border: none; + width: 100%; + height: 8px; + border-radius: 3px; + background-color:$color-border-light; + div { + @include themify($themes) { + background-color: themed('backgroundColor'); + } + border-radius: 3px; + border: none; + height: 8px; + } +} + .button { text-transform: none; @@ -133,4 +154,3 @@ tbody tr:nth-child(even) { } } } - diff --git a/src/app/assets/stylesheets/markdown.scss b/src/app/assets/stylesheets/markdown.scss index 42a6f3eb..0d4bf966 100644 --- a/src/app/assets/stylesheets/markdown.scss +++ b/src/app/assets/stylesheets/markdown.scss @@ -81,6 +81,10 @@ word-break: normal; // issue #146 } + table thead th { + word-break: normal; + } + p { font-size: 100%; line-height: 150%; @@ -159,5 +163,3 @@ } } } - - diff --git a/src/app/assets/stylesheets/notifications.scss b/src/app/assets/stylesheets/notifications.scss deleted file mode 100644 index abf9495f..00000000 --- a/src/app/assets/stylesheets/notifications.scss +++ /dev/null @@ -1,5 +0,0 @@ -.notification-bar { - max-width: 40rem !important; - background-color: rgba(70, 70, 70, .7) !important; - margin-bottom: 2rem !important; -} diff --git a/src/app/components/App.jsx b/src/app/components/App.jsx index 6fbc7709..784b1ae0 100644 --- a/src/app/components/App.jsx +++ b/src/app/components/App.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import {Link} from 'react-router'; import {connect} from 'react-redux'; import AppPropTypes from '../utils/AppPropTypes'; @@ -11,7 +12,7 @@ import TopRightMenuMobile from './modules/TopRightMenuMobile'; import {browserHistory} from 'react-router'; import classNames from 'classnames'; import SidePanel from './modules/SidePanel'; -import CloseButton from 'react-foundation-components/lib/global/close-button'; +import CloseButton from './elements/CloseButton'; import Dialogs from './modules/Dialogs'; import Modals from './modules/Modals'; import Icon from './elements/Icon'; @@ -314,12 +315,12 @@ class App extends React.Component { } App.propTypes = { - error: React.PropTypes.string, + error: PropTypes.string, children: AppPropTypes.Children, - location: React.PropTypes.object, - loginUser: React.PropTypes.func.isRequired, - depositSmoke: React.PropTypes.func.isRequired, - username: React.PropTypes.string, + location: PropTypes.object, + loginUser: PropTypes.func.isRequired, + depositSmoke: PropTypes.func.isRequired, + username: PropTypes.string, }; export default connect( @@ -346,5 +347,3 @@ export default connect( showEligible: () => dispatch(user.actions.showEligible()), }) )(App); - - diff --git a/src/app/components/App.scss b/src/app/components/App.scss index b54392eb..ddf2f5cd 100644 --- a/src/app/components/App.scss +++ b/src/app/components/App.scss @@ -1,3 +1,5 @@ +@import "./cards/TransferHistoryRow"; + .App { min-height: 100vh; padding-top: 50px; diff --git a/src/app/components/all.scss b/src/app/components/all.scss index 6233b8b3..be2d9628 100644 --- a/src/app/components/all.scss +++ b/src/app/components/all.scss @@ -14,9 +14,8 @@ @import "./elements/Voting"; @import "./elements/FormattedAsset"; @import "./elements/ReplyEditor"; -@import "./elements/NotifiCounter"; @import "./elements/DropdownMenu"; -@import "./elements/FoundationDropdownMenu"; +@import "./elements/Dropdown"; @import "./elements/VerticalMenu"; @import "./elements/HorizontalMenu"; @import "./elements/VotesAndComments"; diff --git a/src/app/components/cards/CardView.js b/src/app/components/cards/CardView.js index b5d00903..d53cc737 100644 --- a/src/app/components/cards/CardView.js +++ b/src/app/components/cards/CardView.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import {connect} from 'react-redux' import Link from '../elements/Link' import g from '../../redux/GlobalReducer' @@ -9,14 +10,14 @@ import tt from 'counterpart'; class CardView extends React.Component { static propTypes = { // HTML properties - formId: React.PropTypes.string, - canEdit: React.PropTypes.bool, + formId: PropTypes.string, + canEdit: PropTypes.bool, // redux or html - metaLinkData: React.PropTypes.object, + metaLinkData: PropTypes.object, // redux - clearMetaElement: React.PropTypes.func, + clearMetaElement: PropTypes.func, } static defaultProps = { canEdit: false diff --git a/src/app/components/cards/CategorySelector.jsx b/src/app/components/cards/CategorySelector.jsx index 2da7cd2c..7ca75230 100644 --- a/src/app/components/cards/CategorySelector.jsx +++ b/src/app/components/cards/CategorySelector.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import {connect} from 'react-redux' import shouldComponentUpdate from '../../utils/shouldComponentUpdate' import {cleanReduxInput} from '../../utils/ReduxForms' @@ -7,18 +8,18 @@ import tt from 'counterpart'; class CategorySelector extends React.Component { static propTypes = { // HTML props - id: React.PropTypes.string, // DOM id for active component (focusing, etc...) - autoComplete: React.PropTypes.string, - placeholder: React.PropTypes.string, - onChange: React.PropTypes.func.isRequired, - onBlur: React.PropTypes.func.isRequired, - isEdit: React.PropTypes.bool, - disabled: React.PropTypes.bool, - value: React.PropTypes.string, - tabIndex: React.PropTypes.number, + id: PropTypes.string, // DOM id for active component (focusing, etc...) + autoComplete: PropTypes.string, + placeholder: PropTypes.string, + onChange: PropTypes.func.isRequired, + onBlur: PropTypes.func.isRequired, + isEdit: PropTypes.bool, + disabled: PropTypes.bool, + value: PropTypes.string, + tabIndex: PropTypes.number, // redux connect (overwrite in HTML) - trending: React.PropTypes.object.isRequired, // Immutable.List + trending: PropTypes.object.isRequired, // Immutable.List } static defaultProps = { autoComplete: 'on', diff --git a/src/app/components/cards/Comment.jsx b/src/app/components/cards/Comment.jsx index a4c6d4d7..20e7589d 100644 --- a/src/app/components/cards/Comment.jsx +++ b/src/app/components/cards/Comment.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import Author from '../elements/Author'; import ReplyEditor from '../elements/ReplyEditor'; import MarkdownViewer from './MarkdownViewer'; @@ -51,6 +52,10 @@ export function sortComments(cont, comments, sort_order) { return a.get('active_votes').filter(vote => vote.get('percent') > 0).size } + function authorReputation(a) { + return a.get('author_reputation'); + } + /** sorts replies by upvotes, age, or payout */ const sort_orders = { votes: (a, b) => { @@ -85,7 +90,12 @@ export function sortComments(cont, comments, sort_order) { } // If SBD payouts were equal, fall back to rshares sorting return netRshares(bcontent).compare(netRshares(acontent)) - } + }, + author_reputation: (a, b) => { + return ( + authorReputation(cont.get(b)) - authorReputation(cont.get(a)) + ); + }, } comments.sort(sort_orders[sort_order]); } @@ -93,22 +103,27 @@ export function sortComments(cont, comments, sort_order) { class CommentImpl extends React.Component { static propTypes = { // html props - cont: React.PropTypes.object.isRequired, - content: React.PropTypes.string.isRequired, - sort_order: React.PropTypes.oneOf(['votes', 'new', 'trending']).isRequired, - root: React.PropTypes.bool, - showNegativeComments: React.PropTypes.bool, - onHide: React.PropTypes.func, - noImage: React.PropTypes.bool, + cont: PropTypes.object.isRequired, + content: PropTypes.string.isRequired, + sort_order: PropTypes.oneOf([ + 'votes', + 'new', + 'trending', + 'author_reputation' + ]).isRequired, + root: PropTypes.bool, + showNegativeComments: PropTypes.bool, + onHide: PropTypes.func, + noImage: PropTypes.bool, // component props (for recursion) - depth: React.PropTypes.number, + depth: PropTypes.number, // redux props - username: React.PropTypes.string, - rootComment: React.PropTypes.string, - anchor_link: React.PropTypes.string.isRequired, - deletePost: React.PropTypes.func.isRequired, + username: PropTypes.string, + rootComment: PropTypes.string, + anchor_link: PropTypes.string.isRequired, + deletePost: PropTypes.func.isRequired, }; static defaultProps = { depth: 1, @@ -184,12 +199,17 @@ class CommentImpl extends React.Component { if (content) { const hide = hideSubtree(props.cont, props.content) const gray = content.getIn(['stats', 'gray']) + + const author = content.get('author'); + const { username } = this.props; + const notOwn = username !== author; + if (hide) { const {onHide} = this.props // console.log('Comment --> onHide') if (onHide) onHide() } - this.setState({hide, hide_body: hide || gray}) + this.setState({ hide, hide_body: notOwn && (hide || gray) }); } } @@ -231,6 +251,13 @@ class CommentImpl extends React.Component { if (!dis) { return
{ABOUT_FLAG}
- Flag -- {name} - | -{numberWithCommas(tag.get('top_posts').toString())} | -{numberWithCommas(tag.get('comments').toString())} | -{numberWithCommas(tag.get('total_payouts'))} | -
+ {name} + | +{numberWithCommas(tag.get('top_posts').toString())} | +{numberWithCommas(tag.get('comments').toString())} | +{numberWithCommas(tag.get('total_payouts'))} | +