Emoji quick styling

pull/1102/head
Vincent 5 years ago
parent 6e74640165
commit 7235ccff88

@ -903,14 +903,12 @@
} }
}, },
"audioPermissionNeededTitle": { "audioPermissionNeededTitle": {
"message": "message": "Sending audio messages requires microphone access",
"Sending audio messages requires microphone access",
"description": "description":
"Shown if the user attempts to send an audio message without audio permssions turned on" "Shown if the user attempts to send an audio message without audio permssions turned on"
}, },
"audioPermissionNeededDescription": { "audioPermissionNeededDescription": {
"message": "message": "Give Session microphone permissions in your settings",
"Give Session microphone permissions in your settings",
"description": "description":
"Shown if the user attempts to send an audio message without audio permssions turned on" "Shown if the user attempts to send an audio message without audio permssions turned on"
}, },

@ -942,7 +942,6 @@
.toString(36) .toString(36)
.substring(3); .substring(3);
window.toasts = new Map(); window.toasts = new Map();
window.pushToast = options => { window.pushToast = options => {
// Setting toasts with the same ID can be used to prevent identical // Setting toasts with the same ID can be used to prevent identical
@ -1061,7 +1060,6 @@
window.getMediaPermissions().then(value => { window.getMediaPermissions().then(value => {
window.setMediaPermissions(!value); window.setMediaPermissions(!value);
}); });
}; };
// attempts a connection to an open group server // attempts a connection to an open group server

@ -1523,7 +1523,6 @@
groupInvitation = null, groupInvitation = null,
otherOptions = {} otherOptions = {}
) { ) {
this.clearTypingTimers(); this.clearTypingTimers();
const destination = this.id; const destination = this.id;

@ -244,7 +244,6 @@ installSetter('spell-check', 'setSpellCheck');
installGetter('media-permissions', 'getMediaPermissions'); installGetter('media-permissions', 'getMediaPermissions');
installGetter('media-permissions', 'setMediaPermissions'); installGetter('media-permissions', 'setMediaPermissions');
window.getMediaPermissions = () => window.getMediaPermissions = () =>
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
ipc.once('get-success-media-permissions', (_event, error, value) => { ipc.once('get-success-media-permissions', (_event, error, value) => {
@ -276,7 +275,6 @@ window.getSettingValue = (settingID, comparisonValue = null) => {
return comparisonValue ? !!settingVal === comparisonValue : settingVal; return comparisonValue ? !!settingVal === comparisonValue : settingVal;
}; };
window.setSettingValue = (settingID, value) => { window.setSettingValue = (settingID, value) => {
window.storage.put(settingID, value); window.storage.put(settingID, value);
}; };

@ -220,10 +220,11 @@ $composition-container-height: 60px;
visibility: visible; visibility: visible;
} }
& > section { & > section.emoji-mart {
background-color: $session-shade-4; background-color: $session-shade-4;
border: 1px solid $session-shade-6-alt; border: 1px solid $session-shade-6-alt;
border-radius: $session-margin-lg; border-radius: 8px;
.emoji-mart-category-label { .emoji-mart-category-label {
top: -2px; top: -2px;
@ -234,6 +235,31 @@ $composition-container-height: 60px;
background-color: $session-shade-4; background-color: $session-shade-4;
} }
} }
.emoji-mart-bar:last-child {
border: none;
.emoji-mart-preview {
display: none;
}
}
&:after{
content: '';
position: absolute;
top: calc(100% - 40px);
left: calc(100% - 79px);
width: 22px;
height: 22px;
background-color: $session-shade-4;
transform: rotate(45deg);
border-radius: 3px;
transform: scaleY(1.4) rotate(45deg);
border: 0.7px solid $session-shade-6-alt;
clip-path: polygon(100% 100%, 7.2px 100%, 100% 7.2px);
}
} }
} }

@ -23,7 +23,7 @@ interface Props {
interface State { interface State {
message: string; message: string;
isRecordingView: boolean; showRecordingView: boolean;
mediaSetting: boolean | null; mediaSetting: boolean | null;
showEmojiPanel: boolean; showEmojiPanel: boolean;
@ -43,7 +43,7 @@ export class SessionCompositionBox extends React.Component<Props, State> {
message: '', message: '',
attachments: [], attachments: [],
voiceRecording: undefined, voiceRecording: undefined,
isRecordingView: false, showRecordingView: false,
mediaSetting: null, mediaSetting: null,
showEmojiPanel: false, showEmojiPanel: false,
}; };
@ -85,11 +85,11 @@ export class SessionCompositionBox extends React.Component<Props, State> {
} }
public render() { public render() {
const { isRecordingView } = this.state; const { showRecordingView } = this.state;
return ( return (
<div className="composition-container"> <div className="composition-container">
{ isRecordingView ? ( { showRecordingView ? (
<>{this.renderRecordingView()}</> <>{this.renderRecordingView()}</>
) : ( ) : (
<>{this.renderCompositionView()}</> <>{this.renderCompositionView()}</>
@ -288,7 +288,7 @@ export class SessionCompositionBox extends React.Component<Props, State> {
} }
private async sendVoiceMessage(audioBlob: Blob) { private async sendVoiceMessage(audioBlob: Blob) {
if (!this.state.isRecordingView) return; if (!this.state.showRecordingView) return;
const fileBuffer = await new Response(audioBlob).arrayBuffer(); const fileBuffer = await new Response(audioBlob).arrayBuffer();
@ -322,7 +322,10 @@ export class SessionCompositionBox extends React.Component<Props, State> {
const {mediaSetting} = this.state; const {mediaSetting} = this.state;
if (mediaSetting){ if (mediaSetting){
this.setState({ isRecordingView: true }); this.setState({
showRecordingView: true,
showEmojiPanel: false,
});
this.props.onLoadVoiceNoteView(); this.props.onLoadVoiceNoteView();
return; return;
} }
@ -338,7 +341,7 @@ export class SessionCompositionBox extends React.Component<Props, State> {
private onExitVoiceNoteView() { private onExitVoiceNoteView() {
// Do stuff for component, then run callback to SessionConversation // Do stuff for component, then run callback to SessionConversation
this.setState({ isRecordingView: false }); this.setState({ showRecordingView: false });
this.props.onExitVoiceNoteView(); this.props.onExitVoiceNoteView();
} }

@ -23,7 +23,7 @@ interface State {
doneInitialScroll: boolean; doneInitialScroll: boolean;
displayScrollToBottomButton: boolean; displayScrollToBottomButton: boolean;
messageFetchTimestamp: number; messageFetchTimestamp: number;
isRecordingView: boolean; showRecordingView: boolean;
} }
export class SessionConversation extends React.Component<any, State> { export class SessionConversation extends React.Component<any, State> {
@ -47,7 +47,7 @@ export class SessionConversation extends React.Component<any, State> {
doneInitialScroll: false, doneInitialScroll: false,
displayScrollToBottomButton: false, displayScrollToBottomButton: false,
messageFetchTimestamp: 0, messageFetchTimestamp: 0,
isRecordingView: false, showRecordingView: false,
}; };
this.handleScroll = this.handleScroll.bind(this); this.handleScroll = this.handleScroll.bind(this);
@ -103,7 +103,7 @@ export class SessionConversation extends React.Component<any, State> {
public render() { public render() {
console.log(`[vince][info] Props`, this.props); console.log(`[vince][info] Props`, this.props);
const { messages, conversationKey, doneInitialScroll, isRecordingView } = this.state; const { messages, conversationKey, doneInitialScroll, showRecordingView } = this.state;
const loading = !doneInitialScroll || messages.length === 0; const loading = !doneInitialScroll || messages.length === 0;
const selectionMode = !!this.state.selectedMessages.length; const selectionMode = !!this.state.selectedMessages.length;
@ -140,7 +140,7 @@ export class SessionConversation extends React.Component<any, State> {
</div> </div>
<SessionScrollButton display={true} onClick={this.scrollToBottom}/> <SessionScrollButton display={true} onClick={this.scrollToBottom}/>
{ isRecordingView && ( { showRecordingView && (
<div className="messages-wrapper--blocking-overlay"></div> <div className="messages-wrapper--blocking-overlay"></div>
)} )}
</div> </div>
@ -619,14 +619,14 @@ export class SessionConversation extends React.Component<any, State> {
private onLoadVoiceNoteView() { private onLoadVoiceNoteView() {
this.setState({ this.setState({
isRecordingView: true, showRecordingView: true,
selectedMessages: [], selectedMessages: [],
}) })
} }
private onExitVoiceNoteView() { private onExitVoiceNoteView() {
this.setState({ this.setState({
isRecordingView: false, showRecordingView: false,
}); });
console.log(`[vince] Stopped recording entirely`); console.log(`[vince] Stopped recording entirely`);
@ -634,7 +634,7 @@ export class SessionConversation extends React.Component<any, State> {
private onKeyDown(event: any) { private onKeyDown(event: any) {
const selectionMode = !!this.state.selectedMessages.length; const selectionMode = !!this.state.selectedMessages.length;
const recordingMode = this.state.isRecordingView; const recordingMode = this.state.showRecordingView;
const messageContainer = document.getElementsByClassName('messages-container')[0]; const messageContainer = document.getElementsByClassName('messages-container')[0];
const pageHeight = messageContainer.clientHeight; const pageHeight = messageContainer.clientHeight;

Loading…
Cancel
Save