Skip to content

Commit

Permalink
Adapt for Mobile Screen (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
AceDataCloud committed Jan 2, 2024
1 parent 82bb30c commit 6de5435
Show file tree
Hide file tree
Showing 15 changed files with 355 additions and 152 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "adapt for mobile screen",
"packageName": "@zhishuyun/hub",
"email": "cqc@cuiqingcai.com",
"dependentChangeType": "patch"
}
10 changes: 8 additions & 2 deletions src/components/chat/Introduction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,15 @@ export default defineComponent({
@media (max-width: 767px) {
.introduction {
position: relative;
top: initial;
left: initial;
transform: initial;
width: 90%;
left: 5%;
transform: translateY(-50%);
margin: auto;
.introduction-items {
margin-bottom: 0;
}
}
}
</style>
4 changes: 2 additions & 2 deletions src/components/chat/SidePanel.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="sidebar">
<div class="panel">
<el-skeleton v-if="loading && conversations === undefined" />
<div v-else class="conversations">
<div class="conversation" @click="onNewConversation">
Expand Down Expand Up @@ -130,7 +130,7 @@ export default defineComponent({
</script>
<style lang="scss" scoped>
.sidebar {
.panel {
display: flex;
flex-direction: column;
align-items: flex-end;
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/Navigator.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="sidebar">
<div class="navigator">
<div class="top">
<div v-for="(link, linkIndex) in links" :key="linkIndex" class="link">
<el-tooltip effect="dark" :content="link.displayName" placement="right">
Expand Down Expand Up @@ -97,7 +97,7 @@ export default defineComponent({
</script>

<style lang="scss" scoped>
.sidebar {
.navigator {
display: flex;
flex-direction: column;
align-items: center;
Expand Down
8 changes: 8 additions & 0 deletions src/components/midjourney/ChannelSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,12 @@ export default defineComponent({
}
}
}
@media (max-width: 767px) {
.channel-selector {
.button {
padding: 20px 10px;
}
}
}
</style>
14 changes: 5 additions & 9 deletions src/components/midjourney/tasks/TaskFullList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@
</el-skeleton>
</el-card>
</div>
<el-row>
<el-col :span="10" :offset="14">
<div class="pagination">
<pagination :current-page="page" :page-size="limit" :total="total" @change="onPageChange" />
</div>
</el-col>
</el-row>
<div class="pagination">
<pagination :current-page="page" :page-size="limit" :total="total" @change="onPageChange" />
</div>
</template>

<script lang="ts">
Expand All @@ -35,8 +31,6 @@ export default defineComponent({
components: {
TaskPreview,
Pagination,
ElRow,
ElCol,
ElSkeleton,
ElSkeletonItem,
ElCard
Expand Down Expand Up @@ -156,5 +150,7 @@ export default defineComponent({
.pagination {
height: 60px;
padding-top: 10px;
width: fit-content;
margin: auto;
}
</style>
2 changes: 1 addition & 1 deletion src/components/midjourney/tasks/TaskPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default defineComponent({
required: true
},
applications: {
type: Object as () => IApplication[],
type: Object as () => IApplication[] | undefined,
required: true
},
full: {
Expand Down
71 changes: 53 additions & 18 deletions src/layouts/Chat.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
<template>
<div class="wrapper">
<div class="left">
<navigator />
<div class="main">
<div class="side">
<slot name="side">
<side-panel />
</slot>
</div>
<div class="main">
<side-panel />
<router-view />
<div class="chat">
<slot name="chat" />
</div>
<el-button round class="menu" @click="drawer = true">
<font-awesome-icon icon="fa-solid fa-bars" class="icon-menu" />
</el-button>
<el-drawer v-model="drawer" :with-header="false" size="340px" class="drawer">
<side-panel />
</el-drawer>
</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import Navigator from '@/components/common/Navigator.vue';
import SidePanel from '@/components/chat/SidePanel.vue';
import { ElDrawer, ElButton } from 'element-plus';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
export default defineComponent({
name: 'LayoutChat',
components: {
SidePanel,
Navigator
ElDrawer,
ElButton,
FontAwesomeIcon
},
data() {
return {
drawer: false
};
},
async mounted() {
await this.onGetApplications();
Expand All @@ -37,24 +52,44 @@ export default defineComponent({
</script>

<style lang="scss" scoped>
.wrapper {
width: 100%;
height: 100%;
.main {
width: calc(100% - 60px);
display: flex;
flex-direction: row;
.left {
width: 60px;
.side {
width: 300px;
height: 100%;
border-right: 1px solid var(--el-border-color);
overflow-y: scroll;
}
.main {
.chat {
height: 100%;
padding: 15px;
flex: 1;
width: calc(100% - 60px);
width: 100%;
width: calc(100% - 300px);
height: 100%;
display: flex;
flex-direction: row;
flex-direction: column;
}
}
.menu {
display: none;
}
@media (max-width: 767px) {
.side {
display: none;
}
.chat {
width: 100%;
}
.menu {
display: block;
position: fixed;
right: 20px;
top: 20px;
z-index: 2000;
}
}
</style>
42 changes: 39 additions & 3 deletions src/layouts/Console.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,38 @@
<navigator />
</div>
<div class="main">
<side-panel />
<router-view />
<side-panel class="side" />
<router-view class="operation" />
</div>
<el-button round class="menu" @click="drawer = true">
<font-awesome-icon icon="fa-solid fa-bars" class="icon-menu" />
</el-button>
<el-drawer v-model="drawer" :with-header="false" size="340px" class="drawer">
<side-panel />
</el-drawer>
</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import Navigator from '@/components/common/Navigator.vue';
import SidePanel from '@/components/console/SidePanel.vue';
import { ElDrawer, ElButton } from 'element-plus';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
export default defineComponent({
name: 'LayoutConsole',
components: {
SidePanel,
Navigator
Navigator,
ElDrawer,
ElButton,
FontAwesomeIcon
},
data() {
return {
drawer: false
};
}
});
</script>
Expand All @@ -43,4 +59,24 @@ export default defineComponent({
flex-direction: row;
}
}
@media screen and (max-width: 767px) {
.main {
.side {
display: none;
}
.panel {
width: 100%;
height: 100%;
overflow-y: scroll;
}
}
.menu {
display: block;
position: fixed;
right: 20px;
top: 20px;
z-index: 1000;
}
}
</style>
11 changes: 4 additions & 7 deletions src/layouts/Main.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<template>
<div class="wrapper">
<div class="left">
<navigator />
</div>
<div class="main">
<router-view />
</div>
<navigator class="navigator" />
<router-view class="main" />
</div>
</template>

Expand All @@ -27,7 +23,8 @@ export default defineComponent({
height: 100%;
display: flex;
flex-direction: row;
.left {
overflow: hidden;
.navigator {
width: 60px;
height: 100%;
border-right: 1px solid var(--el-border-color);
Expand Down
Loading

0 comments on commit 6de5435

Please sign in to comment.