All files / src/components/UI/fiousercard listUser.vue

0% Statements 0/35
0% Branches 0/18
0% Functions 0/14
0% Lines 0/35

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108                                                                                                                                                                                                                       
<template>
  <div class="h-100">
    <v-list-item
      v-if="from_which == 'dialog-search'"
      class="pl-4 h-100 text-left pa-2"
      @click="open = true"
    >
      <template v-slot:prepend>
        <v-avatar
          color="grey-darken-3"
          :image="checkremote(`${spravURL}${author.login}.jpg`)"
        />
      </template>
      <v-list-item-title :class="style_item_title()">
        {{ author.fio }}
      </v-list-item-title>
      <v-list-item-subtitle :class="style_item_subtitle()">
        {{ author.post }}
      </v-list-item-subtitle>
    </v-list-item>

    <v-list-item
      v-if="from_which == 'top-user'"
      class="h-100 text-left pa-0 pl-0"
      @click="open = true"
    >
      <v-chip
        class="cursor-pointer pa-0"
        variant="text"
        label
        color="grey-darken-3"
        size="small"
      >
        <v-avatar
          color="grey-darken-3"
          :image="checkremote(`${spravURL}${author.login}.jpg`)"
          class="mr-2"
        />
        <span class="font-weight-medium text-grey-darken-3 myleft text-caption">
          {{ splitname(author) }}
        </span>
      </v-chip>
    </v-list-item>

    <v-img
      v-if="from_which == 'top_comment'"
      @click="open = true"
      cover
      class="cursor-pointer"
      :src="checkremote(`${spravURL}${author.login}.jpg`)"
    />

    <info-user-card
      :author="author"
      :opendialog="open"
      @update:opendialog="open = $event"
    />
  </div>
</template>

<script>
import { ref } from "vue";
import { checkremote } from "@/utils/universal_functions";
import { spravURL } from "@/utils/axios-api";
import { splitname } from "@/utils/universal_functions";

export default {
  name: "list-user",
  props: {
    author: {
      type: Object,
      default: {},
    },
 
    from_which: {
      type: String,
      default: "dialog-search",
    },
  },
  setup(props) {
    const open = ref(false);
 
    const style_item_title = () => {
      if (props.from_which == "top-user") {
        return "text-body-1 font-weight-medium";
      } else return "text-body-1 font-weight-medium pt-2";
    };

    const style_item_subtitle = () => {
      if (props.from_which == "top-user") {
        return "text-caption";
      } else return "pb-2";
    };
 
    return {
      open,
      checkremote,
      spravURL,
      style_item_title,
      style_item_subtitle,
      splitname,
    };
  },
};
</script>
 
<style></style>