|
1 | 1 | <template>
|
2 |
| - <div class="card"> |
| 2 | + <div class="card relative"> |
| 3 | + <span v-if="crate.recentlyReleased && pingVisible" class="absolute top-1.5 |
| 4 | + right-1.5 flex h-2.5 w-2.5" :class="{ |
| 5 | + 'opacity-0': !pingVisible, |
| 6 | + 'opacity-100': pingVisible |
| 7 | + }" @click="pingVisible = false"> |
| 8 | + <UTooltip text="This crate was recently released."> |
| 9 | + <span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-sky-400 opacity-75"></span> |
| 10 | + <span class="relative inline-flex rounded-full h-2.5 w-2.5 bg-sky-500"></span> |
| 11 | + </UTooltip> |
| 12 | + </span> |
3 | 13 | <div>
|
4 | 14 | <div class="header">
|
5 | 15 | <div class="title">
|
6 | 16 | In
|
7 |
| - <Icon :name="category.icon" /> |
8 |
| - {{ category.name }} |
| 17 | + <Icon :name="crate.category.icon" /> |
| 18 | + {{ crate.category.name }} |
9 | 19 |
|
10 | 20 | <div class="ml-1 font-normal text-xs font-mono">
|
11 | 21 | <div
|
12 | 22 | class="px-1 py-0.5 rounded-md text-green-900 dark:text-green-300 bg-green-300 dark:bg-green-900 border border-green-500"
|
13 |
| - v-if="kind === Kind.Library" |
14 |
| - > |
| 23 | + v-if="crate.kind === Kind.Library"> |
15 | 24 | lib
|
16 | 25 | </div>
|
17 | 26 | <div
|
18 | 27 | class="px-1 py-0.5 rounded-md text-purple-900 dark:text-purple-300 bg-purple-300 dark:bg-purple-900 border border-purple-500"
|
19 |
| - v-else-if="kind === Kind.Binary" |
20 |
| - > |
| 28 | + v-else-if="crate.kind === Kind.Binary"> |
21 | 29 | bin
|
22 | 30 | </div>
|
23 | 31 | </div>
|
24 | 32 | </div>
|
25 | 33 | <div class="flex gap-x-1.5">
|
26 |
| - <a |
27 |
| - v-if="socials && socials.github" |
| 34 | + <a v-if="crate.socials && crate.socials.github" |
28 | 35 | class="flex items-center justify-center w-7 h-7 bg-gray-100 dark:bg-slate-950 border border-gray-200 rounded-full"
|
29 |
| - :href="socials.github" |
30 |
| - > |
| 36 | + :href="crate.socials.github"> |
31 | 37 | <Icon class="w-4 h-4" name="octicon:mark-github-16"></Icon>
|
32 | 38 | </a>
|
33 |
| - <a |
34 |
| - v-if="socials && socials.docs" |
| 39 | + <a v-if="crate.socials && crate.socials.docs" |
35 | 40 | class="flex items-center justify-center w-7 h-7 bg-gray-100 dark:bg-slate-950 border border-gray-200 rounded-full"
|
36 |
| - :href="socials.docs" |
37 |
| - :title="`Chat about ${name} in the rust-seq Zulip`" |
38 |
| - > |
| 41 | + :href="crate.socials.docs" :title="`Chat about ${crate.name} in the rust-seq Zulip`"> |
39 | 42 | <Icon class="w-4 h-4" name="heroicons-outline:book-open"></Icon>
|
40 | 43 | </a>
|
41 |
| - <a |
42 |
| - v-if="socials && socials.zulip" |
| 44 | + <a v-if="crate.socials && crate.socials.zulip" |
43 | 45 | class="flex items-center justify-center w-7 h-7 bg-gray-100 dark:bg-slate-950 border border-gray-200 rounded-full"
|
44 | 46 | href="https://rustseq.zulipchat.com/join/coxb7c7b3bbahlfx7poeqqrd/"
|
45 |
| - :title="`Chat about ${name} in the rust-seq Zulip`" |
46 |
| - > |
| 47 | + :title="`Chat about ${crate.name} in the rust-seq Zulip`"> |
47 | 48 | <Icon class="w-4 h-4" name="tabler:brand-zulip"></Icon>
|
48 | 49 | </a>
|
49 | 50 | </div>
|
50 | 51 | </div>
|
51 | 52 | <div class="flex items-center justify-start gap-x-1">
|
52 |
| - <div class="crate">{{ organization }}/{{ name }}</div> |
| 53 | + <div class="crate">{{ crate.organization }}/{{ crate.name }}</div> |
53 | 54 | </div>
|
54 | 55 | <div class="description">
|
55 |
| - {{ description }} |
| 56 | + {{ crate.description }} |
56 | 57 | </div>
|
57 | 58 | </div>
|
58 | 59 | <div class="terminal">
|
59 | 60 | <div class="command">
|
60 |
| - <span class="prompt">$</span> |
61 |
| - <span v-if="kind === Kind.Library"> cargo add {{ name }} </span> |
62 |
| - <span v-if="kind === Kind.Binary"> cargo install {{ name }} </span> |
| 61 | + <span class="prompt">$ </span> |
| 62 | + <span v-if="crate.kind === Kind.Library">cargo add {{ crate.name }}</span> |
| 63 | + <span v-if="crate.kind === Kind.Binary">cargo install {{ crate.name }}</span> |
63 | 64 | </div>
|
64 | 65 | <Icon class="copy" name="heroicons-outline:clipboard-copy"></Icon>
|
65 | 66 | </div>
|
66 | 67 | </div>
|
67 | 68 | </template>
|
68 | 69 |
|
69 | 70 | <script setup lang="ts">
|
70 |
| -import { Kind } from "~/components/molecules/docs/crate-card/kind"; |
71 |
| -
|
72 |
| -interface Category { |
73 |
| - name: string; |
74 |
| - icon: string; |
75 |
| -} |
76 |
| -
|
77 |
| -interface Socials { |
78 |
| - github?: string; |
79 |
| - docs?: string; |
80 |
| - zulip: boolean; |
81 |
| -} |
| 71 | +import { type Crate, Kind } from "~/components/molecules/docs/crate-card/types"; |
| 72 | +import { useStorage } from '@vueuse/core' |
82 | 73 |
|
83 | 74 | interface Props {
|
84 |
| - name: string; |
85 |
| - kind: Kind; |
86 |
| - organization: string; |
87 |
| - category: Category; |
88 |
| - socials: Socials; |
89 |
| - description: string; |
| 75 | + crate: Crate; |
90 | 76 | }
|
91 | 77 |
|
92 | 78 | // Define props with TypeScript
|
93 | 79 | const props = defineProps<Props>();
|
| 80 | +
|
| 81 | +const pingVisible = useStorage(`crates-page:ping-visible:${props.crate.organization}/${props.crate.name}`, true); |
94 | 82 | </script>
|
95 | 83 |
|
96 | 84 | <style scope lang="postcss">
|
@@ -174,6 +162,7 @@ const props = defineProps<Props>();
|
174 | 162 | .prompt {
|
175 | 163 | @apply font-bold;
|
176 | 164 | @apply text-purple-700;
|
| 165 | + @apply select-none; |
177 | 166 | }
|
178 | 167 | }
|
179 | 168 |
|
|
0 commit comments