<template>
  <div>
    <!-- 范围，地点提示 -->
    <div class="location-info">
      <div class="location-text">
        <em :class="isInRange ? 'text-success' : 'text-error'">
          <i :class="isInRange ? 'el-icon-success' : 'el-icon-error'" />
          <!-- {{ isInRange ? "已进入打卡范围" : "未进入打卡范围" }} -->
          {{ isInRange ? $t("checkin.area.inRange") : $t("checkin.area.outRange") }}
        </em>
        <span>{{ areaName }}</span>
      </div>
    </div>

    <!-- 调试信息 -->
    <p class="coordinate-info">{{ longitude }},{{ latitude }}</p>
  </div>
</template>

<script>
export default {
  name: "LocationInfo",
  props: {
    isInRange: {
      type: Boolean,
      default: false,
    },
    areaName: {
      type: String,
      default: "",
    },
    longitude: {
      type: Number,
      default: null,
    },
    latitude: {
      type: Number,
      default: null,
    },
  },
};
</script>

<style lang="scss" scoped>
.location-info {
  background: white;
  margin: 10px auto;
  padding: 15px 20px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  max-width: 280px;
}

.text-success {
  color: #4caf50;
}

.text-error {
  color: #f56c6c;
}

.location-text {
  flex: 1;
  font-size: 14px;
  color: #666;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;

  em {
    font-style: normal;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-weight: 600;

    i {
      font-size: 20px;
    }
  }
}

.coordinate-info {
  text-align: center;
  font-size: 12px;
  color: #999;
  margin: 10px 0;
}
</style>
