71 lines
		
	
	
	
		
			2.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			71 lines
		
	
	
	
		
			2.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<div class="compose-box {{overLimit ? 'over-char-limit' : ''}}">
 | 
						|
  <ComposeAuthor />
 | 
						|
  <ComposeInput :realm :text />
 | 
						|
  <ComposeLengthGauge :textLength :textOverLimit />
 | 
						|
  <ComposeToolbar :realm :postPrivacy :media />
 | 
						|
  <ComposeLengthIndicator :textLength :textOverLimit />
 | 
						|
  <ComposeMedia :realm :media />
 | 
						|
  <ComposeButton :textLength :textOverLimit />
 | 
						|
</div>
 | 
						|
<style>
 | 
						|
  .compose-box {
 | 
						|
    border-radius: 4px;
 | 
						|
    padding: 20px;
 | 
						|
    display: grid;
 | 
						|
    align-items: flex-start;
 | 
						|
    grid-template-areas:
 | 
						|
      "avatar display-name handle    handle"
 | 
						|
      "avatar input        input     input"
 | 
						|
      "avatar gauge        gauge     gauge"
 | 
						|
      "avatar toolbar      toolbar   length"
 | 
						|
      "avatar media        media     media"
 | 
						|
      "avatar button       button    button";
 | 
						|
    grid-template-columns: min-content minmax(0, max-content) 1fr 1fr;
 | 
						|
    border-bottom: 1px solid var(--main-border);
 | 
						|
    width: 560px;
 | 
						|
    max-width: calc(100vw - 40px);
 | 
						|
  }
 | 
						|
 | 
						|
  @media (max-width: 767px) {
 | 
						|
    .compose-box {
 | 
						|
      padding: 10px 10px;
 | 
						|
      max-width: calc(100vw - 20px);
 | 
						|
      width: 580px;
 | 
						|
    }
 | 
						|
  }
 | 
						|
</style>
 | 
						|
<script>
 | 
						|
  import ComposeToolbar from './ComposeToolbar.html'
 | 
						|
  import ComposeLengthGauge from './ComposeLengthGauge.html'
 | 
						|
  import ComposeLengthIndicator from './ComposeLengthIndicator.html'
 | 
						|
  import ComposeAuthor from './ComposeAuthor.html'
 | 
						|
  import ComposeInput from './ComposeInput.html'
 | 
						|
  import ComposeButton from './ComposeButton.html'
 | 
						|
  import ComposeMedia from './ComposeMedia.html'
 | 
						|
  import { measureText } from '../../_utils/measureText'
 | 
						|
  import { CHAR_LIMIT, POST_PRIVACY_OPTIONS } from '../../_static/statuses'
 | 
						|
  import { store } from '../../_store/store'
 | 
						|
 | 
						|
  export default {
 | 
						|
    components: {
 | 
						|
      ComposeAuthor,
 | 
						|
      ComposeToolbar,
 | 
						|
      ComposeLengthGauge,
 | 
						|
      ComposeLengthIndicator,
 | 
						|
      ComposeInput,
 | 
						|
      ComposeButton,
 | 
						|
      ComposeMedia
 | 
						|
    },
 | 
						|
    store: () => store,
 | 
						|
    computed: {
 | 
						|
      composeData: ($currentComposeData, realm) => $currentComposeData[realm] || {},
 | 
						|
      text: (composeData) => composeData.text || '',
 | 
						|
      media: (composeData) => composeData.media || [],
 | 
						|
      postPrivacy: (postPrivacyKey) => POST_PRIVACY_OPTIONS.find(_ => _.key === postPrivacyKey),
 | 
						|
      defaultPostPrivacyKey: ($currentVerifyCredentials) => $currentVerifyCredentials.source.privacy,
 | 
						|
      postPrivacyKey: (composeData, defaultPostPrivacyKey) => composeData.postPrivacy || defaultPostPrivacyKey,
 | 
						|
      textLength: (text) => measureText(text),
 | 
						|
      textOverLimit: (textLength) => textLength > CHAR_LIMIT
 | 
						|
    }
 | 
						|
  }
 | 
						|
</script>
 |