|
1 | 1 | <template>
|
2 |
| - <div class="window-container"> |
3 |
| - <div class="chat-forms"> |
4 |
| - <form @submit.prevent="createRoom" v-if="addNewRoom"> |
5 |
| - <input |
6 |
| - type="text" |
7 |
| - placeholder="Add username to create a room" |
8 |
| - v-model="addRoomUsername" |
9 |
| - /> |
10 |
| - <button type="submit" :disabled="disableForm || !addRoomUsername"> |
11 |
| - Create Room |
12 |
| - </button> |
13 |
| - <button class="button-cancel" @click="addNewRoom = false"> |
14 |
| - Cancel |
15 |
| - </button> |
16 |
| - </form> |
17 |
| - |
18 |
| - <form @submit.prevent="addRoomUser" v-if="inviteRoomId"> |
19 |
| - <input |
20 |
| - type="text" |
21 |
| - placeholder="Add user to the room" |
22 |
| - v-model="invitedUsername" |
23 |
| - /> |
24 |
| - <button type="submit" :disabled="disableForm || !invitedUsername"> |
25 |
| - Add User |
26 |
| - </button> |
27 |
| - <button class="button-cancel" @click="inviteRoomId = null"> |
28 |
| - Cancel |
29 |
| - </button> |
30 |
| - </form> |
31 |
| - |
32 |
| - <form @submit.prevent="deleteRoomUser" v-if="removeRoomId"> |
33 |
| - <select v-model="removeUserId"> |
34 |
| - <option default value="">Select User</option> |
35 |
| - <option v-for="user in removeUsers" :key="user._id" :value="user._id"> |
36 |
| - {{ user.username }} |
37 |
| - </option> |
38 |
| - </select> |
39 |
| - <button type="submit" :disabled="disableForm || !removeUserId"> |
40 |
| - Remove User |
41 |
| - </button> |
42 |
| - <button class="button-cancel" @click="removeRoomId = null"> |
43 |
| - Cancel |
44 |
| - </button> |
45 |
| - </form> |
46 |
| - </div> |
| 2 | + <div class="window-container" :class="{ 'window-mobile': isDevice }"> |
| 3 | + <form @submit.prevent="createRoom" v-if="addNewRoom"> |
| 4 | + <input type="text" placeholder="Add username" v-model="addRoomUsername" /> |
| 5 | + <button type="submit" :disabled="disableForm || !addRoomUsername"> |
| 6 | + Create Room |
| 7 | + </button> |
| 8 | + <button class="button-cancel" @click="addNewRoom = false"> |
| 9 | + Cancel |
| 10 | + </button> |
| 11 | + </form> |
| 12 | + |
| 13 | + <form @submit.prevent="addRoomUser" v-if="inviteRoomId"> |
| 14 | + <input type="text" placeholder="Add username" v-model="invitedUsername" /> |
| 15 | + <button type="submit" :disabled="disableForm || !invitedUsername"> |
| 16 | + Add User |
| 17 | + </button> |
| 18 | + <button class="button-cancel" @click="inviteRoomId = null"> |
| 19 | + Cancel |
| 20 | + </button> |
| 21 | + </form> |
| 22 | + |
| 23 | + <form @submit.prevent="deleteRoomUser" v-if="removeRoomId"> |
| 24 | + <select v-model="removeUserId"> |
| 25 | + <option default value="">Select User</option> |
| 26 | + <option v-for="user in removeUsers" :key="user._id" :value="user._id"> |
| 27 | + {{ user.username }} |
| 28 | + </option> |
| 29 | + </select> |
| 30 | + <button type="submit" :disabled="disableForm || !removeUserId"> |
| 31 | + Remove User |
| 32 | + </button> |
| 33 | + <button class="button-cancel" @click="removeRoomId = null"> |
| 34 | + Cancel |
| 35 | + </button> |
| 36 | + </form> |
47 | 37 |
|
48 | 38 | <chat-window
|
49 |
| - height="calc(100vh - 80px)" |
| 39 | + :height="screenHeight" |
50 | 40 | :theme="theme"
|
51 | 41 | :styles="styles"
|
52 | 42 | :current-user-id="currentUserId"
|
@@ -93,7 +83,7 @@ export default {
|
93 | 83 | ChatWindow
|
94 | 84 | },
|
95 | 85 |
|
96 |
| - props: ['currentUserId', 'theme'], |
| 86 | + props: ['currentUserId', 'theme', 'isDevice'], |
97 | 87 |
|
98 | 88 | data() {
|
99 | 89 | return {
|
@@ -147,6 +137,9 @@ export default {
|
147 | 137 | computed: {
|
148 | 138 | loadedRooms() {
|
149 | 139 | return this.rooms.slice(0, this.roomsLoadedCount)
|
| 140 | + }, |
| 141 | + screenHeight() { |
| 142 | + return this.isDevice ? window.innerHeight + 'px' : 'calc(100vh - 80px)' |
150 | 143 | }
|
151 | 144 | },
|
152 | 145 |
|
@@ -791,67 +784,69 @@ export default {
|
791 | 784 | width: 100%;
|
792 | 785 | }
|
793 | 786 |
|
794 |
| -.chat-forms { |
795 |
| - padding-bottom: 20px; |
796 |
| -
|
| 787 | +.window-mobile { |
797 | 788 | form {
|
798 |
| - padding-top: 20px; |
799 |
| - } |
800 |
| -
|
801 |
| - input { |
802 |
| - padding: 5px; |
803 |
| - width: 180px; |
804 |
| - height: 21px; |
805 |
| - border-radius: 4px; |
806 |
| - border: 1px solid #d2d6da; |
807 |
| - outline: none; |
808 |
| - font-size: 14px; |
809 |
| - vertical-align: middle; |
810 |
| -
|
811 |
| - &::placeholder { |
812 |
| - color: #9ca6af; |
813 |
| - } |
| 789 | + padding: 10px; |
814 | 790 | }
|
| 791 | +} |
815 | 792 |
|
816 |
| - button { |
817 |
| - background: #1976d2; |
818 |
| - color: #fff; |
819 |
| - outline: none; |
820 |
| - cursor: pointer; |
821 |
| - border-radius: 4px; |
822 |
| - padding: 8px 12px; |
823 |
| - margin-left: 10px; |
824 |
| - border: none; |
825 |
| - font-size: 14px; |
826 |
| - transition: 0.3s; |
827 |
| - vertical-align: middle; |
828 |
| -
|
829 |
| - &:hover { |
830 |
| - opacity: 0.8; |
831 |
| - } |
| 793 | +form { |
| 794 | + padding-bottom: 20px; |
| 795 | +} |
832 | 796 |
|
833 |
| - &:active { |
834 |
| - opacity: 0.6; |
835 |
| - } |
| 797 | +input { |
| 798 | + padding: 5px; |
| 799 | + width: 140px; |
| 800 | + height: 21px; |
| 801 | + border-radius: 4px; |
| 802 | + border: 1px solid #d2d6da; |
| 803 | + outline: none; |
| 804 | + font-size: 14px; |
| 805 | + vertical-align: middle; |
| 806 | +
|
| 807 | + &::placeholder { |
| 808 | + color: #9ca6af; |
| 809 | + } |
| 810 | +} |
836 | 811 |
|
837 |
| - &:disabled { |
838 |
| - cursor: initial; |
839 |
| - background: #c6c9cc; |
840 |
| - opacity: 0.6; |
841 |
| - } |
| 812 | +button { |
| 813 | + background: #1976d2; |
| 814 | + color: #fff; |
| 815 | + outline: none; |
| 816 | + cursor: pointer; |
| 817 | + border-radius: 4px; |
| 818 | + padding: 8px 12px; |
| 819 | + margin-left: 10px; |
| 820 | + border: none; |
| 821 | + font-size: 14px; |
| 822 | + transition: 0.3s; |
| 823 | + vertical-align: middle; |
| 824 | +
|
| 825 | + &:hover { |
| 826 | + opacity: 0.8; |
842 | 827 | }
|
843 | 828 |
|
844 |
| - .button-cancel { |
845 |
| - color: #a8aeb3; |
846 |
| - background: none; |
847 |
| - margin-left: 5px; |
| 829 | + &:active { |
| 830 | + opacity: 0.6; |
848 | 831 | }
|
849 | 832 |
|
850 |
| - select { |
851 |
| - vertical-align: middle; |
852 |
| - height: 33px; |
853 |
| - width: 120px; |
854 |
| - font-size: 13px; |
| 833 | + &:disabled { |
| 834 | + cursor: initial; |
| 835 | + background: #c6c9cc; |
| 836 | + opacity: 0.6; |
855 | 837 | }
|
856 | 838 | }
|
| 839 | +
|
| 840 | +.button-cancel { |
| 841 | + color: #a8aeb3; |
| 842 | + background: none; |
| 843 | + margin-left: 5px; |
| 844 | +} |
| 845 | +
|
| 846 | +select { |
| 847 | + vertical-align: middle; |
| 848 | + height: 33px; |
| 849 | + width: 120px; |
| 850 | + font-size: 13px; |
| 851 | +} |
857 | 852 | </style>
|
0 commit comments