Changeset 5347491 for reactapp


Ignore:
Timestamp:
07/30/22 21:53:22 (2 years ago)
Author:
unknown <mlviktor23@…>
Branches:
main
Children:
f5d4792
Parents:
e958037
Message:

styled professor page, added date translation to datePosted, added indentation for replies

Location:
reactapp
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • reactapp/package-lock.json

    re958037 r5347491  
    1616        "@testing-library/react": "^13.3.0",
    1717        "@testing-library/user-event": "^13.5.0",
     18        "babel": "^6.23.0",
    1819        "babel-plugin-macros": "^3.1.0",
    1920        "jsog": "^1.0.7",
     
    48754876      "integrity": "sha512-Td525n+iPOOyUQIeBfcASuG6uJsDOITl7Mds5gFyerkWiX7qhUTdYUBlSgNMyVqtSJqwpt1kXGLdUt6SykLMRA=="
    48764877    },
     4878    "node_modules/babel": {
     4879      "version": "6.23.0",
     4880      "resolved": "https://registry.npmjs.org/babel/-/babel-6.23.0.tgz",
     4881      "integrity": "sha512-ZDcCaI8Vlct8PJ3DvmyqUz+5X2Ylz3ZuuItBe/74yXosk2dwyVo/aN7MCJ8HJzhnnJ+6yP4o+lDgG9MBe91DLA==",
     4882      "deprecated": "In 6.x, the babel package has been deprecated in favor of babel-cli. Check https://opencollective.com/babel to support the Babel maintainers",
     4883      "bin": {
     4884        "babel": "lib/cli.js",
     4885        "babel-external-helpers": "lib/cli.js",
     4886        "babel-node": "lib/cli.js"
     4887      }
     4888    },
    48774889    "node_modules/babel-jest": {
    48784890      "version": "27.5.1",
     
    2031220324      "integrity": "sha512-Td525n+iPOOyUQIeBfcASuG6uJsDOITl7Mds5gFyerkWiX7qhUTdYUBlSgNMyVqtSJqwpt1kXGLdUt6SykLMRA=="
    2031320325    },
     20326    "babel": {
     20327      "version": "6.23.0",
     20328      "resolved": "https://registry.npmjs.org/babel/-/babel-6.23.0.tgz",
     20329      "integrity": "sha512-ZDcCaI8Vlct8PJ3DvmyqUz+5X2Ylz3ZuuItBe/74yXosk2dwyVo/aN7MCJ8HJzhnnJ+6yP4o+lDgG9MBe91DLA=="
     20330    },
    2031420331    "babel-jest": {
    2031520332      "version": "27.5.1",
  • reactapp/package.json

    re958037 r5347491  
    1111    "@testing-library/react": "^13.3.0",
    1212    "@testing-library/user-event": "^13.5.0",
     13    "babel": "^6.23.0",
    1314    "babel-plugin-macros": "^3.1.0",
    1415    "jsog": "^1.0.7",
  • reactapp/src/Components/OpinionCard.style.js

    re958037 r5347491  
    55  width: fit-content;
    66`;
     7
     8export const OpinionReplyCard = styled.div`
     9  background-color: lavender;
     10  width: fit-content;
     11  margin-top: 7px;
     12  margin-bottom: 7px;
     13  margin-left: ${(props) => props.indent};
     14`;
  • reactapp/src/Components/OpinionTree.js

    re958037 r5347491  
    1 import { OpinionCard } from "./OpinionCard.style";
     1import { OpinionCard, OpinionReplyCard } from "./OpinionCard.style";
     2import { dateConverter } from "../Util/dateConverter";
    23
    34function OpinionTree({ professor }) {
     
    56  var postCount; // za da ne go pokazuva ispod postot
    67
    7   function displayChildPosts(child) {
     8  function displayChildPosts(child, parentPostAuthorUsername, replyIndent) {
    89    if (child == null) return;
    910    postCount = renderedOpinionIds.push(child.postId);
    1011    return (
    1112      <div key={child.postId}>
    12         <p>
    13           <a href="#">{child.author.username}</a> реплицирал
    14         </p>
    15         <p>Содржина: {child.content}</p>
    16         {child.children.map((childOfChild) => displayChildPosts(childOfChild))}
     13        <OpinionReplyCard indent={replyIndent + "px"}>
     14          <p>
     15            <a href="#">{child.author.username}</a> му реплицирал на{" "}
     16            {parentPostAuthorUsername}
     17          </p>
     18          <p>{child.content}</p>
     19          <p>
     20            {dateConverter(new Date(child.timePosted).toString().slice(4, -43))}
     21          </p>
     22        </OpinionReplyCard>
     23        {child.children.map((childOfChild) =>
     24          displayChildPosts(
     25            childOfChild,
     26            child.author.username,
     27            replyIndent + 30
     28          )
     29        )}
    1730      </div>
    1831    );
     
    2437        if (!renderedOpinionIds.includes(opinion.postId)) {
    2538          postCount = renderedOpinionIds.push(opinion.postId);
     39          var replyIndent = 30;
    2640          return (
    2741            <div key={opinion.postId}>
     
    3347                <p>{opinion.title}</p>
    3448                <p>{opinion.content}</p>
    35                 <p>{Date(opinion.timePosted)}</p>
     49                <p>
     50                  {dateConverter(
     51                    new Date(opinion.timePosted).toString().slice(4, -43)
     52                  )}
     53                </p>
    3654              </OpinionCard>
    37               {opinion.children.map((child) => displayChildPosts(child))}
     55              {opinion.children.map((child) =>
     56                displayChildPosts(child, opinion.author.username, replyIndent)
     57              )}
    3858            </div>
    3959          );
  • reactapp/src/Pages/Professor.js

    re958037 r5347491  
    4848          <ProfessorCardName>{professor.professorName}</ProfessorCardName>
    4949          <ProfessorCardSeparator />
    50           <div style={{ marginTop: "20px" }}>
     50          <div style={{ marginTop: "10px" }}>
    5151            <ProfessorCardDetails fontSize="20px">
    5252              {professor.faculty.facultyName}
Note: See TracChangeset for help on using the changeset viewer.