Skip to content

Commit

Permalink
Merge pull request #16 from uwidcit/posts-page
Browse files Browse the repository at this point in the history
Posts page
  • Loading branch information
kwasi-dev authored Aug 18, 2023
2 parents 636f734 + 86d7db0 commit dd6e46a
Show file tree
Hide file tree
Showing 7 changed files with 371 additions and 313 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
},
"devDependencies": {
"@quasar/app": "^3.0.0",
"@quacar/cli": "^2.2.1",
"@quasar/quasar-app-extension-qcalendar": "^4.0.0-beta.2",
"dotenv": "^16.0.1",
"quasar-app-extension-qhierarchy": "^1.0.0-alpha.1"
Expand Down
49 changes: 29 additions & 20 deletions src/components/Comments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<div class="q-mr-sm box_comment" :style="indent" id="rcorners3" >
<div class="row justify-center">
<div class="col">
<q-avatar >
<img src="https://cdn.quasar.dev/img/boy-avatar.png">
</q-avatar>
<q-avatar>
<img src="{{ node.user.profile_image }}">
</q-avatar>
{{ label }}
</div>

Expand Down Expand Up @@ -42,19 +42,23 @@

</div>

<div v-if="showChildren">
<!-- <div v-if="increaseDepth()>0"> -->
<comments
v-for="(node, index) in nodes"
:key="index"
:nodes="node.replies"
:label="node.text"
:depth="depth + 1"
:id="node.id"
:topic="1"
:date="node.created_date"
>
</comments>

<!-- </div> -->

<comments
v-if="showChildren"
v-for="(node, index) in nodes"
:key="index"
:nodes="node.replies"
:label="node.text"
:depth="depth + 1"
:id="node.id"
:topic="node.topicId"
:date="node.created"
>
</comments>
</div>
</div>
</template>

Expand All @@ -71,7 +75,7 @@ import { formatDistance} from 'date-fns'
data() {
return {
showChildren: false,
showChildren: ref(false),
createReply: false
}
},
Expand All @@ -97,15 +101,15 @@ import { formatDistance} from 'date-fns'
const $q = useQuasar()
function datePassed(time) {
console.log(Date.parse(time))
console.log(formatDistance(Date.parse(time), new Date(), { addSuffix: true }))
// console.log(Date.parse(time))
// console.log(formatDistance(Date.parse(time), new Date(), { addSuffix: true }))
return formatDistance(Date.parse(time), new Date(), { addSuffix: true })
}
function createNewComment(message){
console.log("creating new comment")
console.log(message)
api.post("https://swarmnet-prod.herokuapp.com/replies", {
api.post(process.env.BASE_URL+"/replies", {
"topic_id": props.topic,
"text": message,
"replyTo": props.id,
Expand Down Expand Up @@ -137,8 +141,13 @@ import { formatDistance} from 'date-fns'
})
})
}
function increaseDepth(){
let depth = this.depth
this.depth = this.depth + 1
return depth
}
return{
increaseDepth,
createNewComment,
text,
datePassed
Expand Down
Loading

0 comments on commit dd6e46a

Please sign in to comment.