Add SOCKET_SEARCH action constant

This commit is contained in:
Ken-Håvard Lieng 2016-01-18 03:21:58 +01:00
parent 35f806c18d
commit 82e2343d5b
5 changed files with 42 additions and 22 deletions

File diff suppressed because one or more lines are too long

View File

@ -350,12 +350,24 @@ i[class^="icon-"]:before, i[class*=" icon-"]:before {
right: 0;
}
.search-input {
.search-input-wrap {
display: flex;
width: 100%;
padding: 15px;
background: #FFF;
border-bottom: 1px solid #DDD;
}
.search i {
padding: 15px;
color: #DDD;
}
.search-input {
flex: 1;
padding: 15px;
padding-left: 0;
}
.search-results {
position: absolute;
top: 50px;

View File

@ -35,6 +35,7 @@ export const SOCKET_PART = 'SOCKET_PART';
export const SOCKET_PM = 'SOCKET_PM';
export const SOCKET_QUIT = 'SOCKET_QUIT';
export const SOCKET_SERVERS = 'SOCKET_SERVERS';
export const SOCKET_SEARCH = 'SOCKET_SEARCH';
export const SOCKET_TOPIC = 'SOCKET_TOPIC';
export const SOCKET_USERS = 'SOCKET_USERS';
export const TAB_HISTORY_POP = 'TAB_HISTORY_POP';

View File

@ -26,12 +26,15 @@ export default class Search extends Component {
return (
<div className="search" style={style}>
<input
ref="input"
className="search-input"
type="text"
onChange={this.handleSearch}
/>
<div className="search-input-wrap">
<i className="icon-search" />
<input
ref="input"
className="search-input"
type="text"
onChange={this.handleSearch}
/>
</div>
<div className="search-results">{results}</div>
</div>
);

View File

@ -62,11 +62,13 @@ func (u *User) GetLastMessages(server, channel string, count int) ([]Message, er
return nil
})
if count < len(messages) {
if count == 0 {
return messages, nil
} else if count < len(messages) {
return messages[count:], nil
} else {
return nil, nil
}
return nil, nil
}
func (u *User) GetMessages(server, channel string, count int, fromID uint64) ([]Message, error) {
@ -89,7 +91,9 @@ func (u *User) GetMessages(server, channel string, count int, fromID uint64) ([]
return nil
})
if count < len(messages) {
if count == 0 {
return messages, nil
} else if count < len(messages) {
return messages[count:], nil
}