Code Monkey home page Code Monkey logo

blog's Introduction

blog's People

Contributors

nabil-mansouri avatar dboissin avatar benjaminperez avatar romu-c avatar jcbe-ode avatar ccreusat avatar elbywan avatar juniorode avatar lauren-ceccotti avatar dbreyton avatar ode-vpeiro avatar justinemuller avatar mariusode avatar david-cc avatar vmourot avatar headan avatar rbunel35 avatar chokoneko avatar niphra avatar clementcreusat avatar sinthu-s avatar rdjedjig avatar sgrenet avatar simbas avatar tibo43 avatar invfo avatar wano-k avatar rgentet avatar jeducray avatar moustaphahennawi avatar

Watchers

Sofiane Tardami avatar  avatar  avatar James Cloos avatar Guillaume DROULEZ avatar  avatar  avatar  avatar Vincent Armentier avatar  avatar BKhoury avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blog's Issues

Clean `BlogPostCard` file

A nettoyer / Refacto :

https://github.com/edificeio/blog/blob/develop-b2school/frontend/src/components/BlogPostCard/BlogPostCard.tsx

Avatar

Le hook useUser permet déjà de récupérer l'image de l'utilisateur (voir explorer)

const getAvatarURL = (post: Post): string => {
    return directoryService.getAvatarUrl(post.author.userId, "user");
  };

Regroupement (clean code)

les useState ensemble, les useEffects ensemble, les objet destructurés ensemble, les variables ensemble, ...

// exemple
const { fromNow } = useDate();
const { t } = useTranslation();
const { contrib, manager, creator } = useActionDefinitions([]);

const directoryService = odeServices.directory();
const sidebarHighlightedPost = useSidebarHighlightedPost();
const editorRef = useRef<EditorRef>(null);
const navigate = useNavigate();

useEffect

Extraire ça dans un ou plusieurs custom hook si pas liés .

useState

Si des useState sont "communs", les fusionner ensemble via un objet ou alors passer par useReducer

const [summaryContent, setSummaryContent] = useState<string>("");
const [summaryContentPlain, setSummaryContentPlain] = useState<string>("");

Affichage de fragments

Voir niveau fonctionnel, si on a pas des empty screen à afficher ou affichage de toaster ou redirection dans le cas où un blog ou post ne sont pas dispos plutôt que

if (!blogId || !post) {
    return <></>;
  }

Clean `PostViewContent`

A nettoyer / refacto

https://github.com/edificeio/blog/blob/develop-b2school/frontend/src/features/Post/PostViewContent.tsx

C'est pas encore fini je pense ce composant :) mais quand ce sera le cas

  • Extraire la logique qui va ensemble dans un custom hook
  • Regrouper les states ensemble, les destructurations ensemble, ..
// Exemple
  const { t } = useTranslation();
  const { blogId, post, mustSubmit, readOnly, canPublish } = usePostContext();

  const editorRef = useRef<EditorRef>(null);
  const titleRef = useRef(null);

  const [title, setTitle] = useState(post?.title ?? "");
  const [content, setContent] = useState(post?.content ?? "");
  const [mode, setMode] = useState<"read" | "edit">("read");
  const [variant, setVariant] = useState<"ghost" | "outline">("ghost");

  • Si plusieurs useState "liés", les combinés dans un state d'objet ou passer par useReducer

i18n

Ajouter les clés, et ne pas oublier le namspace {ns: appCode}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.