Skip to content

Commit

Permalink
Fix nickname (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway authored Jun 12, 2024
1 parent 8c33f87 commit 951f4cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/components/ResourceItemInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
&nbsp;&nbsp;<badges :badges="resourceItem.badges"></badges>
</section>
<section>
<pre class="resource-id">🆔</pre>
<pre ref="resourceId" class="resource-id">{{ resourceItem.id }}</pre>

<b-button
size="is-small"
icon-left="content-copy"
@click="copyText(resourceItem.id)"
></b-button>
<template v-if="resourceItem.id !== resourceItem.nickname">
<pre class="resource-id">🆔</pre>
<pre ref="resourceId" class="resource-id">{{ resourceItem.id }}</pre>
<b-button
size="is-small"
icon-left="content-copy"
@click="copyText(resourceItem.id)"
></b-button>
</template>

<pre
style="margin-left: 20px;"
Expand Down
2 changes: 2 additions & 0 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ export const store = new Vuex.Store({
state.resourceItems = state.resourceItems.map(item => {
// make sure the id and links are in lowercase
item.id = item.id || randId();
// use the id as the nickname if not provided
item.nickname = item.nickname || item.id;
item.id = item.id.toLowerCase();
item.links = item.links || [];
item.tags = item.tags || [];
Expand Down

0 comments on commit 951f4cf

Please sign in to comment.