Fix broken links for share dialog and avatar images (#1249)

This commit is contained in:
Erik Michelson 2021-05-11 12:31:20 +02:00 committed by GitHub
parent afb6226d85
commit 327c872532
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 10 deletions

View file

@ -14,6 +14,7 @@ import {
DocumentInfoTimeLine DocumentInfoTimeLine
} from '../editor-page/document-bar/document-info/document-info-time-line' } from '../editor-page/document-bar/document-info/document-info-time-line'
import './document-infobar.scss' import './document-infobar.scss'
import { useCustomizeAssetsUrl } from '../../hooks/common/use-customize-assets-url'
export interface DocumentInfobarProps { export interface DocumentInfobarProps {
changedAuthor: string changedAuthor: string
@ -35,6 +36,7 @@ export const DocumentInfobar: React.FC<DocumentInfobarProps> = ({
viewCount viewCount
}) => { }) => {
const { t } = useTranslation() const { t } = useTranslation()
const assetsBaseUrl = useCustomizeAssetsUrl()
return ( return (
<div className={ 'd-flex flex-row my-3 document-infobar' }> <div className={ 'd-flex flex-row my-3 document-infobar' }>
@ -45,12 +47,12 @@ export const DocumentInfobar: React.FC<DocumentInfobarProps> = ({
mode={ DocumentInfoLineWithTimeMode.CREATED } mode={ DocumentInfoLineWithTimeMode.CREATED }
time={ createdTime } time={ createdTime }
userName={ createdAuthor } userName={ createdAuthor }
profileImageSrc={ '/img/avatar.png' }/> profileImageSrc={ `${ assetsBaseUrl }/img/avatar.png` }/>
<DocumentInfoTimeLine <DocumentInfoTimeLine
mode={ DocumentInfoLineWithTimeMode.EDITED } mode={ DocumentInfoLineWithTimeMode.EDITED }
time={ changedTime } time={ changedTime }
userName={ changedAuthor } userName={ changedAuthor }
profileImageSrc={ '/img/avatar.png' }/> profileImageSrc={ `${ assetsBaseUrl }/img/avatar.png` }/>
<hr/> <hr/>
</div> </div>
<span className={ 'ml-auto' }> <span className={ 'ml-auto' }>

View file

@ -12,6 +12,7 @@ import { CommonModal } from '../../../common/modals/common-modal'
import { DocumentInfoLine } from './document-info-line' import { DocumentInfoLine } from './document-info-line'
import { DocumentInfoLineWithTimeMode, DocumentInfoTimeLine } from './document-info-time-line' import { DocumentInfoLineWithTimeMode, DocumentInfoTimeLine } from './document-info-time-line'
import { UnitalicBoldText } from './unitalic-bold-text' import { UnitalicBoldText } from './unitalic-bold-text'
import { useCustomizeAssetsUrl } from '../../../../hooks/common/use-customize-assets-url'
export interface DocumentInfoModalProps { export interface DocumentInfoModalProps {
show: boolean, show: boolean,
@ -19,6 +20,9 @@ export interface DocumentInfoModalProps {
} }
export const DocumentInfoModal: React.FC<DocumentInfoModalProps> = ({ show, onHide }) => { export const DocumentInfoModal: React.FC<DocumentInfoModalProps> = ({ show, onHide }) => {
const assetsBaseUrl = useCustomizeAssetsUrl()
// TODO Replace hardcoded mock data with real/mock API requests
return ( return (
<CommonModal <CommonModal
show={ show } show={ show }
@ -34,7 +38,7 @@ export const DocumentInfoModal: React.FC<DocumentInfoModalProps> = ({ show, onHi
time={ DateTime.local() time={ DateTime.local()
.minus({ days: 11 }) } .minus({ days: 11 }) }
userName={ 'Tilman' } userName={ 'Tilman' }
profileImageSrc={ '/img/avatar.png' }/> profileImageSrc={ `${ assetsBaseUrl }img/avatar.png` }/>
</ListGroup.Item> </ListGroup.Item>
<ListGroup.Item> <ListGroup.Item>
<DocumentInfoTimeLine <DocumentInfoTimeLine
@ -43,7 +47,7 @@ export const DocumentInfoModal: React.FC<DocumentInfoModalProps> = ({ show, onHi
time={ DateTime.local() time={ DateTime.local()
.minus({ minutes: 3 }) } .minus({ minutes: 3 }) }
userName={ 'Philip' } userName={ 'Philip' }
profileImageSrc={ '/img/avatar.png' }/> profileImageSrc={ `${ assetsBaseUrl }img/avatar.png` }/>
</ListGroup.Item> </ListGroup.Item>
<ListGroup.Item> <ListGroup.Item>
<DocumentInfoLine icon={ 'users' } size={ '2x' }> <DocumentInfoLine icon={ 'users' } size={ '2x' }>

View file

@ -38,17 +38,17 @@ export const ShareModal: React.FC<ShareModalProps> = ({ show, onHide }) => {
titleI18nKey={ 'editor.modal.shareLink.title' }> titleI18nKey={ 'editor.modal.shareLink.title' }>
<Modal.Body> <Modal.Body>
<Trans i18nKey={ 'editor.modal.shareLink.editorDescription' }/> <Trans i18nKey={ 'editor.modal.shareLink.editorDescription' }/>
<CopyableField content={ `${ baseUrl }/n/${ id }?${ editorMode }` } nativeShareButton={ true } <CopyableField content={ `${ baseUrl }n/${ id }?${ editorMode }` } nativeShareButton={ true }
url={ `${ baseUrl }/n/${ id }?${ editorMode }` }/> url={ `${ baseUrl }n/${ id }?${ editorMode }` }/>
<ShowIf condition={ noteFrontmatter.type === NoteType.SLIDE }> <ShowIf condition={ noteFrontmatter.type === NoteType.SLIDE }>
<Trans i18nKey={ 'editor.modal.shareLink.slidesDescription' }/> <Trans i18nKey={ 'editor.modal.shareLink.slidesDescription' }/>
<CopyableField content={ `${ baseUrl }/p/${ id }` } nativeShareButton={ true } <CopyableField content={ `${ baseUrl }p/${ id }` } nativeShareButton={ true }
url={ `${ baseUrl }/p/${ id }` }/> url={ `${ baseUrl }p/${ id }` }/>
</ShowIf> </ShowIf>
<ShowIf condition={ noteFrontmatter.type === '' }> <ShowIf condition={ noteFrontmatter.type === '' }>
<Trans i18nKey={ 'editor.modal.shareLink.viewOnlyDescription' }/> <Trans i18nKey={ 'editor.modal.shareLink.viewOnlyDescription' }/>
<CopyableField content={ `${ baseUrl }/s/${ id }` } nativeShareButton={ true } <CopyableField content={ `${ baseUrl }s/${ id }` } nativeShareButton={ true }
url={ `${ baseUrl }/s/${ id }` }/> url={ `${ baseUrl }s/${ id }` }/>
</ShowIf> </ShowIf>
</Modal.Body> </Modal.Body>
</CommonModal> </CommonModal>