Skip to content

Commit

Permalink
Merge pull request #194 from traPtitech/feat/atcoderLogo
Browse files Browse the repository at this point in the history
AtCoderのロゴ表示に対応
  • Loading branch information
Pugma authored Jul 6, 2024
2 parents 9352cbf + a648ab9 commit b9a149d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
Binary file added src/assets/AtCoder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions src/assets/AtCoder.svg

This file was deleted.

20 changes: 16 additions & 4 deletions src/components/User/AccountListItem.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
<script lang="ts" setup>
import AIcon from '/@/components/UI/AIcon.vue'
import { Account } from '/@/lib/apis'
import { services } from '/@/consts/services'
import { Service, services } from '/@/consts/services'
import { computed } from 'vue'
interface Props {
account: Account
}
defineProps<Props>()
const props = defineProps<Props>()
const service = computed<Service | undefined>(() =>
services.get(props.account.type)
)
</script>

<template>
<li>
<li v-if="service !== undefined">
<a
:class="$style.link"
:href="account.url"
target="_blank"
rel="noreferrer noopener"
>
<a-icon :name="services.get(account.type)?.icon ?? ''" :size="24" />
<img
v-if="service.notIcon"
:alt="service.name"
:src="service.icon"
width="24"
height="24"
/>
<a-icon v-else :name="service.icon ?? ''" :size="24" />
</a>
</li>
</template>
Expand Down
7 changes: 5 additions & 2 deletions src/consts/services.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { AccountType } from '/@/lib/apis'
import AtCoder from '/@/assets/AtCoder.png'

interface Service {
export interface Service {
name: string
icon: string
notIcon?: boolean
}
export interface ServiceWithType extends Service {
type: AccountType
Expand Down Expand Up @@ -71,7 +73,8 @@ export const services: ServiceRecord = new Map([
AccountType.atcoder,
{
name: 'AtCoder',
icon: 'atcoder' //アイコンは保留
icon: AtCoder,
notIcon: true
}
],
[
Expand Down
4 changes: 4 additions & 0 deletions src/types/shims-png.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.png' {
const content: string
export default content
}

0 comments on commit b9a149d

Please sign in to comment.