-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
201 additions
and
29 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,4 +42,4 @@ private function vueStyles(): array | |
|
||
return $files; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,86 @@ | ||
<script setup lang="ts"> | ||
import {ref} from "vue"; | ||
import moment from "moment"; | ||
import _ from "lodash"; | ||
const props = defineProps({ | ||
data: { type: Object, required: true }, | ||
}); | ||
const emit = defineEmits(['onSuccess']); | ||
const busy = ref(false); | ||
const success = ref(false); | ||
const error = ref(false); | ||
const id = ref(_.uniqueId()); | ||
async function request() { | ||
if (busy.value) { | ||
return; | ||
} | ||
busy.value = true; | ||
const response = await fetch('/api/download-rss/' + props.data.id); | ||
if (response.status === 200) { | ||
success.value = true; | ||
emit('onSuccess'); | ||
} else { | ||
error.value = true; | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="rss"> | ||
<div class="header">{{props.data.title}}</div> | ||
<div class="rss-wrapper" :class="{hide: success}"> | ||
<div class="rss mb-3" :id="id" @click="request" :class="{busy: busy, success: success, failure: error}"> | ||
<div class="row"> | ||
<div class="col-12 col-md-9"> | ||
<div class="header text-info">{{props.data.title}}</div> | ||
</div> | ||
<div class="col-12 col-md-3 text-end"> | ||
<small>{{moment(props.data.createdAt).fromNow()}}</small> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
<style scoped lang="scss"> | ||
.rss-wrapper { | ||
overflow: hidden; | ||
transition: 0.7s; | ||
max-height: 100px; | ||
&.hide { | ||
max-height: 0; | ||
} | ||
} | ||
.rss { | ||
padding: 0.3rem; | ||
border-bottom: var(--bs-info-border-subtle) 1px solid; | ||
border-right: var(--bs-info-border-subtle) 1px solid; | ||
&:hover { | ||
cursor: pointer; | ||
&.busy { | ||
cursor: not-allowed; | ||
} | ||
} | ||
transition: 0.6s; | ||
&.failure { | ||
background: var(--bs-danger); | ||
border-color: var(--bs-danger-border-subtle); | ||
} | ||
&.success { | ||
background: var(--bs-success); | ||
border-color: var(--bs-success-border-subtle); | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.