Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
khanzadimahdi committed Aug 16, 2024
1 parent 7e076ca commit 50efcd7
Show file tree
Hide file tree
Showing 51 changed files with 3,079 additions and 1,392 deletions.
35 changes: 18 additions & 17 deletions frontend/components/card/large.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
<template>
<div class="card border-0 mb-4 box-shadow h-xl-300">
<div :style="{backgroundImage: `url(${coverUrl})`, height: '150px', backgroundSize: 'cover', backgroundRepeat: 'no-repeat'}"></div>
<div class="card-body px-0 pb-0 d-flex flex-column align-items-start">
<h2 class="h4 fw-bold">
<a class="text-dark" :href="href">{{ title }}</a>
</h2>
<p class="card-text">{{ excerpt }}</p>
<div>
<small class="d-block">
<a class="text-muted" href="#">Favid Rick</a>
</small>
<time :datetime="publishedAt" class="text-muted small">{{ useTime().toAgo(publishedAt) }}</time>
</div>
</div>
<div class="card border-0 mb-4 box-shadow h-xl-300">
<div
:style="{backgroundImage: `url(${coverUrl})`, height: '150px', backgroundSize: 'cover', backgroundRepeat: 'no-repeat'}"></div>
<div class="card-body px-0 pb-0 d-flex flex-column align-items-start">
<h2 class="h4 fw-bold">
<a class="text-dark" :href="href">{{ title }}</a>
</h2>
<p class="card-text">{{ excerpt }}</p>
<div>
<small class="d-block">
<a class="text-muted" href="#">Favid Rick</a>
</small>
<time :datetime="publishedAt" class="text-muted small">{{ useTime().toAgo(publishedAt) }}</time>
</div>
</div>
</div>
</template>

<script setup>
const props = defineProps(["cover", "href", "title", "excerpt", "publishedAt"])
const {cover, href, title, excerpt, publishedAt} = props
const coverUrl = cover ? useFilesUrlResolver().resolve(cover) : null
const props = defineProps(["cover", "href", "title", "excerpt", "publishedAt"])
const {cover, href, title, excerpt, publishedAt} = props
const coverUrl = cover ? useFilesUrlResolver().resolve(cover) : null
</script>
6 changes: 3 additions & 3 deletions frontend/components/card/list/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<ol class="list-featured">
<slot></slot>
</ol>
<ol class="list-featured">
<slot></slot>
</ol>
</template>
24 changes: 12 additions & 12 deletions frontend/components/card/list/item.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<template>
<li>
<div class="py-1">
<h6 class="fw-bold">
<a :href="href" class="text-dark">{{ title }}</a>
</h6>
<div v-if="tags" class="card-text">
<a class="hashtag" :href="`/hashtags/${tag}`" v-for="(tag , index) in tags" :key="index">{{ tag }}</a>
</div>
</div>
</li>
<li>
<div class="py-1">
<h6 class="fw-bold">
<a :href="href" class="text-dark">{{ title }}</a>
</h6>
<div v-if="tags" class="card-text">
<a class="hashtag" :href="`/hashtags/${tag}`" v-for="(tag , index) in tags" :key="index">{{ tag }}</a>
</div>
</div>
</li>
</template>

<script setup>
const props = defineProps(["href", "title", "tags", "publishedAt"])
const {href, title, tags, publishedAt} = props
const props = defineProps(["href", "title", "tags", "publishedAt"])
const {href, title, tags, publishedAt} = props
</script>
71 changes: 36 additions & 35 deletions frontend/components/card/medium.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,49 +21,50 @@
</template>

<script setup>
const props = defineProps(["cover", "href", "title", "excerpt", "publishedAt"])
const resolveFileUrl = useFilesUrlResolver().resolve
const {cover, href, title, excerpt, publishedAt} = props
const props = defineProps(["cover", "href", "title", "excerpt", "publishedAt"])
const resolveFileUrl = useFilesUrlResolver().resolve
const {cover, href, title, excerpt, publishedAt} = props
</script>

<style scoped>
p {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
line-clamp: 2;
-webkit-line-clamp: 2;
text-align: justify;
line-height: normal;
}
p {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
line-clamp: 2;
-webkit-line-clamp: 2;
text-align: justify;
line-height: normal;
}
figure img {
transition: 0.3s;
object-fit: cover;
}
figure img {
transition: 0.3s;
object-fit: cover;
}
figure img:hover {
scale: 1.05;
}
figure img:hover {
scale: 1.05;
}
h2 {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
line-clamp: 1;
-webkit-line-clamp: 1;
line-height: normal;
}
@media screen and (max-width: 995.9px) {
h2 {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
line-clamp: 1;
-webkit-line-clamp: 1;
line-height: normal;
font-size: 1.2rem;
}
@media screen and (max-width: 995.9px) {
h2 {
font-size: 1.2rem;
}
.card-text-summary {
font-size: 0.9rem ;
letter-spacing: 0 ;
}
.card-text-summary {
font-size: 0.9rem;
letter-spacing: 0;
}
}
</style>
24 changes: 12 additions & 12 deletions frontend/components/card/small.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<template>
<div class="mb-3 d-flex gap-3 align-items-center">
<img :style="{height: '100px'}" :src="resolveFileUrl(cover)">
<div>
<h2 class="mb-2 h6 fw-bold">
<a class="text-dark" :href="href">{{ title }}</a>
</h2>
<div class="card-text text-muted small">{{ excerpt }}</div>
<time :datetime="publishedAt" class="text-muted small">{{ useTime().toAgo(publishedAt) }}</time>
</div>
<div class="mb-3 d-flex gap-3 align-items-center">
<img :style="{height: '100px'}" :src="resolveFileUrl(cover)">
<div>
<h2 class="mb-2 h6 fw-bold">
<a class="text-dark" :href="href">{{ title }}</a>
</h2>
<div class="card-text text-muted small">{{ excerpt }}</div>
<time :datetime="publishedAt" class="text-muted small">{{ useTime().toAgo(publishedAt) }}</time>
</div>
</div>
</template>

<script setup>
const props = defineProps(["cover", "href", "title", "excerpt", "publishedAt"])
const resolveFileUrl = useFilesUrlResolver().resolve
const {cover, href, title, excerpt, publishedAt} = props
const props = defineProps(["cover", "href", "title", "excerpt", "publishedAt"])
const resolveFileUrl = useFilesUrlResolver().resolve
const {cover, href, title, excerpt, publishedAt} = props
</script>
13 changes: 8 additions & 5 deletions frontend/components/comments/create.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<template>
<form class="my-3 py-1 d-flex flex-column" :class="{'mt-0': props.isReplying, 'child': props.isReplying}" @submit.prevent="createComment()">
<textarea :disabled="params.pending" v-model.trim="params.body" class="form-control mb-1" placeholder="دیدگاه خود را اینجا بنویسید" rows="3" required></textarea>
<form class="my-3 py-1 d-flex flex-column" :class="{'mt-0': props.isReplying, 'child': props.isReplying}"
@submit.prevent="createComment()">
<textarea :disabled="params.pending" v-model.trim="params.body" class="form-control mb-1"
placeholder="دیدگاه خود را اینجا بنویسید" rows="3" required></textarea>
<span class="error text-danger" v-if="params.error">متن پیام باید بیشتر باشد.</span>
<div class="d-flex gap-2">
<button :disabled="params.pending" :class="{'btn-sm': props.isReplying}" type="submit" class="btn btn-success align-self-start my-1">
<button :disabled="params.pending" :class="{'btn-sm': props.isReplying}" type="submit"
class="btn btn-success align-self-start my-1">
<span v-if="!params.pending">ثبت دیدگاه</span>
<div v-else class="spinner-border" role="status">
<span class="visually-hidden">Loading...</span>
Expand Down Expand Up @@ -41,7 +44,7 @@ const params = reactive({
body: "",
})
async function createComment () {
async function createComment() {
const body = {
object_uuid: props.objectUUID,
object_type: props.objectType,
Expand All @@ -58,7 +61,7 @@ async function createComment () {
})
emit('commentCreated', data)
params.body=""
params.body = ""
} catch (e) {
params.error = true;
console.log(e)
Expand Down
5 changes: 3 additions & 2 deletions frontend/components/comments/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
</div>

<template v-if="comments && comments.length">
<comments-item v-for="(item , index) in comments" :key="index" :objectType="props.objectType" :objectUUID="props.objectUUID" :data="item"/>
<comments-item v-for="(item , index) in comments" :key="index" :objectType="props.objectType"
:objectUUID="props.objectUUID" :data="item"/>
</template>
</section>
</template>
Expand All @@ -35,7 +36,7 @@ const props = defineProps({
},
})
const data = await $fetch( useApiUrlResolver().resolve('api/comments'), {
const data = await $fetch(useApiUrlResolver().resolve('api/comments'), {
query: {
object_type: props.objectType,
object_uuid: props.objectUUID,
Expand Down
12 changes: 8 additions & 4 deletions frontend/components/comments/item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<section :class="{child: props.data.parent_uuid}" v-if="data">
<section class="card mb-3">
<div class="card-body d-flex flex-start">
<img v-if="props.data.author.avatar" class="rounded-circle shadow-1-strong ms-3" :src="useFilesUrlResolver().resolve(props.data.author.avatar)" alt="avatar" width="65" height="65">
<img v-if="props.data.author.avatar" class="rounded-circle shadow-1-strong ms-3"
:src="useFilesUrlResolver().resolve(props.data.author.avatar)" alt="avatar" width="65" height="65">
<div class="flex-grow-1 flex-shrink-1 ">
<div class="d-flex justify-content-between align-items-center">
<p class="info mb-1">
Expand All @@ -22,15 +23,18 @@
</button>
</div>
</div>
<p v-if="props.data.body && props.data.body.length" class="text small mb-0 pt-2 border-top ">{{ props.data.body }}</p>
<p v-if="props.data.body && props.data.body.length" class="text small mb-0 pt-2 border-top ">
{{ props.data.body }}</p>
</div>
</div>
</section>
<section class="write-comment px-1" ref="createCommentContainer">
<comments-create @commentCreated="toggleShowCommentCreation" :objectType="props.objectType" :objectUUID="props.objectUUID" :parentUUID="props.data.uuid" :isReplying="true" />
<comments-create @commentCreated="toggleShowCommentCreation" :objectType="props.objectType"
:objectUUID="props.objectUUID" :parentUUID="props.data.uuid" :isReplying="true"/>
</section>
<template v-if="props.data.sub && props.data.sub.length">
<comments-item v-for="(item , index) in props.data.sub" :key="index" :objectType="props.objectType" :objectUUID="props.objectUUID" :data="item"/>
<comments-item v-for="(item , index) in props.data.sub" :key="index" :objectType="props.objectType"
:objectUUID="props.objectUUID" :data="item"/>
</template>
</section>
</template>
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/dashboard/alert.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="alert au-alert-success alert-dismissible fade show au-alert au-alert--70per" role="alert">
<i class="zmdi zmdi-check-circle"></i>
<span class="content"><slot /></span>
<span class="content"><slot/></span>
<button class="close" type="button" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">
<i class="zmdi zmdi-close-circle"></i>
Expand Down
Loading

0 comments on commit 50efcd7

Please sign in to comment.