mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
FeedHandlers
This commit is contained in:
parent
e68b4cc0e8
commit
e686a979b8
@ -141,6 +141,24 @@ export const crouter = {
|
|||||||
router.push(e)
|
router.push(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const notify = {
|
||||||
|
error: (...res) => {
|
||||||
|
antd.notification.error({
|
||||||
|
message: 'Wopss',
|
||||||
|
description: (<div><span>An wild error appear! : </span><br/><br/><div style={{ position: 'relative', width: '100%',backgroundColor: 'rgba(243, 19, 19, 0.329)', bottom: '0', color: 'black', padding: '3px' }} >{res.toString()}</div></div>),
|
||||||
|
placement: 'bottomLeft'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
proccess: (...res) => {
|
||||||
|
antd.notification.open({
|
||||||
|
icon: <Icons.LoadingOutlined style={{ color: '#108ee9' }} />,
|
||||||
|
message: 'Please wait',
|
||||||
|
description: (<div>{res}</div>),
|
||||||
|
placement: 'bottomLeft'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Render User Notification about an Error
|
* Render User Notification about an Error
|
||||||
*
|
*
|
||||||
@ -166,6 +184,14 @@ export function notifyProccess(cust){
|
|||||||
placement: 'bottomLeft'
|
placement: 'bottomLeft'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function arrayRemoveByID(arr, value) {
|
||||||
|
return arr.filter(function(ele){
|
||||||
|
return ele.id != value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request FullScreen mode
|
* Request FullScreen mode
|
||||||
*
|
*
|
||||||
|
@ -40,11 +40,15 @@ class MainFeed extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
killByID(post_id){
|
killByID(post_id){
|
||||||
|
const a = this.state.data
|
||||||
|
const b = ycore.arrayRemoveByID(a, post_id)
|
||||||
|
this.setState({data: b})
|
||||||
}
|
}
|
||||||
|
|
||||||
addToRend(payload){
|
addToRend(payload){
|
||||||
console.log(payload)
|
let a = this.state.data
|
||||||
|
a.unshift(payload)
|
||||||
|
this.setState({ data: a })
|
||||||
}
|
}
|
||||||
|
|
||||||
FirstGet() {
|
FirstGet() {
|
||||||
|
@ -70,7 +70,7 @@ class PostCard extends React.PureComponent{
|
|||||||
render(){
|
render(){
|
||||||
const { payload, customActions } = this.props
|
const { payload, customActions } = this.props
|
||||||
const ActShowMode = ycore.AppSettings.force_show_postactions
|
const ActShowMode = ycore.AppSettings.force_show_postactions
|
||||||
const { id, post_time, postText, postFile, get_post_comments, postFileName, publisher, post_likes, is_post_pinned, is_liked } = payload || emptyPayload;
|
const { id, post_time, postText, postFile, publisher, post_likes, is_post_pinned, is_liked } = payload || emptyPayload;
|
||||||
const handlePostActions = {
|
const handlePostActions = {
|
||||||
delete: (post_id) => {
|
delete: (post_id) => {
|
||||||
ycore.ActionPost('delete', post_id, null, (err, res)=>{
|
ycore.ActionPost('delete', post_id, null, (err, res)=>{
|
||||||
@ -91,8 +91,6 @@ class PostCard extends React.PureComponent{
|
|||||||
]
|
]
|
||||||
const actions = customActions || defaultActions;
|
const actions = customActions || defaultActions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const MoreMenu = (
|
const MoreMenu = (
|
||||||
<antd.Menu>
|
<antd.Menu>
|
||||||
{ycore.IsThisPost.owner(publisher.id)?
|
{ycore.IsThisPost.owner(publisher.id)?
|
||||||
@ -101,12 +99,9 @@ class PostCard extends React.PureComponent{
|
|||||||
</antd.Menu.Item>
|
</antd.Menu.Item>
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
<antd.Menu.Item pid={id} key="save_post">
|
<antd.Menu.Item key="save_post">
|
||||||
<Icons.SaveOutlined /> Save post
|
<Icons.SaveOutlined /> Save post
|
||||||
</antd.Menu.Item>
|
</antd.Menu.Item>
|
||||||
<antd.Menu.Item pid={id} key="test">
|
|
||||||
<Icons.SaveOutlined /> Test CRAZY GAI
|
|
||||||
</antd.Menu.Item>
|
|
||||||
</antd.Menu>
|
</antd.Menu>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class PostCreator extends React.PureComponent{
|
|||||||
};
|
};
|
||||||
|
|
||||||
beforeUpload = (file) => {
|
beforeUpload = (file) => {
|
||||||
const filter = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'video/mp4';
|
const filter = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg' || file.type === 'image/gif' || file.type === 'video/mp4';
|
||||||
if (!filter) {
|
if (!filter) {
|
||||||
antd.message.error(`${file.type} This file is not valid!`);
|
antd.message.error(`${file.type} This file is not valid!`);
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ class PostCreator extends React.PureComponent{
|
|||||||
|
|
||||||
render(){
|
render(){
|
||||||
const {userData} = this.props
|
const {userData} = this.props
|
||||||
const { keys_remaining, visible, fileURL, file } = this.state;
|
const { keys_remaining, visible, fileURL } = this.state;
|
||||||
const percent = (((keys_remaining/ycore.AppSettings.MaxLengthPosts) * 100).toFixed(2) )
|
const percent = (((keys_remaining/ycore.AppSettings.MaxLengthPosts) * 100).toFixed(2) )
|
||||||
const changeShare = ({ key }) => {
|
const changeShare = ({ key }) => {
|
||||||
this.setState({ shareWith: key })
|
this.setState({ shareWith: key })
|
||||||
|
@ -111,7 +111,7 @@ class UserProfile extends React.Component {
|
|||||||
{loading? <antd.Skeleton active /> :
|
{loading? <antd.Skeleton active /> :
|
||||||
(<div>
|
(<div>
|
||||||
{invalid? null: this.UserHeader(this.state.RenderValue)}
|
{invalid? null: this.UserHeader(this.state.RenderValue)}
|
||||||
<PostCreator userData={ycore.userData()} />
|
{ycore.IsThisUser.same(UUID)? <PostCreator userData={ycore.userData()} /> : null}
|
||||||
<MainFeed get='user' uid={UUID} />
|
<MainFeed get='user' uid={UUID} />
|
||||||
</div>)
|
</div>)
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ class PageIndexer extends PureComponent {
|
|||||||
</div>)
|
</div>)
|
||||||
}
|
}
|
||||||
if (matchMaster){
|
if (matchMaster){
|
||||||
return ycore.IsThisUser.admin()? <__m /> : <Error404 />
|
return ycore.IsThisUser.dev() || ycore.IsThisUser.admin()? <__m /> : <Error404 />
|
||||||
}
|
}
|
||||||
// By default return Error 404
|
// By default return Error 404
|
||||||
return(<div><Error404 /></div>)
|
return(<div><Error404 /></div>)
|
||||||
|
@ -23,7 +23,7 @@ export default class __m extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (ycore.IsThisUser.admin() == false) {
|
if (ycore.IsThisUser.dev() == false || ycore.IsThisUser.admin() == false) {
|
||||||
return ycore.crouter.native('main')
|
return ycore.crouter.native('main')
|
||||||
}
|
}
|
||||||
this.handleSID()
|
this.handleSID()
|
||||||
@ -59,7 +59,7 @@ export default class __m extends React.Component {
|
|||||||
const { UserID, UserToken, expiresIn } = this.state.s_token
|
const { UserID, UserToken, expiresIn } = this.state.s_token
|
||||||
const { ValidSDCP, ValidCookiesToken, final } = this.state.s_ses
|
const { ValidSDCP, ValidCookiesToken, final } = this.state.s_ses
|
||||||
|
|
||||||
const AddDummy = {id: `${Math.random()}`, publisher: {id: "1"},post_id: "1", user_id: "48", recipient_id: "0", postText: "Dummy Payload"}
|
const AddDummy = {id: "3", publisher: {id: "1"},post_id: "1", user_id: "48", recipient_id: "0", postText: "New by ID Dummy Payload"}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.Wrapper}>
|
<div className={styles.Wrapper}>
|
||||||
@ -104,6 +104,9 @@ export default class __m extends React.Component {
|
|||||||
this.setState({ isEnd: isEnd, data: parsed, loading: false })
|
this.setState({ isEnd: isEnd, data: parsed, loading: false })
|
||||||
})`
|
})`
|
||||||
)} > Send mock notifyError() </antd.Button>
|
)} > Send mock notifyError() </antd.Button>
|
||||||
|
|
||||||
|
<antd.Button onClick={() => ycore.notify.error('Error Mock 1')} > notify.error </antd.Button>
|
||||||
|
<antd.Button onClick={() => ycore.notify.proccess('Proccess Mock 1')} > notify.proccess </antd.Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={styles.titleHeader}>
|
<div className={styles.titleHeader}>
|
||||||
@ -132,7 +135,7 @@ export default class __m extends React.Component {
|
|||||||
<div className={styles.sectionWrapper}>
|
<div className={styles.sectionWrapper}>
|
||||||
<antd.Card>
|
<antd.Card>
|
||||||
<antd.Button onClick={() => ycore.FeedHandler.addToRend(AddDummy)}> ADD DUMMY </antd.Button>
|
<antd.Button onClick={() => ycore.FeedHandler.addToRend(AddDummy)}> ADD DUMMY </antd.Button>
|
||||||
<antd.Button> KillByID </antd.Button>
|
<antd.Button onClick={()=> ycore.FeedHandler.killByID(3)} > KillByID (3) </antd.Button>
|
||||||
<hr />
|
<hr />
|
||||||
<MainFeed custompayload={[{id: "1", publisher: {id: "1"},post_id: "1", user_id: "48", recipient_id: "0", postText: "Dummy Payload"}, {id: "2", post_id: "2", publisher: {id: "1"}, user_id: "48", recipient_id: "0", postText: "Dummy Payload"}]} />
|
<MainFeed custompayload={[{id: "1", publisher: {id: "1"},post_id: "1", user_id: "48", recipient_id: "0", postText: "Dummy Payload"}, {id: "2", post_id: "2", publisher: {id: "1"}, user_id: "48", recipient_id: "0", postText: "Dummy Payload"}]} />
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user