Skip to content

Commit

Permalink
release 3.18.0 (#821)
Browse files Browse the repository at this point in the history
* update draft button (#810)

-remove tag and make clear button only

* update ci

* update ci

* update ci

* update config.yml

* update config.yml

* update config.yml

* update config.yml

* update config.yml

* update config.yml

* update config.yml

* update config.yml

* update config.yml

* update config.yml

* update config.yml

* update config.yml

* update package.json

* update config.yml

* update config.yml

* update config.yml

* configure docker (#811)

* add dockerfile

* add docker compose

* add development deploy script (#812)

* add require in config

* update ci

* remove requires

* add requires

* fix config typo

* use ssh instead of https

* update docker compose version

* fix dockerfile

* updated nginx config

* update dockerfile

* update config

* update CI  (#813)


* add common executor

* update twitter embed (#809)

* update env

* add clean build

* update docker compose

* update nginx

* activate direct domain hyperlinks (#815) (#817)

* expand sharing feature (#788) (#818)

* update character counter

* release 3.18.0 (#821)

* update character counter (#820)

* Expand sharing feature #788 (#818)

* Activate direct domain hyperlinks #815 (#817)

* Update twitter embed (#809)

Co-authored-by: stinkymonkeyph <[email protected]>
  • Loading branch information
aaashir and stinkymonkeyph authored Jul 20, 2021
1 parent d77a062 commit 53d5ae8
Show file tree
Hide file tree
Showing 17 changed files with 380 additions and 88 deletions.
70 changes: 60 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,68 @@
version: 2.1
orbs:
discord: antonioned/[email protected]
commands:
send_status: discord/status
jobs:
build:

executors:
docker-executor:
docker:
- image: node:14.7.0
working_directory: /tmp/dbuzz-client

orbs:
discord: antonioned/[email protected]

commands:
common-steps:
steps:
- checkout
- run: npm install
- run: npm run lint
- run: npm run build:prod
- run: npm run build:dev
- send_status:
webhook: https://discordapp.com/api/webhooks/747082285828014170/6TLGC1_wgAAT91n5s3PYZxC9n2_Tj5BzqHQo2tO9miZxnVGKWusD3YA-pO2GjVvOWzuF

jobs:
prod_build_test:
executor: docker-executor
steps:
- common-steps
- run: npm run build:prod
- discord/status:
success_message: test build success on master branch
failure_message: test build failed on master branch
webhook: https://discordapp.com/api/webhooks/747082285828014170/6TLGC1_wgAAT91n5s3PYZxC9n2_Tj5BzqHQo2tO9miZxnVGKWusD3YA-pO2GjVvOWzuF

dev_build_test:
executor: docker-executor
steps:
- common-steps
- run: npm run build:dev
- discord/status:
success_message: test build success on non master branch
failure_message: test build failed on non master branch
webhook: https://discordapp.com/api/webhooks/747082285828014170/6TLGC1_wgAAT91n5s3PYZxC9n2_Tj5BzqHQo2tO9miZxnVGKWusD3YA-pO2GjVvOWzuF

dev_build_deploy:
machine:
enabled: true
steps:
- run:
name: Deploy over SSH
command: ssh [email protected] 'sudo docker container stop $(sudo docker container ls -aq) || true && sudo docker container rm $(sudo docker container ls -aq) || true && sudo docker image prune -f -a || true && sudo rm -R dbuzz-dev-build/ && git clone -b dev [email protected]:d-buzz/d.buzz-client.git dbuzz-dev-build && cd dbuzz-dev-build/ && sudo docker-compose -f docker-compose.dev.yml up -d --build'
- discord/status:
success_message: development build successfully deployed on https://next.d.buzz
failure_message: development build was not deployed on https://next.d.buzz
webhook: https://discordapp.com/api/webhooks/747082285828014170/6TLGC1_wgAAT91n5s3PYZxC9n2_Tj5BzqHQo2tO9miZxnVGKWusD3YA-pO2GjVvOWzuF

workflows:
environment_builds:
jobs:
- dev_build_test:
filters:
branches:
ignore: master
- prod_build_test:
filters:
branches:
only: master
- dev_build_deploy:
requires:
- dev_build_test
filters:
branches:
only: dev
2 changes: 1 addition & 1 deletion .env.development
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
REACT_APP_VERSION=3.19.0-dev
REACT_APP_VERSION=3.20.0-dev
REACT_APP_SEARCH_API=https://endpoint.d.buzz/api/v1
REACT_APP_SCRAPE_API=https://endpoint.d.buzz/api/v1/meta
REACT_APP_IMAGE_API=https://endpoint.d.buzz/api/v1/imageservice
Expand Down
26 changes: 26 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# pull official base image
FROM node:13.12.0-alpine as build

# set working directory
WORKDIR /app

# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH

# install app dependencies
COPY package.json ./
COPY package-lock.json ./
RUN npm install --silent

# add app
COPY . ./
RUN npm run build:dev

# copy build to nginx
FROM nginx:latest
COPY --from=build /app/build /usr/share/nginx/html

# copy nginx config
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 3002
CMD ["nginx", "-g", "daemon off;"]
11 changes: 11 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3'

services:

development-build:
container_name: dbuzz-development
build:
context: .
dockerfile: Dockerfile.dev
ports:
- '3002:3002'
18 changes: 18 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
server {

listen 3002;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
add_header Cache-Control no-store always;
try_files $uri $uri/ /index.html;
}

error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /usr/share/nginx/html;
}

}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "d.buzz-client",
"version": "3.16.0",
"version": "3.18.0",
"private": true,
"dependencies": {
"@hiveio/hive-js": "^0.8.13",
Expand Down
Binary file added public/twitter-loader.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 13 additions & 7 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { LastLocationProvider } from 'react-router-last-location'
import { createUseStyles } from 'react-jss'
import { Helmet } from 'react-helmet'
import { redirectToUserProfile } from 'services/helper'
import { useLocation } from 'react-router-dom'
import TwitterEmbedAPI from 'components/pages/TwitterEmbedAPI'

const useStyles = createUseStyles(theme => ({
wrapper: {
Expand All @@ -25,6 +27,8 @@ const AppWrapper = ({ children }) => {
}

const App = () => {
const { pathname } = useLocation()
const twitterEmbedRoutes = pathname.match(/^\/twitterEmbed/)

useEffect(() => {
// redirect to user profile if link only contains @username
Expand All @@ -43,13 +47,15 @@ const App = () => {
</Helmet>
<LastLocationProvider>
<ThemeLoader>
<Init>
<AuthGuard>
<AppWrapper>
{renderRoutes(routes)}
</AppWrapper>
</AuthGuard>
</Init>
{!twitterEmbedRoutes ?
<Init>
<AuthGuard>
<AppWrapper>
{renderRoutes(routes)}
</AppWrapper>
</AuthGuard>
</Init> :
<TwitterEmbedAPI />}
</ThemeLoader>
</LastLocationProvider>
</React.Fragment>
Expand Down
31 changes: 26 additions & 5 deletions src/components/common/MarkdownViewer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,8 @@ const getCoinTicker = (coin) => {
}

const render = (content, markdownClass, assetClass, scrollIndex, recomputeRowIndex, classes) => {
content.replace(/^[a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?/gi, n => `<a href=http://${n}>${n}</a>`)

if(content.includes(':twitter:')) {
const splitTwitter = content.split(':')
return <TwitterEmbed key={`${splitTwitter[2]}${scrollIndex}tweet`} tweetId={splitTwitter[2]} />
Expand Down Expand Up @@ -778,12 +780,31 @@ const render = (content, markdownClass, assetClass, scrollIndex, recomputeRowInd
const url = `https://emb.d.tube/#!/${splitDTube[2]}`
return <UrlVideoEmbed key={`${url}${scrollIndex}dtube`} url={url} />
} else {
// render coingecko tickers
if(content.match(/\$([A-Za-z-]+)/gi)){
return <div
key={`${new Date().getTime()}${scrollIndex}${Math.random()}`}
className={classNames(markdownClass, assetClass)}
dangerouslySetInnerHTML={{ __html: renderer.render(
content.replace(/\$([A-Za-z-]+)/gi, n => {return getCoinTicker(n.replace('$', '').toLowerCase()) ? `<a href=https://www.coingecko.com/en/coins/${getCoinTicker(n.replace('$', '').toLowerCase())}/usd#panel>${n}</a>` : n}))}}
/>
// render non (http/https/www) links
} else if(content.match(/^[a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?/gi)){
return <div
key={`${new Date().getTime()}${scrollIndex}${Math.random()}`}
className={classNames(markdownClass, assetClass)}
dangerouslySetInnerHTML={{ __html: renderer.render(
content.replace(/^[a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?/gi, n => `<a href=http://${n}>${n}</a>`))}}
/>
}
// render normally
return <div
key={`${new Date().getTime()}${scrollIndex}${Math.random()}`}
className={classNames(markdownClass, assetClass)}
dangerouslySetInnerHTML={{ __html: renderer.render(content.replace(/\$([A-Za-z-]+)/gi, n => {return getCoinTicker(n.replace('$', '').toLowerCase()) ? `<a href=https://www.coingecko.com/en/coins/${getCoinTicker(n.replace('$', '').toLowerCase())}/usd#panel>${n}</a>` : n})) }}
/>
else {
return <div
key={`${new Date().getTime()}${scrollIndex}${Math.random()}`}
className={classNames(markdownClass, assetClass)}
dangerouslySetInnerHTML={{ __html: renderer.render(content)}}
/>
}
}

}
Expand Down
57 changes: 55 additions & 2 deletions src/components/common/PostActions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { isMobile } from 'react-device-detect'
import { setDefaultVotingWeightRequest } from 'store/settings/actions'
import { FacebookShareButton, FacebookIcon } from 'react-share'
import { FacebookShareButton, FacebookIcon, TelegramShareButton, TelegramIcon, WhatsappShareButton, WhatsappIcon, LinkedinShareButton, LinkedinIcon, FacebookMessengerShareButton, FacebookMessengerIcon, TwitterShareButton, TwitterIcon } from 'react-share'
import MenuItem from '@material-ui/core/MenuItem'
import Menu from '@material-ui/core/Menu'
import { invokeTwitterIntent } from 'services/helper'

const PrettoSlider = withStyles({
root: {
Expand Down Expand Up @@ -183,6 +184,10 @@ const useStyles = createUseStyles(theme => ({
backgroundColor: theme.background.primary,
...theme.font,
},
shareIcon: {
padding: 8,
background: 'red',
},
}))

const ActionWrapper = ({ className, inlineClass, icon, stat, hideStats, onClick, disabled = false, tooltip = null, statOnClick = () => {} }) => {
Expand Down Expand Up @@ -236,6 +241,8 @@ const PostActions = (props) => {
defaultUpvoteStrength,
} = props

const FACEBOOK_APP_ID = 236880454857514

let payoutAdditionalStyle = {}
let iconDetails = {}

Expand Down Expand Up @@ -470,6 +477,15 @@ const PostActions = (props) => {
open={Boolean(openCaret)}
onClose={closeMenu}
>
<MenuItem className={classes.menuText}>
<TwitterShareButton
onClick={() => {
setOpenCaret(false)
}}
>
<TwitterIcon size={32} round={true} onClick={() => invokeTwitterIntent(body)} />
</TwitterShareButton>
</MenuItem>
<MenuItem className={classes.menuText}>
<FacebookShareButton
url={`https://d.buzz/#/@${author}/c/${permlink}`}
Expand All @@ -478,9 +494,46 @@ const PostActions = (props) => {
setOpenCaret(false)
}}
>
<FacebookIcon size={32} round={true} className="mr-1"/>
<FacebookIcon size={32} round={true} />
</FacebookShareButton>
</MenuItem>
<MenuItem className={classes.menuText}>
<FacebookMessengerShareButton
url={`https://d.buzz/#/@${author}/c/${permlink}`}
appId={FACEBOOK_APP_ID}
onClick={() => {
setOpenCaret(false)
}}
>
<FacebookMessengerIcon size={32} round={true} />
</FacebookMessengerShareButton>
</MenuItem>
<MenuItem>
<TelegramShareButton
url={`https://d.buzz/#/@${author}/c/${permlink}`}
title={body}
onClick={() => {setOpenCaret(false)}}>
<TelegramIcon size={32} round={true} />
</TelegramShareButton>
</MenuItem>
<MenuItem>
<WhatsappShareButton
url={`https://d.buzz/#/@${author}/c/${permlink}`}
title={body}
onClick={() => {setOpenCaret(false)}}>
<WhatsappIcon size={32} round={true} />
</WhatsappShareButton>
</MenuItem>
<MenuItem>
<LinkedinShareButton
url={`https://d.buzz/#/@${author}/c/${permlink}`}
title={body}
summary={body}
source={'DBuzz'}
onClick={() => {setOpenCaret(false)}}>
<LinkedinIcon size={32} round={true} />
</LinkedinShareButton>
</MenuItem>
</Menu>
</div>
</Col>
Expand Down
Loading

0 comments on commit 53d5ae8

Please sign in to comment.