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

subsocial #458

Merged
merged 48 commits into from
Jun 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
4cbc316
WIP: latest subsocial
vikiival Jun 5, 2021
edac4d9
fixed packages
vikiival Jun 5, 2021
49f39a0
Guess What
vikiival Jun 5, 2021
2647624
Merge remote-tracking branch 'origin/main' into subsocial
vikiival Jun 6, 2021
071513e
199 back on track
vikiival Jun 6, 2021
07044bd
199 flexing
vikiival Jun 6, 2021
accdf54
199 comments WIP
vikiival Jun 6, 2021
edbc732
199 WIP reply should work at this moment
vikiival Jun 6, 2021
a82ca3c
199 fails on PostExtension/Comment
vikiival Jun 6, 2021
9a2c196
199 Upvote works
vikiival Jun 7, 2021
1025559
199 can post <3
vikiival Jun 8, 2021
a7aad57
199 working post + small css flex
vikiival Jun 8, 2021
a6a3649
199 in case of fire
vikiival Jun 10, 2021
dfa26c3
199 ready for posting on subsocial
vikiival Jun 10, 2021
1daa4a3
199 in case of fire
vikiival Jun 11, 2021
5f91544
199 post should work
vikiival Jun 11, 2021
dc41129
fixed post resolving
vikiival Jun 14, 2021
ada70e2
199 flexed translations
vikiival Jun 14, 2021
c2982e3
199 added translation
vikiival Jun 14, 2021
8e9ce80
199 translations
vikiival Jun 14, 2021
5541742
199 base comment works
vikiival Jun 14, 2021
881345d
199 fixed reply
vikiival Jun 14, 2021
3ad74a9
199 disabled
vikiival Jun 15, 2021
c3ca4e4
199 know why Loader works
vikiival Jun 15, 2021
4353955
should have listener for tx
vikiival Jun 15, 2021
7cdff39
199 added users reaction
vikiival Jun 17, 2021
cccc2ba
Merge remote-tracking branch 'origin/main' into subsocial
vikiival Jun 17, 2021
714700f
199 magic for likes
vikiival Jun 17, 2021
f070b08
Merge remote-tracking branch 'origin/main' into subsocial
vikiival Jun 17, 2021
c7ece3e
199 handling reactions
vikiival Jun 17, 2021
0988b1b
199 can do magic
vikiival Jun 17, 2021
bcd1f9d
199 can
vikiival Jun 17, 2021
5eee338
199 trying to hack comments
vikiival Jun 17, 2021
96d2dfc
Like loader working
vikiival Jun 18, 2021
b54584e
replaced loaded with permanent notification
vikiival Jun 18, 2021
1310ff3
199 final touches
vikiival Jun 18, 2021
1a5c2f0
Merge remote-tracking branch 'origin/main' into subsocial
vikiival Jun 18, 2021
befd57c
199 updated to newest @subsocial
vikiival Jun 18, 2021
9d3fede
199 fixed pr comments
vikiival Jun 21, 2021
ebea763
Merge remote-tracking branch 'origin/main' into subsocial
vikiival Jun 21, 2021
776f3bd
can show total comments
vikiival Jun 22, 2021
b9ce7aa
Merge remote-tracking branch 'origin/main' into subsocial
vikiival Jun 22, 2021
c39e92d
Merge branch 'main' into subsocial
yangwao Jun 23, 2021
4323f08
199 updating subsocial api to 0.5.8
vikiival Jun 23, 2021
ff79669
Merge branch 'subsocial' of github.com:kodadot/nft-gallery into subso…
vikiival Jun 23, 2021
e920278
199 seems like RPC node lags behind
vikiival Jun 23, 2021
56a4c6a
199 subsocial faucet
vikiival Jun 23, 2021
55799ae
199 pinkish line
vikiival Jun 24, 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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,5 @@ typings/
.yarn-integrity

# dotenv environment variables file
.env
.env
.vscode/
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
"@polkadot/util": "^6.9.1",
"@polkadot/util-crypto": "^6.9.1",
"@polkadot/vue-identicon": "^0.81.1",
"@subsocial/api": "^0.5.8",
"@subsocial/types": "^0.5.8",
"@subsocial/utils": "^0.4.39",
"@textile/hub": "^6.1.2",
"@types/file-saver": "^2.0.2",
"@vue-polkadot/vue-api": "^0.0.34",
Expand Down
41 changes: 41 additions & 0 deletions src-functions/pinPost.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import axios from "axios"

exports.handler = async (event, context) => {


// const location = event.queryStringParameters.location || "home";
const BASE_URL = 'https://staging.subsocial.network/offchain/v1/ipfs/add';
const object = event.body;

try {
const { status, data } = await axios.post(BASE_URL, object, {
headers: {
'Content-Type': 'application/json',
},
});
console.log('[SUBSOCIAL] Pin JSON', status, data);

if (status < 400) {
return {
statusCode: status,
body: data,
};
}


} catch (e) {
console.log('Error', e.message)
return {
statusCode: 500,
body: e.message,
};
}

return {
statusCode: status,
body: "",
};


};

46 changes: 46 additions & 0 deletions src-functions/requestFaucet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import axios from "axios"

exports.handler = async (event, context) => {


const address = event.queryStringParameters.address;
const email = event.queryStringParameters.email;

if (!email || !address) {
return {
statusCode: 403,
body: `Cannot search without query`,
};
}

const BASE_URL = `https://app.subsocial.network/offchain/v1/offchain/faucet/confirm`;

const object = {
account: address,
email
};

try {
const { status, data } = await axios.post(BASE_URL, object, {
headers: {
'Content-Type': 'application/json',
},
});
console.log('[SUBSOCIAL] Faucet', status);

return {
statusCode: status,
body: JSON.stringify(data),
};


} catch (e) {
console.log('Error', e.message)
return {
statusCode: 500,
body: e.message,
};
}

};

40 changes: 40 additions & 0 deletions src-functions/searchPost.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import axios from "axios"

exports.handler = async (event, context) => {


const query = event.queryStringParameters.query;

if (!query) {
return {
statusCode: 403,
body: `Cannot search without query`,
};
}

const BASE_URL = `https://app.subsocial.network/offchain/v1/offchain/search?indexes=posts&q=${query}&offset=0&limit=20`;

try {
const { status, data } = await axios.get(BASE_URL, {
headers: {
'Content-Type': 'application/json',
},
});
console.log('[SUBSOCIAL] Search', status);

return {
statusCode: status,
body: JSON.stringify(data),
};


} catch (e) {
console.log('Error', e.message)
return {
statusCode: 500,
body: e.message,
};
}

};

3 changes: 2 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Navbar from './components/Navbar.vue';
import Footer from './components/Footer.vue';
import isShareMode from '@/utils/isShareMode'
import coingecko from '@/coingecko'
import correctFormat from '@/utils/ss58Format'

@Component<Dashboard>({
metaInfo() {
Expand Down Expand Up @@ -54,7 +55,7 @@ export default class Dashboard extends Vue {
public async loadKeyring(): Promise<void> {
const isDevelopment = process.env.VUE_APP_KEYRING === 'true'
keyring.loadAll({
ss58Format: isDevelopment ? 0 : this.ss58Format || 42,
ss58Format: correctFormat(this.ss58Format),
type: 'sr25519',
isDevelopment,
});
Expand Down
9 changes: 9 additions & 0 deletions src/assets/subsocial.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions src/components/rmrk/Create/AttributeTagInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ export default class extends Vue {
@Prop() public value!: Attribute[];
@Prop({ default: 3 }) public max!: string | number;
@Prop({ default: 'Select tags or create your own' }) public placeholder!: string;
@Prop(Boolean) public simple!: boolean

get tags() {
return this.value ? this.value.map(valueOf) : []
return this.simple ? (this.value || []) as any[] as string[] : (this.value || []).map(valueOf)
}

set tags(value: string[]) {
Expand All @@ -51,7 +52,7 @@ export default class extends Vue {

@Emit('input')
handleInput(value: string[]) {
return value.map(v => ({ value: v }))
return this.simple ? value : value.map(v => ({ value: v }))
}
}
</script>
2 changes: 1 addition & 1 deletion src/components/rmrk/Gallery/EmotionList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ export default class extends Vue {
}

#emoji-box {
border: 2px solid $primary;
border: 2px solid $primary;
}
</style>
31 changes: 20 additions & 11 deletions src/components/rmrk/Gallery/GalleryItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@
</template>
</div>
</div>
<hr class="comment-divider" />
<BaseCommentSection :nft="nft" :meta="meta" />
</div>

</div>
</template>

Expand All @@ -117,12 +120,12 @@ import { NFT, NFTMetadata, Emotion, Emote } from '../service/scheme';
import { sanitizeIpfsUrl, resolveMedia } from '../utils';
import { emptyObject } from '@/utils/empty';

import AvailableActions from './AvailableActions.vue';
// import AvailableActions from './AvailableActions.vue';
import { notificationTypes, showNotification } from '@/utils/notification';
import Money from '@/components/shared/format/Money.vue';
import Sharing from '@/components/rmrk/Gallery/Item/Sharing.vue';
import Facts from '@/components/rmrk/Gallery/Item/Facts.vue';
import Name from '@/components/rmrk/Gallery/Item/Name.vue';
// import Money from '@/components/shared/format/Money.vue';
// import/ Sharing from '@/components/rmrk/Gallery/Item/Sharing.vue';
// import Facts from '@/components/rmrk/Gallery/Item/Facts.vue';
// import Name from '@/components/rmrk/Gallery/Item/Name.vue';

import isShareMode from '@/utils/isShareMode';
import nftById from '@/queries/nftById.graphql'
Expand Down Expand Up @@ -152,15 +155,16 @@ import axios from 'axios';
},
components: {
Auth: () => import('@/components/shared/Auth.vue'),
AvailableActions,
Facts,
AvailableActions: () => import('./AvailableActions.vue'),
Facts: () => import('@/components/rmrk/Gallery/Item/Facts.vue'),
// MarkdownItVueLight: MarkdownItVueLight as VueConstructor<Vue>,
Money,
Name,
Sharing,
Money: () => import('@/components/shared/format/Money.vue'),
Name: () => import('@/components/rmrk/Gallery/Item/Name.vue'),
Sharing: () => import('@/components/rmrk/Gallery/Item/Sharing.vue'),
Appreciation: () => import('./Appreciation.vue'),
MediaResolver: () => import('../Media/MediaResolver.vue'),
PackSaver: () => import('../Pack/PackSaver.vue')
PackSaver: () => import('../Pack/PackSaver.vue'),
BaseCommentSection: () => import('@/components/subsocial/BaseCommentSection.vue')
}
})
export default class GalleryItem extends Vue {
Expand Down Expand Up @@ -289,6 +293,11 @@ export default class GalleryItem extends Vue {
<style lang="scss">
@import "@/styles/variables";

hr.comment-divider {
border-top: 1px solid lightpink;
border-bottom: 1px solid lightpink;
}

.gallery-item {
.nft-title {
margin-bottom: 24px;
Expand Down
9 changes: 9 additions & 0 deletions src/components/rmrk/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import api from '@/fetch';
import { RmrkType, RmrkWithMetaType, CollectionOrNFT } from './service/RmrkService';
import { NFTMetadata, Collection, PackMetadata, NFT, NFTWithMeta } from './service/scheme';
import { justHash } from '@/utils/ipfs';

export const SQUARE = '::'
export const DEFAULT_IPFS_PROVIDER = 'https://ipfs.io/';
Expand All @@ -25,6 +26,14 @@ export const ipfsProviders: Record<ProviderKeyType, string> = {
kodadot: 'https://kodadot.mypinata.cloud/',
}

export const ipfsHashToUrl = (ipfsHash?: string, provider?: ProviderKeyType) => {
if (justHash(ipfsHash)) {
return `${resolveProvider(provider)}ipfs/${ipfsHash}`
}

return ipfsHash
}

const resolveProvider = (key: ProviderKeyType = 'kodadot') => ipfsProviders[key]

export const zip = <T1, T2, T3>(a: T1[], b: T2[], cb?: (el: (T1 | T2)[]) => T3): T3[] | (T1 | T2)[][] => {
Expand Down
36 changes: 20 additions & 16 deletions src/components/shared/modals/ModalWrapper.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<template>
<div>
<b-button
class="button"
:type="buttonType"
:icon-left="icon"
:expanded="expanded"
@click="isModalActive = true"
:class="{ 'modal-wrapper-button__right': isRight }"
>
<template v-if="label">{{ label }}</template>
</b-button>
<slot name="trigger" v-bind:handleOpen="handleOpen">
<b-button
class="button"
:type="buttonType"
:icon-left="icon"
:expanded="expanded"
@click="handleOpen"
:class="{ 'modal-wrapper-button__right': isRight }"
>
<template v-if="label">{{ label }}</template>
</b-button>
</slot>
<b-modal :active.sync="isModalActive">
<div class="card">
<header class="card-header">
Expand All @@ -30,18 +32,20 @@ import { Component, Vue, Prop, Watch } from 'vue-property-decorator';

@Component
export default class ModalWrapper extends Vue {

@Prop() public label!: string;
@Prop() public icon!: string;
@Prop() public type!: string;
@Prop() public expanded!: boolean;
@Prop() public isRight!: boolean;
@Prop(String) public label!: string;
@Prop(String) public icon!: string;
@Prop(String) public type!: string;
@Prop(Boolean) public expanded!: boolean;
@Prop(Boolean) public isRight!: boolean;
private isModalActive: boolean = false;

get buttonType() {
return this.type || 'is-primary';
}

protected handleOpen() {
this.isModalActive = true;
}
}
</script>

Expand Down
Loading