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

super3 / nilo.chat / 14179760224

31 Mar 2025 07:27PM UTC coverage: 93.846% (+0.3%) from 93.516%
14179760224

push

github

super3
Remove Steve

141 of 154 branches covered (91.56%)

Branch coverage included in aggregate %.

225 of 236 relevant lines covered (95.34%)

7.86 hits per line

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

95.07
/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>
20✔
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 
21✔
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>
107✔
52
          <span>feedback</span>
107✔
53
          <div v-if="getUnreadCount('feedback') > 0" class="ml-auto">
107✔
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
      <!-- Since DMs don't have a 'selected' concept, we won't show any when collapsed -->
1✔
129
    </div>
130
  </div>
131
</template>
1✔
132

133
<script>
134
export default {
1✔
135
  name: 'DirectMessageSidebar',
136
  props: {
137
    username: {
138
      type: String,
139
      required: true
140
    },
1✔
141
    isConnected: {
142
      type: Boolean,
143
      default: false
144
    },
145
    currentChannel: {
146
      type: String,
1✔
147
      default: 'general'
148
    },
149
    channelUnreadCounts: {
1✔
150
      type: Object,
151
      default: () => ({
152
        general: 0,
1✔
153
        feedback: 0,
154
        dm_self: 0
155
      })
1✔
156
    }
157
  },
158
  data() {
159
    return {
1✔
160
      showChannels: true,
161
      showDirectMessages: true
162
    }
163
  },
39✔
164
  methods: {
165
    toggleChannels() {
166
      this.showChannels = !this.showChannels;
39✔
167
    },
168
    toggleDirectMessages() {
1✔
169
      this.showDirectMessages = !this.showDirectMessages;
170
    },
92✔
171
    switchChannel(channel) {
172
      if (channel !== this.currentChannel) {
12✔
173
        this.$emit('channel-change', channel);
174
      }
175
    },
1✔
176
    getUnreadCount(channel) {
177
      const count = this.channelUnreadCounts[channel] || 0;
60✔
178
      console.log(`Getting unread count for ${channel}: ${count}`);
179
      return count;
180
    }
181
  }
182
}
183
</script> 
39✔
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