Skip to content

Commit

Permalink
Revert "Dev"
Browse files Browse the repository at this point in the history
  • Loading branch information
deaafrizal authored Jul 28, 2022
1 parent fbeeae3 commit 3e7e1c6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 27 deletions.
4 changes: 2 additions & 2 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;

// class User extends Authenticatable
class User extends Authenticatable implements MustVerifyEmail
class User extends Authenticatable
// class User extends Authenticatable implements MustVerifyEmail
{
use HasApiTokens, HasFactory, Notifiable;

Expand Down
47 changes: 23 additions & 24 deletions resources/js/Components/Dashboard/CreatePost.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import React, {useEffect, useRef, useState} from "react";
import {Inertia} from "@inertiajs/inertia";
import {findTags} from "@/utils/jsHelper";
import "./CreatePost.css";
import React, { useEffect, useRef, useState } from "react";
import { Inertia } from "@inertiajs/inertia";
import { findTags } from "@/utils/jsHelper";
import './CreatePost.css'
import NotificationAlert from "../Default/NotificationAlert";

const CreatePost = ({props}) => {
const inputPost = useRef(null);
const CreatePost = ({ props }) => {
const inputPost = useRef(null)
const [description, setDescription] = useState("");
const [limiter, setLimiter] = useState(200);
const [isValid, setIsValid] = useState(true);
const [textTagged, setTextTagged] = useState("");
const [isLimit, setIsLimit] = useState(false);
const [isErrorNotif, setIsErrorNotif] = useState(false);

const regexHastag = new RegExp(/(^|\W)(#[a-z\d][\w-]*)/gi);
const regexHastag = new RegExp(/(^|\W)(#[a-z\d][\w-]*)/ig);

useEffect(() => {
let mount = true;
Expand All @@ -29,8 +29,8 @@ const CreatePost = ({props}) => {
}, [description.length]);

useEffect(() => {
props.errors ? setIsErrorNotif(true) : setIsErrorNotif(false);
}, [props.errors]);
props.errors ? setIsErrorNotif(true) : setIsErrorNotif(false)
}, [props.errors])

const submitPost = () => {
const data = {
Expand All @@ -39,26 +39,26 @@ const CreatePost = ({props}) => {
token: props.auth.user.token,
};
return isValid && Inertia.post("/dashboard/manage-posts/posts", data);
};
}

const handlePostSubmit = e => {
const handlePostSubmit = (e) => {
const newValue = e.target.innerHTML.replace(regexHastag, function (str) {
return '<span class="highlighted">' + str + "</span>";
});

inputPost.current.innerHTML = newValue;
const value = e.currentTarget.textContent;
const value = e.currentTarget.textContent
setDescription(value);

if (e.target.innerHTML.length > 200) {
setIsLimit(true);
return (e.target.innerHTML = "");
setIsLimit(true)
return e.target.innerHTML = '';
} else {
setIsLimit(false);
setIsLimit(false)
}

const inputHashtag = findTags(e.target.innerHTML);
setTextTagged(inputHashtag);
setTextTagged(inputHashtag)

const x = 200 - Number(e.target.innerHTML.length);
if (x >= 0) {
Expand Down Expand Up @@ -107,19 +107,18 @@ const CreatePost = ({props}) => {
/>
<div className={`textarea-span input`} ref={inputPost} />
</div>
{isLimit && (
<span className="lg:w-1/2 alert rounded:md alert-warning text-warning-content text-center">
Mencapai batas limit text akan di hapus
</span>
)}
{isLimit &&
<span className="lg:w-1/2 alert rounded:md alert-warning text-warning-content text-center">Mencapai batas limit text akan di hapus</span>
}
<button
disabled={!isValid}
className={
!isValid
? "absolute bottom-16 z-3 btn-lg lg:btn-md lg:rounded-md left-0 lg:relative lg:bottom-0 lg:left-0 text-xl bg-primary text-primary-content py-2 hover:bg-secondary hover:text-secondary-content lg:w-1/2 w-full dark:bg-slate-700 cursor-not-allowed transition duration-300 ease-in-out"
: "fixed bottom-16 z-3 btn-lg lg:btn-md lg:rounded-md left-0 text-xl lg:relative lg:bottom-0 lg:left-0 bg-secondary text-secondary-content py-2 lg:w-1/2 w-full dark:bg-slate-500 cursor-pointer transition duration-300 ease-in-out"
? "absolute bottom-16 z-3 btn-lg lg:btn-md lg:rounded-md left-0 lg:relative lg:bottom-0 lg:left-0 text-xl bg-secondary text-secondary-content py-2 lg:w-1/2 w-full dark:bg-slate-500 cursor-not-allowed"
: "fixed bottom-16 z-3 btn-lg lg:btn-md lg:rounded-md left-0 text-xl lg:relative lg:bottom-0 lg:left-0 bg-primary text-primary-content py-2 hover:bg-secondary hover:text-secondary-content lg:w-1/2 w-full dark:bg-slate-700 cursor-pointer"
}
onClick={() => submitPost()}>
onClick={() => submitPost()}
>
Posting Sekarang
</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/js/Pages/Teams.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function TeamsPage(props) {
.filter(item => item.id != 103190281)
.map((item, index) => {
return (
<a href={item.html_url} key={index} target="_blank" data-aos="fade-up" data-aos-duration="1500">
<a href={item.html_url} key={index} target="_blank" data-aos="flip-right" data-aos-duration="1500">
<div className="all-card lg:hover:-translate-y-1 lg:hover:scale-110 transition ease-in-out duration-200">
{item.contributions > 10 ? (
<div
Expand Down

0 comments on commit 3e7e1c6

Please sign in to comment.