Commit 3643a39e authored by nanahira's avatar nanahira

use cut images for corner avatar

parent 548f4d87
Pipeline #16012 passed with stages
in 2 minutes and 15 seconds
...@@ -7,8 +7,16 @@ import Format from '../components/Format' ...@@ -7,8 +7,16 @@ import Format from '../components/Format'
const defaultAvatar = require('../../public/default_avatar.jpg'); const defaultAvatar = require('../../public/default_avatar.jpg');
function mutatedUserAvatar(avatar) {
if (!avatar) {
return avatar;
}
return `https://sapi.moecube.com:444/avatar/url/${avatar.split('/').pop()}/40/avatar.png`;
}
function UserPanel({ dispatch, user }) { function UserPanel({ dispatch, user }) {
const { avatar } = user; const { avatar } = user;
const mutatedAvatar = mutatedUserAvatar(avatar);
const menu = ( const menu = (
<Menu trigger={['click']}> <Menu trigger={['click']}>
<Menu.Item> <Menu.Item>
...@@ -46,7 +54,7 @@ function UserPanel({ dispatch, user }) { ...@@ -46,7 +54,7 @@ function UserPanel({ dispatch, user }) {
<Dropdown overlay={menu} placement="bottomCenter"> <Dropdown overlay={menu} placement="bottomCenter">
<div className="ant-dropdown-link" style={{ display: 'flex', alignItems: 'center' }}> <div className="ant-dropdown-link" style={{ display: 'flex', alignItems: 'center' }}>
<img <img
alt="avatar" src={avatar || defaultAvatar} alt="avatar" src={mutatedAvatar || defaultAvatar}
style={{ borderRadius: '45px', style={{ borderRadius: '45px',
height: '40px', height: '40px',
weight: '40px', weight: '40px',
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment