Merge pull request #2238 from matrix-org/bwindels/initialtimelinetweaks

Redesign: Initial timeline tweaks
This commit is contained in:
Bruno Windels 2018-10-23 19:36:19 +00:00 committed by GitHub
commit 88df3d2a81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 111 additions and 33 deletions

View file

@ -139,9 +139,8 @@ limitations under the License.
} }
.mx_RoomView_MessageList { .mx_RoomView_MessageList {
width: 100%;
list-style-type: none; list-style-type: none;
padding: 0px; padding: 18px;
} }
.mx_RoomView_MessageList li { .mx_RoomView_MessageList li {

View file

@ -16,10 +16,21 @@ limitations under the License.
.mx_DateSeparator { .mx_DateSeparator {
clear: both; clear: both;
margin-top: 32px; margin: 4px 0;
margin-bottom: 8px; display: flex;
margin-left: 63px; align-items: center;
padding-bottom: 6px; font-size: 14px;
border-bottom: 1px solid $primary-hairline-color; color: $roomtopic-color;
} }
.mx_DateSeparator > hr {
flex: 1 1 0;
height: 0;
border: none;
border-bottom: 1px solid $panel-divider-color;
}
.mx_DateSeparator > date {
margin: 0 25px;
flex: 0 0 auto;
}

View file

@ -13,3 +13,41 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
.mx_SenderProfile_name {
font-weight: 600;
}
.mx_SenderProfile_color1 {
color: $username-variant1-color;
}
.mx_SenderProfile_color2 {
color: $username-variant2-color;
}
.mx_SenderProfile_color3 {
color: $username-variant3-color;
}
.mx_SenderProfile_color4 {
color: $username-variant4-color;
}
.mx_SenderProfile_color5 {
color: $username-variant5-color;
}
.mx_SenderProfile_color6 {
color: $username-variant6-color;
}
.mx_SenderProfile_color7 {
color: $username-variant7-color;
}
.mx_SenderProfile_color8 {
color: $username-variant8-color;
}

View file

@ -55,11 +55,6 @@ limitations under the License.
line-height: 22px; line-height: 22px;
} }
.mx_EventTile .mx_SenderProfile .mx_SenderProfile_name,
.mx_EventTile .mx_SenderProfile .mx_SenderProfile_aux {
opacity: 0.5;
}
.mx_EventTile .mx_SenderProfile .mx_Flair { .mx_EventTile .mx_SenderProfile .mx_Flair {
opacity: 0.7; opacity: 0.7;
margin-left: 5px; margin-left: 5px;

View file

@ -62,8 +62,7 @@ limitations under the License.
} }
.mx_MessageComposer .mx_MessageComposer_avatar { .mx_MessageComposer .mx_MessageComposer_avatar {
padding-left: 10px; padding: 0 28px;
padding-right: 28px;
} }
.mx_MessageComposer .mx_MessageComposer_avatar .mx_BaseAvatar { .mx_MessageComposer .mx_MessageComposer_avatar .mx_BaseAvatar {
@ -76,7 +75,7 @@ limitations under the License.
.mx_MessageComposer_e2eIcon { .mx_MessageComposer_e2eIcon {
position: absolute; position: absolute;
left: 44px; left: 60px;
} }
.mx_MessageComposer_noperm_error { .mx_MessageComposer_noperm_error {

View file

@ -28,7 +28,7 @@ limitations under the License.
.mx_RoomHeader_leftRow { .mx_RoomHeader_leftRow {
display: flex; display: flex;
margin-left: 15px; margin-left: 26px;
order: 1; order: 1;
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;

View file

@ -105,6 +105,15 @@ $roomtile-name-color: rgba(186, 186, 186, 0.8);
$roomtile-selected-bg-color: #333; $roomtile-selected-bg-color: #333;
$roomtile-focused-bg-color: rgba(255, 255, 255, 0.2); $roomtile-focused-bg-color: rgba(255, 255, 255, 0.2);
$username-variant1-color: #1e7ddc;
$username-variant2-color: #a756a8;
$username-variant3-color: #7ac9a1;
$username-variant4-color: #f2809d;
$username-variant5-color: #ffc666;
$username-variant6-color: #76ddd7;
$username-variant7-color: #45529b;
$username-variant8-color: #bfd251;
$roomsublist-background: rgba(0, 0, 0, 0.2); $roomsublist-background: rgba(0, 0, 0, 0.2);
$roomsublist-label-fg-color: $h3-color; $roomsublist-label-fg-color: $h3-color;
$roomsublist-label-bg-color: $tertiary-accent-color; $roomsublist-label-bg-color: $tertiary-accent-color;

View file

@ -120,6 +120,15 @@ $roomtile-notified-color: #212121;
$roomtile-selected-bg-color: #fff; $roomtile-selected-bg-color: #fff;
$roomtile-focused-bg-color: #fff; $roomtile-focused-bg-color: #fff;
$username-variant1-color: #1e7ddc;
$username-variant2-color: #a756a8;
$username-variant3-color: #7ac9a1;
$username-variant4-color: #f2809d;
$username-variant5-color: #ffc666;
$username-variant6-color: #76ddd7;
$username-variant7-color: #45529b;
$username-variant8-color: #bfd251;
$roomtile-transparent-focused-color: rgba(0, 0, 0, 0.1); $roomtile-transparent-focused-color: rgba(0, 0, 0, 0.1);
$roomsublist-background: $secondary-accent-color; $roomsublist-background: $secondary-accent-color;

View file

@ -119,6 +119,15 @@ $roomtile-notified-color: $roomtile-name-color;
$roomtile-selected-bg-color: rgba(255, 255, 255, 0.8); $roomtile-selected-bg-color: rgba(255, 255, 255, 0.8);
$roomtile-focused-bg-color: rgba(255, 255, 255, 0.9); $roomtile-focused-bg-color: rgba(255, 255, 255, 0.9);
$username-variant1-color: #1e7ddc;
$username-variant2-color: #a756a8;
$username-variant3-color: #7ac9a1;
$username-variant4-color: #f2809d;
$username-variant5-color: #ffc666;
$username-variant6-color: #76ddd7;
$username-variant7-color: #45529b;
$username-variant8-color: #bfd251;
$roomtile-transparent-focused-color: rgba(0, 0, 0, 0.1); $roomtile-transparent-focused-color: rgba(0, 0, 0, 0.1);
$roomsublist-background: rgba(0, 0, 0, 0.05); $roomsublist-background: rgba(0, 0, 0, 0.05);

View file

@ -15,21 +15,7 @@ limitations under the License.
*/ */
import SdkConfig from './SdkConfig'; import SdkConfig from './SdkConfig';
import {hashCode} from './utils/FormattingUtils';
function hashCode(str) {
let hash = 0;
let i;
let chr;
if (str.length === 0) {
return hash;
}
for (i = 0; i < str.length; i++) {
chr = str.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0;
}
return Math.abs(hash);
}
export function phasedRollOutExpiredForUser(username, feature, now, rollOutConfig = SdkConfig.get().phasedRollOut) { export function phasedRollOutExpiredForUser(username, feature, now, rollOutConfig = SdkConfig.get().phasedRollOut) {
if (!rollOutConfig) { if (!rollOutConfig) {

View file

@ -56,6 +56,6 @@ export default class DateSeparator extends React.Component {
} }
render() { render() {
return <h2 className="mx_DateSeparator">{ this.getLabel() }</h2>; return <h2 className="mx_DateSeparator"><hr/><date>{ this.getLabel() }</date><hr/></h2>;
} }
} }

View file

@ -23,6 +23,7 @@ import sdk from '../../../index';
import Flair from '../elements/Flair.js'; import Flair from '../elements/Flair.js';
import FlairStore from '../../../stores/FlairStore'; import FlairStore from '../../../stores/FlairStore';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import {hashCode} from '../../../utils/FormattingUtils';
export default React.createClass({ export default React.createClass({
displayName: 'SenderProfile', displayName: 'SenderProfile',
@ -96,6 +97,7 @@ export default React.createClass({
render() { render() {
const EmojiText = sdk.getComponent('elements.EmojiText'); const EmojiText = sdk.getComponent('elements.EmojiText');
const {mxEvent} = this.props; const {mxEvent} = this.props;
const colorNumber = hashCode(mxEvent.getSender()) % 8;
const name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender(); const name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
const {msgtype} = mxEvent.getContent(); const {msgtype} = mxEvent.getContent();
@ -119,7 +121,7 @@ export default React.createClass({
// Name + flair // Name + flair
const nameFlair = <span> const nameFlair = <span>
<span className="mx_SenderProfile_name"> <span className={`mx_SenderProfile_name mx_SenderProfile_color${colorNumber}`}>
{ nameElem } { nameElem }
</span> </span>
{ flair } { flair }

View file

@ -37,3 +37,24 @@ export function formatCount(count) {
export function formatCryptoKey(key) { export function formatCryptoKey(key) {
return key.match(/.{1,4}/g).join(" "); return key.match(/.{1,4}/g).join(" ");
} }
/**
* calculates a numeric hash for a given string
*
* @param {string} str string to hash
*
* @return {number}
*/
export function hashCode(str) {
let hash = 0;
let i;
let chr;
if (str.length === 0) {
return hash;
}
for (i = 0; i < str.length; i++) {
chr = str.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0;
}
return Math.abs(hash);
}