| </div> |
| 9 |
| 10 | <div class="card-content"> |
| 11 | <div class="card-header"> |
| 12 | <span class="client-main-id">{{ client.displayName }}</span> |
| 13 | <span v-if="client.hostname" class="hostname-badge">{{ |
| 14 | client.hostname |
| 15 | }}</span> |
| 16 | <el-tag v-if="client.version" size="small" type="success" |
| 17 | >v{{ client.version }}</el-tag |
| 18 | > |
| 19 | <el-tag v-if="client.wireProtocolLabel" size="small" type="info"> |
| 20 | {{ client.wireProtocolLabel }} |
| 21 | </el-tag> |
| 22 | </div> |
| 23 |
| 24 | <div class="card-meta"> |
| 25 | <div class="meta-group"> |
| 26 | <span v-if="client.ip" class="meta-item"> |
| 27 | <span class="meta-label">IP</span> |
| 28 | <span class="meta-value">{{ client.ip }}</span> |
| 29 | </span> |
| 30 | </div> |
| 31 | <span class="meta-item activity"> |
| 32 | <el-icon class="activity-icon"><DataLine /></el-icon> |
| 33 | <span class="meta-value">{{ |
| 34 | client.online ? client.lastConnectedAgo : client.disconnectedAgo |
| 35 | }}</span> |
| 36 | </span> |
| 37 | </div> |
| 38 | </div> |
| 39 |
| 40 | <div class="card-action"> |
| 41 | <div class="status-badge" :class="client.online ? 'online' : 'offline'"> |
| 42 | {{ client.online ? 'Online' : 'Offline' }} |
| 43 | </div> |
| 44 | <el-icon class="arrow-icon"><ArrowRight /></el-icon> |
| 45 | </div> |
| 46 | </div> |
| 47 | </template> |
| 48 |
| 49 | <script setup lang="ts"> |
| 50 | import { useRouter } from 'vue-router' |
| 51 | import { DataLine, ArrowRight } from '@element-plus/icons-vue' |
| 52 | import type { Client } from '../utils/client' |
| 53 |
| 54 | interface Props { |
| 55 | client: Client |
| 56 | } |
| 57 |
| 58 | const props = defineProps<Props>() |
| 59 | const router = useRouter() |
| 60 |
| 61 | const viewDetail = () => { |
| 62 | router.push({ |
| 63 | name: 'ClientDetail', |
| 64 | params: { key: props.client.key }, |
| 65 | }) |
| 66 | } |
| 67 | </script> |
| 68 |
| 69 | <style scoped> |
| 70 | .client-card { |
| 71 | display: flex; |
| 72 | align-items: center; |
| 73 | gap: 20px; |
| 74 | padding: 24px; |
| 75 | background: var(--el-bg-color); |
| 76 | border: 1px solid var(--el-border-color-lighter); |
| 77 | border-radius: 16px; |
| 78 | cursor: pointer; |
| 79 | transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); |
| 80 | position: relative; |
| 81 | overflow: hidden; |
| 82 | } |
| 83 |
| 84 | .client-card:hover { |
| 85 | transform: translateY(-2px); |
| 86 | box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04); |
| 87 | border-color: var(--el-border-color-light); |
| 88 | } |
| 89 |
| 90 | .card-icon-wrapper { |
| 91 | width: 32px; |
| 92 | height: 32px; |
| 93 | border-radius: 8px; |
| 94 | background: var(--el-fill-color); |
| 95 | display: flex; |
| 96 | align-items: center; |
| 97 | justify-content: center; |
| 98 | flex-shrink: 0; |
| 99 | transition: all 0.2s; |
| 100 | } |
| 101 |
| 102 | .client-card:hover .card-icon-wrapper { |
| 103 | background: var(--el-color-success-light-9); |
| 104 | } |
| 105 |
| 106 | .status-dot-large { |
| 107 | width: 6px; |
| 108 | height: 6px; |
| 109 | border-radius: 50%; |
| 110 | transition: all 0.3s; |
| 111 | } |
| 112 |
| 113 | .status-dot-large.online { |
| 114 | background-color: var(--el-color-success); |
| 115 | box-shadow: 0 0 0 2px var(--el-color-success-light-8); |
| 116 | } |
| 117 |
| 118 | .status-dot-large.offline { |
| 119 | background-color: var(--el-text-color-placeholder); |
| 120 | } |
| 121 |
| 122 | .card-content { |
| 123 | flex: 1; |
| 124 | display: flex; |
| 125 | flex-direction: column; |
| 126 | gap: 8px; |
| 127 | min-width: 0; |
| 128 | } |
| 129 |
| 130 | .card-header { |
| 131 | display: flex; |
| 132 | align-items: center; |
| 133 | gap: 12px; |
| 134 | flex-wrap: wrap; |
| 135 | } |
| 136 |
| 137 | .client-main-id { |
| 138 | font-size: 15px; |
| 139 | font-weight: 600; |
| 140 | color: var(--el-text-color-primary); |
| 141 | line-height: 1.2; |
| 142 | } |
| 143 |
| 144 | .hostname-badge { |
| 145 | font-size: 12px; |
| 146 | font-weight: 500; |
| 147 | padding: 2px 8px; |
| 148 | border-radius: 6px; |
| 149 | background: var(--el-fill-color-dark); |
| 150 | color: var(--el-text-color-regular); |
| 151 | } |
| 152 |
| 153 | .card-meta { |
| 154 | display: flex; |
| 155 | align-items: center; |
| 156 | gap: 24px; |
| 157 | font-size: 13px; |
| 158 | color: var(--el-text-color-regular); |
| 159 | flex-wrap: wrap; |
| 160 | } |
| 161 |
| 162 | .meta-group { |
| 163 | display: flex; |
| 164 | align-items: center; |
| 165 | gap: 16px; |
| 166 | } |
| 167 |
| 168 | .meta-item { |
| 169 | display: flex; |
| 170 | align-items: center; |
| 171 | gap: 8px; |
| 172 | } |
| 173 |
| 174 | .meta-label { |
| 175 | color: var(--el-text-color-placeholder); |
| 176 | font-weight: 500; |
| 177 | font-size: 13px; |
| 178 | } |
| 179 |
| 180 | .meta-value { |
| 181 | font-size: 13px; |
| 182 | font-weight: 500; |
| 183 | color: var(--el-text-color-primary); |
| 184 | } |
| 185 |
| 186 | .activity .meta-value { |
| 187 | font-weight: 400; |
| 188 | color: var(--el-text-color-secondary); |
| 189 | } |
| 190 |
| 191 | .card-action { |
| 192 | display: flex; |
| 193 | align-items: center; |
| 194 | gap: 20px; |
| 195 | flex-shrink: 0; |
| 196 | } |
| 197 |
| 198 | .status-badge { |
| 199 | padding: 4px 12px; |
| 200 | border-radius: 20px; |
| 201 | font-size: 13px; |
| 202 | font-weight: 500; |
| 203 | transition: all 0.2s; |
| 204 | } |
| 205 |
| 206 | .status-badge.online { |
| 207 | background: var(--el-color-success-light-9); |
| 208 | color: var(--el-color-success); |
| 209 | } |
| 210 |
| 211 | .status-badge.offline { |
| 212 | background: var(--el-fill-color); |
| 213 | color: var(--el-text-color-secondary); |
| 214 | } |
| 215 |
| 216 | .arrow-icon { |
| 217 | font-size: 18px; |
| 218 | color: var(--el-text-color-placeholder); |
| 219 | transition: all 0.2s; |
| 220 | } |
| 221 |
| 222 | .client-card:hover .arrow-icon { |
| 223 | color: var(--el-text-color-primary); |
| 224 | transform: translateX(4px); |
| 225 | } |
| 226 |
| 227 | /* Dark mode adjustments */ |
| 228 | html.dark .card-icon-wrapper { |
| 229 | background: var(--el-fill-color-light); |
| 230 | } |
| 231 |
| 232 | html.dark .client-card:hover .card-icon-wrapper { |
| 233 | background: var(--el-color-success-light-9); |
| 234 | } |
| 235 |
| 236 | html.dark .status-dot-large.online { |
| 237 | box-shadow: 0 0 0 2px rgba(var(--el-color-success-rgb), 0.2); |
| 238 | } |
| 239 |
| 240 | @media (max-width: 640px) { |
| 241 | .client-card { |
| 242 | flex-direction: column; |
| 243 | align-items: flex-start; |
| 244 | padding: 20px; |
| 245 | } |
| 246 |
| 247 | .card-icon-wrapper { |
| 248 | width: 48px; |
| 249 | height: 48px; |
| 250 | } |
| 251 |
| 252 | .card-content { |
| 253 | width: 100%; |
| 254 | gap: 12px; |
| 255 | } |
| 256 |
| 257 | .card-action { |
| 258 | width: 100%; |
| 259 | justify-content: space-between; |
| 260 | padding-top: 16px; |
| 261 | border-top: 1px solid var(--el-border-color-lighter); |
| 262 | } |
| 263 | } |
| 264 | </style> |