...
 
Commits (2)
......@@ -8,10 +8,10 @@ import Media from "media/index";
import EmojiPicker from "create-status/emoji-picker";
const visibilities = [
"direct",
"private",
"unlisted",
"public"
{ text: "direct", icon: "envelope"},
{ text: "private", icon: "lock" },
{ text: "unlisted", icon: "unlock" },
{ text: "public", icon: "globe" },
];
class CreateStatus extends React.Component {
......@@ -38,7 +38,7 @@ class CreateStatus extends React.Component {
}
unique_usernames = unique_usernames.filter(x => x != this.props.account_name);
let initial_status = "";
unique_usernames.forEach(user => { initial_status += `@${user} `});
unique_usernames.forEach(user => { initial_status += `@${user} `;});
this.setState({status: initial_status});
}
......@@ -50,7 +50,7 @@ class CreateStatus extends React.Component {
this.props.in_reply_to,
this.state.visibility,
this.state.sensitive,
this.clearStatus)
this.clearStatus);
}
clearStatus = () => this.setState({status: "", media: []});
......@@ -96,14 +96,15 @@ class CreateStatus extends React.Component {
/>
<EmojiPicker
insert_callback={v => this.setState({
status: this.state.status + v
})}
status: this.state.status + v
})}
/>
<Form.Group>
<Icon name={visibilities.find(x => x.text === this.state.visibility).icon} />
<Form.Dropdown
value={this.state.visibility}
options={visibilities.map(x => ({
value: x, text: x
value: x.text, text: x.text, icon: x.icon
}))}
onChange={(e, {value}) => (
this.setState({visibility: value})
......@@ -123,7 +124,7 @@ class CreateStatus extends React.Component {
<input type="file" ref={c => (this.image_input = c)}
style={{display: "none"}}
onChange={e => this.props.upload_media(e.target.files[0])}
/>
/>
</Form.Field>
<Form.Button icon="upload" basic type="button" color="grey"
size="small" floated="left"
......
......@@ -14,6 +14,7 @@ import LikeButton from "status/like-button";
import RetweetButton from "status/retweet-button";
import UserReference from "status/user-reference";
import PinButton from "status/pin-button";
import VisibilityIcon from "status/visibility";
import DisplayName from "user/display-name";
import ProfilePicture from "user/profile-picture";
......@@ -107,9 +108,9 @@ class Status extends React.PureComponent {
{ get_yt_urls(original_status.content).map((item, key) => {
const id = youtube_parser(item);
if (id) return (
<Embed source="youtube" id={id} key={key} />);
<Embed source="youtube" id={id} key={key} />);
return null;
})}
})}
</Item.Content>
}
{ status.media_attachments.length != 0 &&
......@@ -118,7 +119,7 @@ class Status extends React.PureComponent {
{status.media_attachments.map((image, j) => (
<Media media={image} key={j} sensitive={original_status.sensitive} />
))}
))}
</Image.Group>
</Item.Meta>
}
......@@ -172,6 +173,9 @@ class Status extends React.PureComponent {
}}
name="delete" color="red" />
</Button>
<Button>
<VisibilityIcon visibility={status.visibility} />
</Button>
</Button.Group>
</Item.Extra>
</Item>
......
import React from "react";
import { Icon } from "semantic-ui-react";
const icons = {
direct:"envelope",
private: "lock",
unlisted: "unlock",
public: "globe",
};
const VisibilityIcon = ({ visibility }) => {
if (Object.keys(icons).includes(visibility)) {
return <Icon name={icons[visibility]} />;
}
return null;
};
export default VisibilityIcon;