• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

super3 / nilo.chat / 14179918232

31 Mar 2025 07:36PM UTC coverage: 93.333% (-0.5%) from 93.846%
14179918232

push

github

super3
Better Collapse

149 of 164 branches covered (90.85%)

Branch coverage included in aggregate %.

5 of 5 new or added lines in 1 file covered. (100.0%)

3 existing lines in 1 file now uncovered.

229 of 241 relevant lines covered (95.02%)

7.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.63
/src/components/DirectMessageSidebar.vue
1
<template>
2
  <div class="bg-indigo-darker text-purple-lighter flex-none w-64 pb-6 hidden md:block">
3
    <div class="text-white mb-2 mt-3 px-4 flex justify-between">
4
      <div class="flex-auto">
1✔
5
        <h1 class="font-semibold text-xl leading-tight mb-1 truncate">nilo.chat</h1>
6
        <div class="flex items-center mb-6">
7
          <span :class="[isConnected ? 'bg-green-500' : 'border border-white', 'rounded-full block w-2 h-2 mr-2']"></span>
1✔
8
          <span class="text-white/50 text-sm">{{ username }}</span>
1✔
9
        </div>
10
      </div>
11
    </div>
12
    
13
    <!-- Channels section -->
14
    <div class="mb-8">
15
      <div class="px-4 mb-1 text-white flex items-center">
16
        <div @click="toggleChannels" class="cursor-pointer w-4 mr-2 flex justify-center">
17
          <svg v-if="showChannels" class="fill-current h-4 w-4 opacity-50" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
18
            <path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/>
19
          </svg>
20
          <svg v-else class="fill-current h-4 w-4 opacity-50" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
21
            <path d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"/>
22
          </svg>
23
        </div>
24
        <div @click="toggleChannels" class="opacity-75 flex-1 cursor-pointer">Channels</div>
25
        <div>
21✔
26
          <svg class="fill-current h-4 w-4 opacity-50" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
27
            <path d="M11 9h4v2h-4v4H9v-4H5V9h4V5h2v4zm-1 11a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16z" />
28
          </svg>
29
        </div>
30
      </div>
31
      <!-- Show all channels when showChannels is true -->
32
      <div v-if="showChannels">
33
        <div 
22✔
34
          @click="switchChannel('general')" 
35
          class="px-4 py-1 text-white flex items-center cursor-pointer hover:bg-teal-darker"
36
          :class="{ 'bg-teal-dark': currentChannel === 'general' }"
37
        >
38
          <div class="w-4 mr-2 text-center">#</div>
39
          <span>general</span>
40
          <div v-if="getUnreadCount('general') > 0" class="ml-auto">
4✔
41
            <span class="bg-red-600 text-white text-xs rounded-full py-1 px-2 font-bold">
42
              {{ getUnreadCount('general') }}
43
            </span>
4✔
44
          </div>
45
        </div>
46
        <div 
5✔
47
          @click="switchChannel('feedback')" 
4✔
48
          class="px-4 py-1 text-white flex items-center cursor-pointer hover:bg-teal-darker"
49
          :class="{ 'bg-teal-dark': currentChannel === 'feedback' }"
50
        >
51
          <div class="w-4 mr-2 text-center">#</div>
118✔
52
          <span>feedback</span>
118✔
53
          <div v-if="getUnreadCount('feedback') > 0" class="ml-auto">
118✔
54
            <span class="bg-red-600 text-white text-xs rounded-full py-1 px-2 font-bold">
55
              {{ getUnreadCount('feedback') }}
56
            </span>
57
          </div>
1✔
58
        </div>
59
      </div>
1✔
60
      <!-- Show only selected channel when showChannels is false -->
61
      <div v-else>
62
        <div 
1✔
63
          v-if="currentChannel === 'general'"
1✔
64
          @click="switchChannel('general')" 
1✔
65
          class="px-4 py-1 text-white flex items-center cursor-pointer hover:bg-teal-darker bg-teal-dark"
66
        >
67
          <div class="w-4 mr-2 text-center">#</div>
1✔
68
          <span>general</span>
69
          <div v-if="getUnreadCount('general') > 0" class="ml-auto">
70
            <span class="bg-red-600 text-white text-xs rounded-full py-1 px-2 font-bold">
1✔
71
              {{ getUnreadCount('general') }}
72
            </span>
73
          </div>
1✔
74
        </div>
75
        <div 
76
          v-if="currentChannel === 'feedback'"
1✔
77
          @click="switchChannel('feedback')" 
78
          class="px-4 py-1 text-white flex items-center cursor-pointer hover:bg-teal-darker bg-teal-dark"
79
        >
1✔
80
          <div class="w-4 mr-2 text-center">#</div>
81
          <span>feedback</span>
82
          <div v-if="getUnreadCount('feedback') > 0" class="ml-auto">
1✔
83
            <span class="bg-red-600 text-white text-xs rounded-full py-1 px-2 font-bold">
84
              {{ getUnreadCount('feedback') }}
85
            </span>
1✔
86
          </div>
87
        </div>
88
      </div>
89
    </div>
90
    
91
    <!-- Direct Messages section -->
1✔
92
    <div class="mb-8">
93
      <div class="px-4 mb-1 text-white flex items-center">
94
        <div @click="toggleDirectMessages" class="cursor-pointer w-4 mr-2 flex justify-center">
95
          <svg v-if="showDirectMessages" class="fill-current h-4 w-4 opacity-50" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
96
            <path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/>
97
          </svg>
1✔
98
          <svg v-else class="fill-current h-4 w-4 opacity-50" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
99
            <path d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"/>
100
          </svg>
1✔
101
        </div>
102
        <div @click="toggleDirectMessages" class="opacity-75 flex-1 cursor-pointer">Direct Messages</div>
103
        <div>
104
          <svg class="fill-current h-4 w-4 opacity-50" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
1✔
105
            <path d="M11 9h4v2h-4v4H9v-4H5V9h4V5h2v4zm-1 11a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16z" />
106
          </svg>
107
        </div>
1✔
108
      </div>
109
      <!-- Show all DMs when expanded -->
110
      <div v-if="showDirectMessages">
111
        <div class="px-4 py-1 flex items-center cursor-pointer hover:bg-teal-darker"
1✔
112
             :class="{ 'bg-teal-dark': currentChannel === 'dm_self' }"
113
             @click="switchChannel('dm_self')"
114
             data-testid="dm-self">
1✔
115
          <div class="w-4 mr-2 flex justify-center">
116
            <span :class="[isConnected ? 'bg-green-500' : 'border border-white', 'rounded-full block w-2 h-2']"></span>
117
          </div>
118
          <span class="text-white opacity-75">{{ username }} 
1✔
119
            <span :class="[currentChannel === 'dm_self' ? 'text-white text-opacity-80' : 'text-gray-500', 'text-sm']">(you)</span>
120
          </span>
121
          <div v-if="getUnreadCount('dm_self') > 0" class="ml-auto">
1✔
122
            <span class="bg-red-600 text-white text-xs rounded-full py-1 px-2 font-bold">
123
              {{ getUnreadCount('dm_self') }}
124
            </span>
125
          </div>
1✔
126
        </div>
127
      </div>
128
      <!-- Show only selected DM when showDirectMessages is false -->
1✔
129
      <div v-else>
130
        <div 
131
          v-if="currentChannel === 'dm_self'"
1✔
132
          class="px-4 py-1 flex items-center cursor-pointer hover:bg-teal-darker bg-teal-dark"
133
          @click="switchChannel('dm_self')"
134
          data-testid="dm-self-collapsed">
1✔
135
          <div class="w-4 mr-2 flex justify-center">
136
            <span :class="[isConnected ? 'bg-green-500' : 'border border-white', 'rounded-full block w-2 h-2']"></span>
137
          </div>
138
          <span class="text-white opacity-75">{{ username }} 
139
            <span class="text-white text-opacity-80 text-sm">(you)</span>
140
          </span>
1✔
141
          <div v-if="getUnreadCount('dm_self') > 0" class="ml-auto">
142
            <span class="bg-red-600 text-white text-xs rounded-full py-1 px-2 font-bold">
143
              {{ getUnreadCount('dm_self') }}
144
            </span>
145
          </div>
146
        </div>
1✔
147
      </div>
148
    </div>
149
  </div>
1✔
150
</template>
151

152
<script>
1✔
153
export default {
154
  name: 'DirectMessageSidebar',
155
  props: {
1✔
156
    username: {
157
      type: String,
158
      required: true
159
    },
1✔
160
    isConnected: {
161
      type: Boolean,
162
      default: false
1✔
163
    },
164
    currentChannel: {
165
      type: String,
1✔
166
      default: 'general'
167
    },
168
    channelUnreadCounts: {
1✔
169
      type: Object,
170
      default: () => ({
171
        general: 0,
172
        feedback: 0,
1✔
173
        dm_self: 0
174
      })
175
    }
176
  },
43✔
177
  data() {
178
    return {
179
      showChannels: true,
43✔
180
      showDirectMessages: true
181
    }
1✔
182
  },
183
  methods: {
101✔
184
    toggleChannels() {
185
      this.showChannels = !this.showChannels;
12✔
186
    },
187
    toggleDirectMessages() {
188
      this.showDirectMessages = !this.showDirectMessages;
1✔
189
    },
190
    switchChannel(channel) {
65✔
191
      if (channel !== this.currentChannel) {
192
        this.$emit('channel-change', channel);
193
      }
194
    },
195
    getUnreadCount(channel) {
196
      const count = this.channelUnreadCounts[channel] || 0;
43✔
UNCOV
197
      console.log(`Getting unread count for ${channel}: ${count}`);
✔
198
      return count;
199
    }
200
  }
201
}
58✔
202
</script> 
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc