Skip to content

Commit

Permalink
Merge pull request #1659 from NicoPennec/feat/brief
Browse files Browse the repository at this point in the history
Production Brief page
  • Loading branch information
frankrousseau authored Jan 13, 2025
2 parents 09d121b + 3b0d6ed commit fd96bf4
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 27 deletions.
53 changes: 53 additions & 0 deletions src/components/pages/Brief.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<template>
<div class="brief fixed-page">
<div class="wrapper">
<production-brief />
</div>
</div>
</template>

<script>
import { mapGetters } from 'vuex'
import ProductionBrief from '@/components/pages/production/ProductionBrief.vue'
export default {
name: 'brief',
components: {
ProductionBrief
},
computed: {
...mapGetters(['currentProduction', 'isCurrentUserClient'])
},
mounted() {
if (this.isCurrentUserClient) {
this.$router.push({ name: 'not-found' })
return
}
},
head() {
return {
title: `${this.currentProduction?.name} | ${this.$t('productions.brief.title')} - Kitsu`
}
}
}
</script>
<style lang="scss" scoped>
.fixed-page {
display: flex;
}
.wrapper {
margin-top: 0;
overflow-y: scroll;
padding: 2em;
flex: 1;
display: flex;
flex-direction: column;
}
</style>
8 changes: 7 additions & 1 deletion src/components/pages/ProductionSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ export default {
},
mounted() {
if (!this.isCurrentUserManager) {
this.$router.push({ name: 'not-found' })
return
}
if (this.remainingAssetTypes.length > 0) {
this.assetTypeId = this.remainingAssetTypes[0].value
}
Expand All @@ -232,8 +237,9 @@ export default {
computed: {
...mapGetters([
'currentProduction',
'assetTypes',
'currentProduction',
'isCurrentUserManager',
'productionAssetTypes',
'productionTaskStatuses',
'taskStatus'
Expand Down
34 changes: 13 additions & 21 deletions src/components/pages/production/ProductionBrief.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="brief">
<div class="production-brief">
<div v-if="!isEditing" class="box" @dblclick="openEditing">
<div v-if="isEmpty(currentProduction.description)">
<div v-if="!currentProduction?.description">
<p>{{ $t('productions.brief.empty') }}</p>
</div>
<div
Expand All @@ -19,7 +19,7 @@
v-model="brief"
/>
<p v-if="errors.editBrief" class="error mt1 has-text-right">
{{ $t('productions.brief.edit.errorText') }}
{{ $t('productions.brief.edit_error') }}
</p>
<p>
<button-simple
Expand All @@ -39,8 +39,8 @@ import { mapGetters, mapActions } from 'vuex'
import { renderMarkdown } from '@/lib/render'
import TextareaField from '@/components/widgets/TextareaField.vue'
import ButtonSimple from '@/components/widgets/ButtonSimple.vue'
import TextareaField from '@/components/widgets/TextareaField.vue'
export default {
name: 'production-brief',
Expand All @@ -62,27 +62,24 @@ export default {
},
computed: {
...mapGetters(['currentProduction']),
...mapGetters(['currentProduction', 'isCurrentUserManager']),
textarea() {
return this.$refs.textarea
}
},
mounted() {
if (this.currentProduction) {
this.brief = this.currentProduction.description
}
this.brief = this.currentProduction?.description
},
methods: {
...mapActions(['editProduction', 'setProduction']),
isEmpty(str) {
return !str || str.length === 0
},
...mapActions(['editProduction']),
openEditing() {
if (!this.isCurrentUserManager) {
return
}
this.isEditing = true
this.$nextTick(() => {
// Needed because of the v-if
Expand All @@ -92,17 +89,16 @@ export default {
async editBrief() {
this.isLoading = true
this.errors.editBrief = false
try {
await this.editProduction({
id: this.currentProduction.id,
description: this.brief
})
this.isEditing = false
} catch {
this.errors.editBrief = true
this.isLoading = false
return
}
this.isEditing = false
this.isLoading = false
},
Expand All @@ -118,7 +114,7 @@ export default {
}
}
.brief {
.production-brief {
flex: 1;
}
Expand All @@ -139,8 +135,4 @@ export default {
.editor {
height: 100%;
}
.textarea {
color: red;
}
</style>
18 changes: 14 additions & 4 deletions src/components/tops/Topbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@
<div class="flexrow-item" v-if="isEpisodeContext">
<chevron-right-icon class="align-middle" :size="20" />
</div>
<div class="flexrow-item subitem">
<div class="flexrow-item subitem" v-if="isEpisodeContext">
<topbar-episode-list
:episode-groups="currentEpisodeOptionGroups || []"
:episode-id="currentEpisodeId"
:section="currentSectionOption"
v-if="isEpisodeContext"
/>
</div>
</div>
Expand Down Expand Up @@ -445,7 +444,9 @@ export default {
options.push({ label: this.$t('news.title'), value: 'newsFeed' })
}
options = options.concat([{ label: 'separator', value: 'separator' }])
if (!this.isCurrentUserClient) {
options.push({ label: 'separator', value: 'separator' })
}
// Add sequences
if (isNotOnlyAssets) {
Expand Down Expand Up @@ -483,11 +484,19 @@ export default {
}
options.push({ label: this.$t('people.team'), value: 'team' })
if (this.isCurrentUserAdmin || this.isCurrentUserManager) {
if (this.isCurrentUserManager) {
options = options.concat([
{ label: 'separator', value: 'separator' },
{ label: this.$t('settings.title'), value: 'production-settings' }
])
} else {
options = options.concat([
{ label: 'separator', value: 'separator' },
{
label: this.$t('productions.brief.title'),
value: 'brief'
}
])
}
}
Expand Down Expand Up @@ -732,6 +741,7 @@ export default {
section !== 'news-feed' &&
section !== 'schedule' &&
section !== 'production-settings' &&
section !== 'brief' &&
section !== 'episodes'
if (isEpisodeContext) {
route.name = `episode-${section}`
Expand Down
1 change: 1 addition & 0 deletions src/components/widgets/KitsuIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const icons = {
'big-thumbnail': bigThumbnail,
box,
breakdown,
brief: infos,
compare,
concepts,
custom,
Expand Down
3 changes: 2 additions & 1 deletion src/lib/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ export const getProductionPath = (
'team',
'episodes',
'episode-stats',
'concepts'
'concepts',
'brief'
].includes(section)
) {
route = episodifyRoute(route, episodeId || 'all')
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,7 @@ export default {
},

brief: {
edit_error: 'An error occurred while editing the brief.',
empty: 'There is no brief yet. How about creating one?',
title: 'Brief'
},
Expand Down
7 changes: 7 additions & 0 deletions src/router/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const AssetTypes = () => import('@/components/pages/AssetTypes.vue')
const Backgrounds = () => import('@/components/pages/Backgrounds.vue')
const Bots = () => import('@/components/pages/Bots.vue')
const Breakdown = () => import('@/components/pages/Breakdown.vue')
const Brief = () => import('@/components/pages/Brief.vue')
const Concepts = () => import('@/components/pages/Concepts.vue')
const CustomActions = () => import('@/components/pages/CustomActions.vue')
const Departments = () => import('@/components/pages/Departments.vue')
Expand Down Expand Up @@ -451,6 +452,12 @@ export const routes = [
name: 'production-settings'
},

{
path: 'productions/:production_id/brief',
component: Brief,
name: 'brief'
},

{
path: 'productions/:production_id/quota',
component: ProductionQuota,
Expand Down
7 changes: 7 additions & 0 deletions src/testrouter/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import AssetTypes from '@/components/pages/AssetTypes.vue'
import Backgrounds from '@/components/pages/Backgrounds.vue'
import Bots from '@/components/pages/Bots.vue'
import Breakdown from '@/components/pages/Breakdown.vue'
import Brief from '@/components/pages/Brief.vue'
import Concepts from '@/components/pages/Concepts.vue'
import CustomActions from '@/components/pages/CustomActions.vue'
import Departments from '@/components/pages/departments/Departments.vue'
Expand Down Expand Up @@ -498,6 +499,12 @@ export const routes = [
name: 'production-settings'
},

{
path: 'productions/:production_id/brief',
component: Brief,
name: 'brief'
},

{
path: 'productions/:production_id/quota',
component: ProductionQuota,
Expand Down

0 comments on commit fd96bf4

Please sign in to comment.