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

super3 / nilo.chat / 14179629035

31 Mar 2025 07:19PM UTC coverage: 93.516% (-2.1%) from 95.652%
14179629035

push

github

super3
Fix Tests

148 of 162 branches covered (91.36%)

Branch coverage included in aggregate %.

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

10 existing lines in 4 files now uncovered.

227 of 239 relevant lines covered (94.98%)

7.86 hits per line

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

94.12
/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>
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>
23✔
30
      </div>
31
      <!-- Show all channels when showChannels is true -->
32
      <div v-if="showChannels">
33
        <div 
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>
23✔
39
          <span>general</span>
40
          <div v-if="getUnreadCount('general') > 0" class="ml-auto">
41
            <span class="bg-red-600 text-white text-xs rounded-full py-1 px-2 font-bold">
42
              {{ getUnreadCount('general') }}
43
            </span>
44
          </div>
45
        </div>
4✔
46
        <div 
47
          @click="switchChannel('feedback')" 
48
          class="px-4 py-1 text-white flex items-center cursor-pointer hover:bg-teal-darker"
4✔
49
          :class="{ 'bg-teal-dark': currentChannel === 'feedback' }"
50
        >
51
          <div class="w-4 mr-2 text-center">#</div>
7✔
52
          <span>feedback</span>
6✔
53
          <div v-if="getUnreadCount('feedback') > 0" class="ml-auto">
54
            <span class="bg-red-600 text-white text-xs rounded-full py-1 px-2 font-bold">
55
              {{ getUnreadCount('feedback') }}
56
            </span>
114✔
57
          </div>
114✔
58
        </div>
114✔
59
      </div>
60
      <!-- Show only selected channel when showChannels is false -->
61
      <div v-else>
62
        <div 
1✔
63
          v-if="currentChannel === 'general'"
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>
1✔
69
          <div v-if="getUnreadCount('general') > 0" class="ml-auto">
1✔
70
            <span class="bg-red-600 text-white text-xs rounded-full py-1 px-2 font-bold">
71
              {{ getUnreadCount('general') }}
72
            </span>
1✔
73
          </div>
74
        </div>
75
        <div 
1✔
76
          v-if="currentChannel === 'feedback'"
77
          @click="switchChannel('feedback')" 
78
          class="px-4 py-1 text-white flex items-center cursor-pointer hover:bg-teal-darker bg-teal-dark"
1✔
79
        >
80
          <div class="w-4 mr-2 text-center">#</div>
81
          <span>feedback</span>
1✔
82
          <div v-if="getUnreadCount('feedback') > 0" class="ml-auto">
83
            <span class="bg-red-600 text-white text-xs rounded-full py-1 px-2 font-bold">
84
              {{ getUnreadCount('feedback') }}
1✔
85
            </span>
86
          </div>
87
        </div>
1✔
88
      </div>
89
    </div>
90
    
1✔
91
    <!-- Direct Messages section -->
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"/>
1✔
97
          </svg>
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>
101
        </div>
102
        <div @click="toggleDirectMessages" class="opacity-75 flex-1 cursor-pointer">Direct Messages</div>
1✔
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">
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" />
1✔
106
          </svg>
107
        </div>
108
      </div>
109
      <!-- Show all DMs when expanded -->
1✔
110
      <div v-if="showDirectMessages">
111
        <div class="px-4 py-1 flex items-center cursor-pointer hover:bg-teal-darker"
112
             :class="{ 'bg-teal-dark': currentChannel === 'dm_self' }"
1✔
113
             @click="switchChannel('dm_self')"
114
             data-testid="dm-self">
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>
1✔
117
          </div>
118
          <span class="text-white opacity-75">{{ username }} 
119
            <span :class="[currentChannel === 'dm_self' ? 'text-white text-opacity-80' : 'text-gray-500', 'text-sm']">(you)</span>
1✔
120
          </span>
121
          <div v-if="getUnreadCount('dm_self') > 0" class="ml-auto">
122
            <span class="bg-red-600 text-white text-xs rounded-full py-1 px-2 font-bold">
123
              {{ getUnreadCount('dm_self') }}
1✔
124
            </span>
125
          </div>
126
        </div>
1✔
127
        <div class="px-4 py-1 flex items-center cursor-pointer hover:bg-teal-darker" 
128
             :class="{ 'bg-teal-dark': currentChannel === 'dm_steve' }"
129
             @click="switchChannel('dm_steve')"
130
             data-testid="dm-steve">
1✔
131
          <div class="w-4 mr-2 flex justify-center">
132
            <span class="bg-green-500 rounded-full block w-2 h-2"></span>
133
          </div>
1✔
134
          <span class="text-white opacity-75">steve</span>
135
          <div v-if="steveUnreadCount > 0" class="ml-auto">
136
            <span class="bg-red-500 text-white text-xs rounded-full py-1 px-2 font-bold">
1✔
137
              {{ steveUnreadCount }}
138
            </span>
139
          </div>
1✔
140
        </div>
141
      </div>
142
      <!-- Since DMs don't have a 'selected' concept, we won't show any when collapsed -->
143
    </div>
144
  </div>
145
</template>
1✔
146

147
<script>
148
export default {
149
  name: 'DirectMessageSidebar',
150
  props: {
151
    username: {
1✔
152
      type: String,
153
      required: true
154
    },
1✔
155
    isConnected: {
156
      type: Boolean,
157
      default: false
1✔
158
    },
159
    currentChannel: {
160
      type: String,
1✔
161
      default: 'general'
162
    },
163
    steveUnreadCount: {
164
      type: Number,
1✔
165
      default: 0
166
    },
167
    channelUnreadCounts: {
1✔
168
      type: Object,
169
      default: () => ({
170
        general: 0,
171
        feedback: 0,
1✔
172
        dm_steve: 0,
173
        dm_self: 0
174
      })
175
    }
42✔
176
  },
177
  data() {
178
    return {
42✔
179
      showChannels: true,
180
      showDirectMessages: true
1✔
181
    }
182
  },
100✔
183
  methods: {
184
    toggleChannels() {
12✔
185
      this.showChannels = !this.showChannels;
186
    },
187
    toggleDirectMessages() {
1✔
188
      this.showDirectMessages = !this.showDirectMessages;
189
    },
65✔
190
    switchChannel(channel) {
191
      if (channel !== this.currentChannel) {
192
        this.$emit('channel-change', channel);
193
      }
194
    },
195
    getUnreadCount(channel) {
42✔
UNCOV
196
      const count = this.channelUnreadCounts[channel] || 0;
✔
197
      console.log(`Getting unread count for ${channel}: ${count}`);
198
      return count;
199
    }
200
  }
58✔
201
}
202
</script> 
93!
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