diff --git a/src/@ycore/ycore_worker.js b/src/@ycore/ycore_worker.js index 98957cd1..1e7c5d4b 100755 --- a/src/@ycore/ycore_worker.js +++ b/src/@ycore/ycore_worker.js @@ -141,6 +141,24 @@ export const crouter = { router.push(e) } } + +export const notify = { + error: (...res) => { + antd.notification.error({ + message: 'Wopss', + description: (
An wild error appear! :

{res.toString()}
), + placement: 'bottomLeft' + }) + }, + proccess: (...res) => { + antd.notification.open({ + icon: , + message: 'Please wait', + description: (
{res}
), + placement: 'bottomLeft' + }) + } +} /** * Render User Notification about an Error * @@ -166,6 +184,14 @@ export function notifyProccess(cust){ placement: 'bottomLeft' }) } + + +export function arrayRemoveByID(arr, value) { + return arr.filter(function(ele){ + return ele.id != value; + }); +} + /** * Request FullScreen mode * diff --git a/src/components/MainFeed/index.js b/src/components/MainFeed/index.js index 439e55fa..992d5978 100755 --- a/src/components/MainFeed/index.js +++ b/src/components/MainFeed/index.js @@ -40,11 +40,15 @@ class MainFeed extends React.Component { } killByID(post_id){ - + const a = this.state.data + const b = ycore.arrayRemoveByID(a, post_id) + this.setState({data: b}) } addToRend(payload){ - console.log(payload) + let a = this.state.data + a.unshift(payload) + this.setState({ data: a }) } FirstGet() { diff --git a/src/components/PostCard/index.js b/src/components/PostCard/index.js index dd29362e..e3c0d4b1 100755 --- a/src/components/PostCard/index.js +++ b/src/components/PostCard/index.js @@ -70,7 +70,7 @@ class PostCard extends React.PureComponent{ render(){ const { payload, customActions } = this.props 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 = { delete: (post_id) => { ycore.ActionPost('delete', post_id, null, (err, res)=>{ @@ -91,8 +91,6 @@ class PostCard extends React.PureComponent{ ] const actions = customActions || defaultActions; - - const MoreMenu = ( {ycore.IsThisPost.owner(publisher.id)? @@ -101,12 +99,9 @@ class PostCard extends React.PureComponent{ : null } - + Save post - - Test CRAZY GAI - ); diff --git a/src/components/PostCreator/index.js b/src/components/PostCreator/index.js index b2b6e916..bd69629a 100755 --- a/src/components/PostCreator/index.js +++ b/src/components/PostCreator/index.js @@ -98,7 +98,7 @@ class PostCreator extends React.PureComponent{ }; 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) { antd.message.error(`${file.type} This file is not valid!`); } @@ -193,7 +193,7 @@ class PostCreator extends React.PureComponent{ render(){ 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 changeShare = ({ key }) => { this.setState({ shareWith: key }) diff --git a/src/components/UserProfile/index.js b/src/components/UserProfile/index.js index d15f2868..34cf401f 100755 --- a/src/components/UserProfile/index.js +++ b/src/components/UserProfile/index.js @@ -111,7 +111,7 @@ class UserProfile extends React.Component { {loading? : (
{invalid? null: this.UserHeader(this.state.RenderValue)} - + {ycore.IsThisUser.same(UUID)? : null}
) } diff --git a/src/pages/$page/index.js b/src/pages/$page/index.js index 0c375619..ebcfcc44 100755 --- a/src/pages/$page/index.js +++ b/src/pages/$page/index.js @@ -21,7 +21,7 @@ class PageIndexer extends PureComponent { ) } if (matchMaster){ - return ycore.IsThisUser.admin()? <__m /> : + return ycore.IsThisUser.dev() || ycore.IsThisUser.admin()? <__m /> : } // By default return Error 404 return(
) diff --git a/src/pages/__m/index.js b/src/pages/__m/index.js index bcd3679a..594ec8ce 100755 --- a/src/pages/__m/index.js +++ b/src/pages/__m/index.js @@ -23,7 +23,7 @@ export default class __m extends React.Component { } componentDidMount() { - if (ycore.IsThisUser.admin() == false) { + if (ycore.IsThisUser.dev() == false || ycore.IsThisUser.admin() == false) { return ycore.crouter.native('main') } this.handleSID() @@ -59,7 +59,7 @@ export default class __m extends React.Component { const { UserID, UserToken, expiresIn } = this.state.s_token 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 (
@@ -104,6 +104,9 @@ export default class __m extends React.Component { this.setState({ isEnd: isEnd, data: parsed, loading: false }) })` )} > Send mock notifyError() + + ycore.notify.error('Error Mock 1')} > notify.error + ycore.notify.proccess('Proccess Mock 1')} > notify.proccess
@@ -132,7 +135,7 @@ export default class __m extends React.Component {
ycore.FeedHandler.addToRend(AddDummy)}> ADD DUMMY - KillByID + ycore.FeedHandler.killByID(3)} > KillByID (3)