Skip to content

Refactoring. #1177

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
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ module.exports = {
// add your custom rules here
rules: {
'arrow-parens': 'off',
'import/no-named-as-default-member': 'off',
'no-console': 'off',
'no-irregular-whitespace': 'off',
'prefer-promise-reject-errors': 'off',
4 changes: 0 additions & 4 deletions app/app.html
Original file line number Diff line number Diff line change
@@ -3,10 +3,6 @@

<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#">
<% if (process.env.ALIS_APP_ID === 'alis') { %>
<!-- Google AdSense -->
<script data-ad-client="ca-pub-6184356842528918" async
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- End Google AdSense -->
<script src="https://www.googleoptimize.com/optimize.js?id=OPT-5FJ3HPK"></script>
<% } else { %>
<script src="https://www.googleoptimize.com/optimize.js?id=OPT-P9KC4QC"></script>
5 changes: 5 additions & 0 deletions app/assets/stylesheets/fontAwesome/css/all.min.css

Large diffs are not rendered by default.

Binary file not shown.
3,442 changes: 3,442 additions & 0 deletions app/assets/stylesheets/fontAwesome/webfonts/fa-brands-400.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
803 changes: 803 additions & 0 deletions app/assets/stylesheets/fontAwesome/webfonts/fa-regular-400.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4,649 changes: 4,649 additions & 0 deletions app/assets/stylesheets/fontAwesome/webfonts/fa-solid-900.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -33,8 +33,8 @@
</template>

<script>
/* global Web3 */
import { mapGetters, mapActions } from 'vuex'
import Web3 from 'web3'
import AppButton from '../atoms/AppButton'

export default {
Original file line number Diff line number Diff line change
@@ -34,9 +34,9 @@
</template>

<script>
/* global Web3 */
import { mapGetters, mapActions } from 'vuex'
import { ADD_TOAST_MESSAGE } from 'vuex-toast'
import Web3 from 'web3'
import AppButton from '../atoms/AppButton'

export default {
2 changes: 1 addition & 1 deletion app/components/organisms/ArticleHeader.vue
Original file line number Diff line number Diff line change
@@ -51,12 +51,12 @@
</template>

<script>
/* global Web3 */
import { mapActions, mapGetters } from 'vuex'
import { BigNumber } from 'bignumber.js'
import { ADD_TOAST_MESSAGE } from 'vuex-toast'
import { isV2 } from '~/utils/article'
import { isMobile } from '~/utils/device'
import Web3 from 'web3'

export default {
props: {
2 changes: 1 addition & 1 deletion app/components/organisms/LaboNLicenseTokenDropzone.vue
Original file line number Diff line number Diff line change
@@ -14,11 +14,11 @@
</template>

<script>
/* global Web3 */
import { mapActions, mapGetters } from 'vuex'
import Dropzone from 'nuxt-dropzone'
import 'nuxt-dropzone/dropzone.css'
import { ADD_TOAST_MESSAGE } from 'vuex-toast'
import Web3 from 'web3'

export default {
components: {
2 changes: 1 addition & 1 deletion app/components/organisms/LaboNLicenseTokenList.vue
Original file line number Diff line number Diff line change
@@ -21,8 +21,8 @@
</template>

<script>
/* global Web3 */
import { mapActions, mapGetters } from 'vuex'
import Web3 from 'web3'

const LaboNLicenseTokenCertificateModal = () =>
import('../organisms/LaboNLicenseTokenCertificateModal')
2 changes: 1 addition & 1 deletion app/components/pages/DepositToken.vue
Original file line number Diff line number Diff line change
@@ -74,7 +74,6 @@
</template>

<script>
/* global Web3 */
import { mapGetters, mapActions } from 'vuex'
import { ADD_TOAST_MESSAGE } from 'vuex-toast'
import { BigNumber } from 'bignumber.js'
@@ -83,6 +82,7 @@ import WalletNav from '../organisms/WalletNav'
import TheLoader from '../atoms/TheLoader'
import AppButton from '../atoms/AppButton'
import AppFooter from '../organisms/AppFooter'
import Web3 from 'web3'
import { addDigitSeparator, isOverDecimalPoint } from '~/utils/wallet'

const formatNumber = 10 ** 18
2 changes: 1 addition & 1 deletion app/components/pages/LaboNLicenseToken.vue
Original file line number Diff line number Diff line change
@@ -59,14 +59,14 @@
</template>

<script>
/* global Web3 */
import AppHeader from '~/components/organisms/AppHeader'
import AppFooter from '~/components/organisms/AppFooter'
import LaboNLicenseTokenDropzone from '~/components/organisms/LaboNLicenseTokenDropzone'
import LaboNLicenseTokenList from '~/components/organisms/LaboNLicenseTokenList'
import TheLoader from '../atoms/TheLoader'
import AppButton from '../atoms/AppButton'
import { isMobile } from '~/utils/device'
import Web3 from 'web3'

export default {
components: {
2 changes: 1 addition & 1 deletion app/components/pages/WithdrawalDetails.vue
Original file line number Diff line number Diff line change
@@ -45,14 +45,14 @@
</template>

<script>
/* global Web3 */
import { mapGetters, mapActions } from 'vuex'
import { ADD_TOAST_MESSAGE } from 'vuex-toast'
import { BigNumber } from 'bignumber.js'
import AppHeader from '../organisms/AppHeader'
import WalletNav from '../organisms/WalletNav'
import AppFooter from '../organisms/AppFooter'
import TheLoader from '../atoms/TheLoader'
import Web3 from 'web3'
import { formatDateWithTime } from '~/utils/format'
import { showPaymentType, showProcessType, showFormattedAmount } from '~/utils/wallet'

43 changes: 26 additions & 17 deletions app/pages/_userId/articles/_articleId/index.vue
Original file line number Diff line number Diff line change
@@ -44,7 +44,8 @@ export default {
}
await Promise.all([
store.dispatch(`article/${getArticleType}`, { articleId }),
store.dispatch('article/getArticleSupporters', { articleId })
store.dispatch('article/getArticleSupporters', { articleId }),
store.dispatch('article/getTopics')
])
await Promise.all([
store.dispatch('user/getTopUserPopularArticles', {
@@ -63,7 +64,6 @@ export default {
}`
)
}
await store.dispatch('article/getTopics')
store.dispatch('article/setTopicDisplayName', {
topicName: store.state.article.article.topic
})
@@ -83,13 +83,15 @@ export default {
const { articleId } = this.$route.params
if (this.loggedIn) {
if (this.currentUser.phoneNumberVerified) await this.postPv({ articleId })
await this.getIsLikedArticle({ articleId })
await this.updateArticleCommentsByCommentIds({ articleId })

// 自分の記事の場合は getPublicArticleDetail より記事情報を取得する。
// 但し、fetch 時に取得済みの場合は実施しない
if (this.isCurrentUser && !this.$store.state.article.isFetchedPublicArticle) {
await this.$store.dispatch('article/getPublicArticleDetail', { articleId })
await Promise.all([
this.getIsLikedArticle({ articleId }),
this.updateArticleCommentsByCommentIds({ articleId }),
this.$store.dispatch('article/getPublicArticleDetail', { articleId }),
await this.setArticleComments({ articleId })
])
this.$store.dispatch('article/setIsFetchedPublicArticle', { isFetched: true })
const paywallLine = document.querySelector('.paywall-line')
if (paywallLine) {
@@ -99,7 +101,12 @@ export default {
// 記事を購入していた場合は getPurchaedArticleDetail より記事情報を取得する。
// 但し、fetch 時に取得済みの場合は実施しない
} else if (!this.isCurrentUser && !this.$store.state.article.isFetchedPurchasedArticle) {
await this.$store.dispatch('article/setPurchasedArticleIds')
await Promise.all([
this.getIsLikedArticle({ articleId }),
this.updateArticleCommentsByCommentIds({ articleId }),
await this.$store.dispatch('article/setPurchasedArticleIds'),
await this.setArticleComments({ articleId })
])
const isPurchased =
this.loggedIn && this.$store.state.article.purchasedArticleIds.includes(articleId)
if (isPurchased) {
@@ -111,9 +118,8 @@ export default {
}
} else {
this.setIsLikedArticle({ liked: false })
await this.setArticleComments({ articleId })
}
// コメント取得
await this.setArticleComments({ articleId })
},
computed: {
isCurrentUser() {
@@ -138,15 +144,8 @@ export default {
const decodedArticleOverview = htmlDecode(article.overview)
const eyeCatchUrl = article.eye_catch_url ? `${article.eye_catch_url}?d=1200x630` : null

return {
const headValue = {
title: decodedArticleTitle,
link: [
{
rel: 'stylesheet',
href:
'https://cdnjs.cloudflare.com/ajax/libs/medium-editor-insert-plugin/2.4.1/css/medium-editor-insert-plugin.min.css'
}
],
meta: [
{
hid: `og:title`,
@@ -177,6 +176,16 @@ export default {
}
]
}
if (!isV2(this.article)) {
headValue.link = [
{
rel: 'stylesheet',
href:
'https://cdnjs.cloudflare.com/ajax/libs/medium-editor-insert-plugin/2.4.1/css/medium-editor-insert-plugin.min.css'
}
]
}
return headValue
}
}
</script>
2 changes: 1 addition & 1 deletion app/utils/web3.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global Web3 */
import Web3 from 'web3'
const Common = require('ethereumjs-common').default
const Tx = require('ethereumjs-tx').Transaction

12 changes: 2 additions & 10 deletions nuxt.config.js
Original file line number Diff line number Diff line change
@@ -15,11 +15,6 @@ module.exports = {
{
src: `//cdn.iframe.ly/embed.js?api_key=${process.env.IFRAMELY_API_KEY}&omit_script=1`,
async: true
},
{
// web3 を npm から追加すると、インポート時に SSR で落ちるようになってしまうため、CDN から読み込んでいる。
src: '//cdn.jsdelivr.net/gh/ethereum/web3.js@1.0.0-beta.34/dist/web3.min.js',
defer: true
}
],
__dangerouslyDisableSanitizersByTagID: {
@@ -75,10 +70,6 @@ module.exports = {
{
rel: 'shortcut icon',
href: `https://${process.env.ALIS_APP_DOMAIN}/d/nuxt/dist/touch-icon.png`
},
{
rel: 'stylesheet',
href: 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css'
}
]
},
@@ -175,7 +166,8 @@ module.exports = {
'~assets/stylesheets/vuex-toast.scss',
'@alisproject/alis-editor/dist/AlisEditor.css',
'~/assets/stylesheets/gruvbox-dark-modified.css',
'~assets/stylesheets/ckeditor-view.scss'
'~assets/stylesheets/ckeditor-view.scss',
'~assets/stylesheets/fontAwesome/css/all.min.css'
],
env: {
IFRAMELY_API_KEY: process.env.IFRAMELY_API_KEY,
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -58,7 +58,8 @@
"url-regex": "^4.1.1",
"vue-numeric-input": "^1.0.6",
"vuelidate": "^0.7.5",
"vuex-toast": "^0.1.3"
"vuex-toast": "^0.1.3",
"web3": "^1.7.4"
},
"devDependencies": {
"@babel/core": "^7.11.6",
Loading