Skip to content

Commit

Permalink
refactor(pages): update url paths for files and friends pages (#4094)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-power authored and JustZacca committed Aug 2, 2022
1 parent 6bcbc88 commit e8e7eaf
Show file tree
Hide file tree
Showing 17 changed files with 43 additions and 46 deletions.
8 changes: 4 additions & 4 deletions components/views/files/grid/item/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,28 +106,28 @@ export default Vue.extend({
},
/**
* @method rename
* @description Emit to rename item - pages/files/browse/index.vue
* @description Emit to rename item - pages/files/index.vue
*/
rename() {
this.$emit('rename', this.item)
},
/**
* @method like
* @description Emit to like item - pages/files/browse/index.vue
* @description Emit to like item - pages/files/index.vue
*/
like(event: MouseEvent) {
this.$emit('like', this.item)
},
/**
* @method share
* @description Emit to share item - pages/files/browse/index.vue
* @description Emit to share item - pages/files/index.vue
*/
share() {
this.$emit('share', this.item)
},
/**
* @method remove
* @description Emit to delete item - pages/files/browse/index.vue
* @description Emit to delete item - pages/files/index.vue
*/
remove() {
this.$emit('remove', this.item)
Expand Down
10 changes: 5 additions & 5 deletions components/views/files/list/row/Row.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default Vue.extend({
methods: {
/**
* @method handle
* @description Emit to handle item - pages/files/browse/index.vue
* @description Emit to handle item - pages/files/index.vue
*/
handle() {
if (this.$data.menuHover) {
Expand All @@ -86,28 +86,28 @@ export default Vue.extend({
},
/**
* @method rename
* @description Emit to rename item - pages/files/browse/index.vue
* @description Emit to rename item - pages/files/index.vue
*/
rename() {
this.$emit('rename', this.item)
},
/**
* @method like
* @description Emit to like item - pages/files/browse/index.vue
* @description Emit to like item - pages/files/index.vue
*/
like() {
this.$emit('like', this.item)
},
/**
* @method share
* @description Emit to share item - pages/files/browse/index.vue
* @description Emit to share item - pages/files/index.vue
*/
share() {
this.$emit('share', this.item)
},
/**
* @method remove
* @description Emit to delete item - pages/files/browse/index.vue
* @description Emit to delete item - pages/files/index.vue
*/
remove() {
this.$emit('remove', this.item)
Expand Down
8 changes: 4 additions & 4 deletions components/views/files/mobileList/item/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,28 +118,28 @@ export default Vue.extend({
},
/**
* @method rename
* @description Emit to rename item - pages/files/browse/index.vue
* @description Emit to rename item - pages/files/index.vue
*/
rename() {
this.$emit('rename', this.item)
},
/**
* @method like
* @description Emit to like item - pages/files/browse/index.vue
* @description Emit to like item - pages/files/index.vue
*/
like() {
this.$emit('like', this.item)
},
/**
* @method share
* @description Emit to share item - pages/files/browse/index.vue
* @description Emit to share item - pages/files/index.vue
*/
share() {
this.$emit('share', this.item)
},
/**
* @method remove
* @description Emit to delete item - pages/files/browse/index.vue
* @description Emit to delete item - pages/files/index.vue
*/
remove() {
this.$emit('remove', this.item)
Expand Down
6 changes: 3 additions & 3 deletions components/views/navigation/mobile/nav/Nav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ export default Vue.extend({
},
/**
* @method navigateToFriend
* @description Navigate to chat "/friends/list" showing slide 1 ('friends list slide')
* @description Navigate to chat "/friends" showing slide 1 ('friends list slide')
*/
navigateToFriend() {
this.$store.commit('ui/setSwiperSlideIndex', 1)
this.$store.commit('ui/showSidebar', false)
this.$router.push('/friends/list')
this.$router.push('/friends')
},
navigateToFiles() {
this.$router.push('/files/browse')
this.$router.push('/files')
},
},
})
Expand Down
18 changes: 8 additions & 10 deletions components/views/navigation/mobile/sidebar/sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
<div v-if="!$device.isMobile" class="sidebar-nav">
<div style="position: relative">
<InteractablesButton
:inactive="$route.path.includes('/friends/list') ? false : true"
:inactive="$route.path.includes('/friends') ? false : true"
class="sidebar-full-btn"
:type="$route.path.includes('/friends/list') ? 'primary' : 'dark'"
:type="$route.path.includes('/friends') ? 'primary' : 'dark'"
size="small"
:action="
() => {
friends.incomingRequests.length
? $router.push('/friends/list?tab=requests')
: $router.push('/friends/list')
? $router.push('/friends?tab=requests')
: $router.push('/friends')
}
"
:text="$t('friends.friends')"
Expand All @@ -58,9 +58,7 @@
<span
v-if="friends.incomingRequests.length"
:class="
$route.path.includes('/friends/list')
? 'label tag-inverted'
: 'label'
$route.path.includes('/friends') ? 'label tag-inverted' : 'label'
"
>
{{ friends.incomingRequests.length }}
Expand All @@ -71,7 +69,7 @@
class="sidebar-full-btn"
:type="$route.path.includes('/files') ? 'primary' : 'dark'"
size="small"
:action="() => $router.push('/files/browse')"
:action="() => $router.push('/files')"
:text="$t('files.files')"
>
<folder-icon size="1.2x" />
Expand Down Expand Up @@ -262,14 +260,14 @@ export default Vue.extend({
},
/**
* @name gotoAddFriends
* @description go to 'friends/list'
* @description go to 'friends'
*/
gotoAddFriends() {
this.$router.push({ path: '/friends/mobile/add' })
},
/**
* @name gotoNewMessage
* @description go to 'friends/list'
* @description go to 'friends'
*/
gotoNewMessage() {
if (this.$device.isMobile) {
Expand Down
10 changes: 5 additions & 5 deletions components/views/navigation/sidebar/Sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@
</div>
<div class="sidebar-nav">
<InteractablesButton
:inactive="!$route.path.includes('/friends/list')"
:inactive="!$route.path.includes('/friends')"
class="sidebar-full-btn"
data-cy="sidebar-friends"
:type="$route.path.includes('/friends/list') ? 'primary' : 'dark'"
:type="$route.path.includes('/friends') ? 'primary' : 'dark'"
size="small"
:action="() => $router.push('/friends/list')"
:action="() => $router.push('/friends')"
:text="$t('friends.friends')"
>
<users-icon size="1.2x" />
</InteractablesButton>
<span
v-if="incomingRequestsLength"
class="label"
:class="{inverted : $route.path.includes('/friends/list')}"
:class="{inverted : $route.path.includes('/friends')}"
>
{{incomingRequestsLength}}
</span>
Expand All @@ -44,7 +44,7 @@
data-cy="sidebar-files"
:type="$route.path.includes('/files') ? 'primary' : 'dark'"
size="small"
:action="() => $router.push('/files/browse')"
:action="() => $router.push('/files')"
:text="$t('files.files')"
>
<folder-icon size="1.2x" />
Expand Down
2 changes: 1 addition & 1 deletion components/views/navigation/sidebar/list/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default Vue.extend({
this.$store.commit('ui/showSidebar', false)
}
} else {
this.$router.push({ path: '/friends/list' })
this.$router.push({ path: '/friends' })
}
},
},
Expand Down
4 changes: 2 additions & 2 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export default defineNuxtConfig({
middleware: ['authenticated'],
extendRoutes(routes, resolve) {
routes.push({
path: '/friends/list/:id',
path: '/friends/:id',
components: {
default: resolve(__dirname, 'pages/friends/list'),
default: resolve(__dirname, 'pages/friends'),
},
})
},
Expand Down
4 changes: 2 additions & 2 deletions pages/allcomponents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<ul class="menu-list">
<li><NuxtLink to="settings/profile">Settings</NuxtLink></li>
<li><NuxtLink to="chat/direct">Chat</NuxtLink></li>
<li><NuxtLink to="friends/list">Friends</NuxtLink></li>
<li><NuxtLink to="files/browse">Files</NuxtLink></li>
<li><NuxtLink to="friends">Friends</NuxtLink></li>
<li><NuxtLink to="files">Files</NuxtLink></li>
</ul>
</aside>
</div>
Expand Down
4 changes: 2 additions & 2 deletions pages/auth/register/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export default Vue.extend({
watch: {
allPrerequisitesReady(nextValue) {
if (!nextValue) return
this.$router.replace('/friends/list')
this.$router.replace('/friends')
},
},
mounted() {
if (this.allPrerequisitesReady) {
this.$router.replace('/friends/list')
this.$router.replace('/friends')
}
},
methods: {
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 2 additions & 3 deletions pages/files/browse/index.vue → pages/files/index.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<template src="./Browse.html"></template>
<template src="./Files.html"></template>

<script lang="ts">
import Vue from 'vue'
Expand All @@ -11,7 +11,6 @@ import { FileRouteEnum } from '~/libraries/Enums/enums'
export default Vue.extend({
name: 'Files',
layout: 'basic',
data() {
return {
Expand Down Expand Up @@ -101,4 +100,4 @@ export default Vue.extend({
})
</script>

<style scoped lang="less" src="./Browse.less"></style>
<style scoped lang="less" src="./Files.less"></style>
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions pages/friends/list/index.vue → pages/friends/index.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<template src="./FriendsList.html"></template>
<template src="./Friends.html"></template>

<script lang="ts">
import Vue from 'vue'
Expand All @@ -8,7 +8,7 @@ import type { Friend, FriendRequest } from '~/libraries/Iridium/friends/types'
import { RootState } from '~/types/store/store'
export default Vue.extend({
name: 'FriendsList',
name: 'Friends',
layout: 'basic',
data() {
return {
Expand Down Expand Up @@ -38,4 +38,4 @@ export default Vue.extend({
})
</script>

<style scoped lang="less" src="./FriendsList.less"></style>
<style scoped lang="less" src="./Friends.less"></style>
4 changes: 2 additions & 2 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default Vue.extend({
methods: {
eventuallyRedirect() {
if (this.accounts.lastVisited === this.$route.path) {
this.$router.replace('/friends/list')
this.$router.replace('/friends')
return
}
Expand All @@ -65,7 +65,7 @@ export default Vue.extend({
this.$router.replace(this.accounts.lastVisited)
}
this.$router.replace('/friends/list')
this.$router.replace('/friends')
},
/**
* @method loadAccount
Expand Down

0 comments on commit e8e7eaf

Please sign in to comment.