Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2238 from matrix-org/bwindels/initialtimelinetweaks
Browse files Browse the repository at this point in the history
Redesign: Initial timeline tweaks
  • Loading branch information
bwindels committed Oct 23, 2018
2 parents f95b50f + b7ab207 commit 88df3d2
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 33 deletions.
3 changes: 1 addition & 2 deletions res/css/structures/_RoomView.scss
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,8 @@ limitations under the License.
}

.mx_RoomView_MessageList {
width: 100%;
list-style-type: none;
padding: 0px;
padding: 18px;
}

.mx_RoomView_MessageList li {
Expand Down
21 changes: 16 additions & 5 deletions res/css/views/messages/_DateSeparator.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,21 @@ limitations under the License.

.mx_DateSeparator {
clear: both;
margin-top: 32px;
margin-bottom: 8px;
margin-left: 63px;
padding-bottom: 6px;
border-bottom: 1px solid $primary-hairline-color;
margin: 4px 0;
display: flex;
align-items: center;
font-size: 14px;
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;
}
38 changes: 38 additions & 0 deletions res/css/views/messages/_SenderProfile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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
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;
}


5 changes: 0 additions & 5 deletions res/css/views/rooms/_EventTile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ limitations under the License.
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 {
opacity: 0.7;
margin-left: 5px;
Expand Down
5 changes: 2 additions & 3 deletions res/css/views/rooms/_MessageComposer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ limitations under the License.
}

.mx_MessageComposer .mx_MessageComposer_avatar {
padding-left: 10px;
padding-right: 28px;
padding: 0 28px;
}

.mx_MessageComposer .mx_MessageComposer_avatar .mx_BaseAvatar {
Expand All @@ -76,7 +75,7 @@ limitations under the License.

.mx_MessageComposer_e2eIcon {
position: absolute;
left: 44px;
left: 60px;
}

.mx_MessageComposer_noperm_error {
Expand Down
2 changes: 1 addition & 1 deletion res/css/views/rooms/_RoomHeader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ limitations under the License.

.mx_RoomHeader_leftRow {
display: flex;
margin-left: 15px;
margin-left: 26px;
order: 1;
flex: 1;
overflow: hidden;
Expand Down
9 changes: 9 additions & 0 deletions res/themes/dark/css/_dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ $roomtile-name-color: rgba(186, 186, 186, 0.8);
$roomtile-selected-bg-color: #333;
$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-label-fg-color: $h3-color;
$roomsublist-label-bg-color: $tertiary-accent-color;
Expand Down
9 changes: 9 additions & 0 deletions res/themes/dharma/css/_dharma.scss
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ $roomtile-notified-color: #212121;
$roomtile-selected-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);

$roomsublist-background: $secondary-accent-color;
Expand Down
9 changes: 9 additions & 0 deletions res/themes/light/css/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ $roomtile-notified-color: $roomtile-name-color;
$roomtile-selected-bg-color: rgba(255, 255, 255, 0.8);
$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);

$roomsublist-background: rgba(0, 0, 0, 0.05);
Expand Down
16 changes: 1 addition & 15 deletions src/PhasedRollOut.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,7 @@ limitations under the License.
*/

import SdkConfig from './SdkConfig';

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);
}
import {hashCode} from './utils/FormattingUtils';

export function phasedRollOutExpiredForUser(username, feature, now, rollOutConfig = SdkConfig.get().phasedRollOut) {
if (!rollOutConfig) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/messages/DateSeparator.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ export default class DateSeparator extends React.Component {
}

render() {
return <h2 className="mx_DateSeparator">{ this.getLabel() }</h2>;
return <h2 className="mx_DateSeparator"><hr/><date>{ this.getLabel() }</date><hr/></h2>;
}
}
4 changes: 3 additions & 1 deletion src/components/views/messages/SenderProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import sdk from '../../../index';
import Flair from '../elements/Flair.js';
import FlairStore from '../../../stores/FlairStore';
import { _t } from '../../../languageHandler';
import {hashCode} from '../../../utils/FormattingUtils';

export default React.createClass({
displayName: 'SenderProfile',
Expand Down Expand Up @@ -96,6 +97,7 @@ export default React.createClass({
render() {
const EmojiText = sdk.getComponent('elements.EmojiText');
const {mxEvent} = this.props;
const colorNumber = hashCode(mxEvent.getSender()) % 8;
const name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
const {msgtype} = mxEvent.getContent();

Expand All @@ -119,7 +121,7 @@ export default React.createClass({

// Name + flair
const nameFlair = <span>
<span className="mx_SenderProfile_name">
<span className={`mx_SenderProfile_name mx_SenderProfile_color${colorNumber}`}>
{ nameElem }
</span>
{ flair }
Expand Down
21 changes: 21 additions & 0 deletions src/utils/FormattingUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,24 @@ export function formatCount(count) {
export function formatCryptoKey(key) {
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);
}

0 comments on commit 88df3d2

Please sign in to comment.