mirror of
https://github.com/urbit/shrub.git
synced 2024-11-30 22:15:47 +03:00
frontend: apply ec6c2ed69
to link, publish, groups
This commit is contained in:
parent
143bae6190
commit
cc1c28fdec
@ -73,6 +73,7 @@ export class AddScreen extends Component {
|
||||
groups={props.groups}
|
||||
contacts={props.contacts}
|
||||
groupResults={false}
|
||||
shipResults={true}
|
||||
invites={this.state.invites}
|
||||
setInvite={this.invChange}
|
||||
/>
|
||||
|
@ -102,37 +102,37 @@ export class InviteSearch extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
let shipMatches = this.state.peers.filter(e => {
|
||||
return e.includes(searchTerm) && !this.props.invites.ships.includes(e);
|
||||
});
|
||||
|
||||
for (let contact of this.state.contacts.keys()) {
|
||||
let thisContact = this.state.contacts.get(contact);
|
||||
let match = thisContact.filter(e => {
|
||||
return e.toLowerCase().includes(searchTerm);
|
||||
let shipMatches = [];
|
||||
if (this.props.shipResults) {
|
||||
shipMatches = this.state.peers.filter(e => {
|
||||
return e.includes(searchTerm) && !this.props.invites.ships.includes(e);
|
||||
});
|
||||
if (match.length > 0) {
|
||||
if (!(contact in shipMatches)) {
|
||||
shipMatches.push(contact);
|
||||
|
||||
for (let contact of this.state.contacts.keys()) {
|
||||
let thisContact = this.state.contacts.get(contact);
|
||||
let match = thisContact.filter(e => {
|
||||
return e.toLowerCase().includes(searchTerm);
|
||||
});
|
||||
if (match.length > 0) {
|
||||
if (!(contact in shipMatches)) {
|
||||
shipMatches.push(contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let isValid = true;
|
||||
if (!urbitOb.isValidPatp("~" + searchTerm)) {
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if (shipMatches.length === 0 && isValid) {
|
||||
shipMatches.push(searchTerm);
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({
|
||||
searchResults: { groups: groupMatches, ships: shipMatches }
|
||||
});
|
||||
|
||||
let isValid = true;
|
||||
if (!urbitOb.isValidPatp("~" + searchTerm)) {
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if (shipMatches.length === 0 && isValid) {
|
||||
shipMatches.push(searchTerm);
|
||||
this.setState({
|
||||
searchResults: { groups: groupMatches, ships: shipMatches }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,6 +209,18 @@ export class InviteSearch extends Component {
|
||||
let participants = <div />;
|
||||
let searchResults = <div />;
|
||||
|
||||
let placeholder = '';
|
||||
if (props.shipResults) {
|
||||
placeholder = 'ships';
|
||||
}
|
||||
if (props.groupResults) {
|
||||
if (placeholder.length > 0) {
|
||||
placeholder = placeholder + ' or ';
|
||||
}
|
||||
placeholder = placeholder + 'existing groups';
|
||||
}
|
||||
placeholder = 'Search for ' + placeholder;
|
||||
|
||||
let invErrElem = <span />;
|
||||
if (state.inviteError) {
|
||||
invErrElem = (
|
||||
@ -372,7 +384,7 @@ export class InviteSearch extends Component {
|
||||
"f7 ba b--gray3 b--gray2-d bg-gray0-d white-d pa3 w-100" +
|
||||
" db focus-b--black focus-b--white-d"
|
||||
}
|
||||
placeholder="Search for ships or existing groups"
|
||||
placeholder={placeholder}
|
||||
disabled={searchDisabled}
|
||||
rows={1}
|
||||
spellCheck={false}
|
||||
|
@ -134,6 +134,7 @@ export class NewScreen extends Component {
|
||||
groups={this.props.groups}
|
||||
contacts={this.props.contacts}
|
||||
groupResults={false}
|
||||
shipResults={true}
|
||||
invites={this.state.invites}
|
||||
setInvite={this.invChange}
|
||||
/>
|
||||
|
@ -57,6 +57,7 @@ export class InviteElement extends Component {
|
||||
groups={{}}
|
||||
contacts={props.contacts}
|
||||
groupResults={false}
|
||||
shipResults={true}
|
||||
invites={{
|
||||
groups: [],
|
||||
ships: this.state.members
|
||||
|
@ -102,37 +102,37 @@ export class InviteSearch extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
let shipMatches = this.state.peers.filter(e => {
|
||||
return e.includes(searchTerm) && !this.props.invites.ships.includes(e);
|
||||
});
|
||||
|
||||
for (let contact of this.state.contacts.keys()) {
|
||||
let thisContact = this.state.contacts.get(contact);
|
||||
let match = thisContact.filter(e => {
|
||||
return e.toLowerCase().includes(searchTerm);
|
||||
let shipMatches = [];
|
||||
if (this.props.shipResults) {
|
||||
shipMatches = this.state.peers.filter(e => {
|
||||
return e.includes(searchTerm) && !this.props.invites.ships.includes(e);
|
||||
});
|
||||
if (match.length > 0) {
|
||||
if (!(contact in shipMatches)) {
|
||||
shipMatches.push(contact);
|
||||
|
||||
for (let contact of this.state.contacts.keys()) {
|
||||
let thisContact = this.state.contacts.get(contact);
|
||||
let match = thisContact.filter(e => {
|
||||
return e.toLowerCase().includes(searchTerm);
|
||||
});
|
||||
if (match.length > 0) {
|
||||
if (!(contact in shipMatches)) {
|
||||
shipMatches.push(contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let isValid = true;
|
||||
if (!urbitOb.isValidPatp("~" + searchTerm)) {
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if (shipMatches.length === 0 && isValid) {
|
||||
shipMatches.push(searchTerm);
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({
|
||||
searchResults: { groups: groupMatches, ships: shipMatches }
|
||||
});
|
||||
|
||||
let isValid = true;
|
||||
if (!urbitOb.isValidPatp("~" + searchTerm)) {
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if (shipMatches.length === 0 && isValid) {
|
||||
shipMatches.push(searchTerm);
|
||||
this.setState({
|
||||
searchResults: { groups: groupMatches, ships: shipMatches }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,6 +209,18 @@ export class InviteSearch extends Component {
|
||||
let participants = <div />;
|
||||
let searchResults = <div />;
|
||||
|
||||
let placeholder = '';
|
||||
if (props.shipResults) {
|
||||
placeholder = 'ships';
|
||||
}
|
||||
if (props.groupResults) {
|
||||
if (placeholder.length > 0) {
|
||||
placeholder = placeholder + ' or ';
|
||||
}
|
||||
placeholder = placeholder + 'existing groups';
|
||||
}
|
||||
placeholder = 'Search for ' + placeholder;
|
||||
|
||||
let invErrElem = <span />;
|
||||
if (state.inviteError) {
|
||||
invErrElem = (
|
||||
@ -372,7 +384,7 @@ export class InviteSearch extends Component {
|
||||
"f7 ba b--gray3 b--gray2-d bg-gray0-d white-d pa3 w-100" +
|
||||
" db focus-b--black focus-b--white-d"
|
||||
}
|
||||
placeholder="Search for ships or existing groups"
|
||||
placeholder={placeholder}
|
||||
disabled={searchDisabled}
|
||||
rows={1}
|
||||
spellCheck={false}
|
||||
|
@ -221,6 +221,7 @@ export class NewScreen extends Component {
|
||||
groups={props.groups}
|
||||
contacts={props.contacts}
|
||||
groupResults={true}
|
||||
shipResults={true}
|
||||
invites={{
|
||||
groups: state.groups,
|
||||
ships: state.ships
|
||||
|
@ -102,37 +102,37 @@ export class InviteSearch extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
let shipMatches = this.state.peers.filter(e => {
|
||||
return e.includes(searchTerm) && !this.props.invites.ships.includes(e);
|
||||
});
|
||||
|
||||
for (let contact of this.state.contacts.keys()) {
|
||||
let thisContact = this.state.contacts.get(contact);
|
||||
let match = thisContact.filter(e => {
|
||||
return e.toLowerCase().includes(searchTerm);
|
||||
let shipMatches = [];
|
||||
if (this.props.shipResults) {
|
||||
shipMatches = this.state.peers.filter(e => {
|
||||
return e.includes(searchTerm) && !this.props.invites.ships.includes(e);
|
||||
});
|
||||
if (match.length > 0) {
|
||||
if (!(contact in shipMatches)) {
|
||||
shipMatches.push(contact);
|
||||
|
||||
for (let contact of this.state.contacts.keys()) {
|
||||
let thisContact = this.state.contacts.get(contact);
|
||||
let match = thisContact.filter(e => {
|
||||
return e.toLowerCase().includes(searchTerm);
|
||||
});
|
||||
if (match.length > 0) {
|
||||
if (!(contact in shipMatches)) {
|
||||
shipMatches.push(contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let isValid = true;
|
||||
if (!urbitOb.isValidPatp("~" + searchTerm)) {
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if (shipMatches.length === 0 && isValid) {
|
||||
shipMatches.push(searchTerm);
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({
|
||||
searchResults: { groups: groupMatches, ships: shipMatches }
|
||||
});
|
||||
|
||||
let isValid = true;
|
||||
if (!urbitOb.isValidPatp("~" + searchTerm)) {
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if (shipMatches.length === 0 && isValid) {
|
||||
shipMatches.push(searchTerm);
|
||||
this.setState({
|
||||
searchResults: { groups: groupMatches, ships: shipMatches }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,6 +209,18 @@ export class InviteSearch extends Component {
|
||||
let participants = <div />;
|
||||
let searchResults = <div />;
|
||||
|
||||
let placeholder = '';
|
||||
if (props.shipResults) {
|
||||
placeholder = 'ships';
|
||||
}
|
||||
if (props.groupResults) {
|
||||
if (placeholder.length > 0) {
|
||||
placeholder = placeholder + ' or ';
|
||||
}
|
||||
placeholder = placeholder + 'existing groups';
|
||||
}
|
||||
placeholder = 'Search for ' + placeholder;
|
||||
|
||||
let invErrElem = <span />;
|
||||
if (state.inviteError) {
|
||||
invErrElem = (
|
||||
@ -372,7 +384,7 @@ export class InviteSearch extends Component {
|
||||
"f7 ba b--gray3 b--gray2-d bg-gray0-d white-d pa3 w-100" +
|
||||
" db focus-b--black focus-b--white-d"
|
||||
}
|
||||
placeholder="Search for ships or existing groups"
|
||||
placeholder={placeholder}
|
||||
disabled={searchDisabled}
|
||||
rows={1}
|
||||
spellCheck={false}
|
||||
|
@ -189,6 +189,7 @@ export class NewScreen extends Component {
|
||||
<InviteSearch
|
||||
associations={this.props.associations}
|
||||
groupResults={true}
|
||||
shipResults={true}
|
||||
groups={this.props.groups}
|
||||
contacts={this.props.contacts}
|
||||
invites={this.state.invites}
|
||||
|
Loading…
Reference in New Issue
Block a user