Changeset d654c74 for reactapp


Ignore:
Timestamp:
08/06/22 14:09:43 (2 years ago)
Author:
unknown <mlviktor23@…>
Branches:
main
Children:
3e98cea
Parents:
74b8c52 (diff), 0df6b9e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'main' of https://github.com/neeznamm/profesori.mk

Location:
reactapp
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • reactapp/package-lock.json

    r74b8c52 rd654c74  
    2424        "react-scripts": "5.0.1",
    2525        "styled-components": "^5.3.5",
     26        "transliteration": "^2.3.5",
    2627        "web-vitals": "^2.1.4"
    2728      }
     
    1570515706      }
    1570615707    },
     15708    "node_modules/transliteration": {
     15709      "version": "2.3.5",
     15710      "resolved": "https://registry.npmjs.org/transliteration/-/transliteration-2.3.5.tgz",
     15711      "integrity": "sha512-HAGI4Lq4Q9dZ3Utu2phaWgtm3vB6PkLUFqWAScg/UW+1eZ/Tg6Exo4oC0/3VUol/w4BlefLhUUSVBr/9/ZGQOw==",
     15712      "dependencies": {
     15713        "yargs": "^17.5.1"
     15714      },
     15715      "bin": {
     15716        "slugify": "dist/bin/slugify",
     15717        "transliterate": "dist/bin/transliterate"
     15718      },
     15719      "engines": {
     15720        "node": ">=6.0.0"
     15721      }
     15722    },
     15723    "node_modules/transliteration/node_modules/yargs": {
     15724      "version": "17.5.1",
     15725      "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz",
     15726      "integrity": "sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==",
     15727      "dependencies": {
     15728        "cliui": "^7.0.2",
     15729        "escalade": "^3.1.1",
     15730        "get-caller-file": "^2.0.5",
     15731        "require-directory": "^2.1.1",
     15732        "string-width": "^4.2.3",
     15733        "y18n": "^5.0.5",
     15734        "yargs-parser": "^21.0.0"
     15735      },
     15736      "engines": {
     15737        "node": ">=12"
     15738      }
     15739    },
     15740    "node_modules/transliteration/node_modules/yargs-parser": {
     15741      "version": "21.0.1",
     15742      "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.1.tgz",
     15743      "integrity": "sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==",
     15744      "engines": {
     15745        "node": ">=12"
     15746      }
     15747    },
    1570715748    "node_modules/tryer": {
    1570815749      "version": "1.0.1",
     
    2802128062      }
    2802228063    },
     28064    "transliteration": {
     28065      "version": "2.3.5",
     28066      "resolved": "https://registry.npmjs.org/transliteration/-/transliteration-2.3.5.tgz",
     28067      "integrity": "sha512-HAGI4Lq4Q9dZ3Utu2phaWgtm3vB6PkLUFqWAScg/UW+1eZ/Tg6Exo4oC0/3VUol/w4BlefLhUUSVBr/9/ZGQOw==",
     28068      "requires": {
     28069        "yargs": "^17.5.1"
     28070      },
     28071      "dependencies": {
     28072        "yargs": {
     28073          "version": "17.5.1",
     28074          "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz",
     28075          "integrity": "sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==",
     28076          "requires": {
     28077            "cliui": "^7.0.2",
     28078            "escalade": "^3.1.1",
     28079            "get-caller-file": "^2.0.5",
     28080            "require-directory": "^2.1.1",
     28081            "string-width": "^4.2.3",
     28082            "y18n": "^5.0.5",
     28083            "yargs-parser": "^21.0.0"
     28084          }
     28085        },
     28086        "yargs-parser": {
     28087          "version": "21.0.1",
     28088          "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.1.tgz",
     28089          "integrity": "sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg=="
     28090        }
     28091      }
     28092    },
    2802328093    "tryer": {
    2802428094      "version": "1.0.1",
  • reactapp/package.json

    r74b8c52 rd654c74  
    1919    "react-scripts": "5.0.1",
    2020    "styled-components": "^5.3.5",
     21    "transliteration": "^2.3.5",
    2122    "web-vitals": "^2.1.4"
    2223  },
  • reactapp/src/App.js

    r74b8c52 rd654c74  
    11import { Outlet } from "react-router-dom";
    22import { MainWrapper, MainTitle } from "./Components/Main.style";
     3import Search from "./Components/Search.js";
    34
    45export default function App() {
     
    1516        }
    1617      </style>
    17       <MainTitle>profesori.mk</MainTitle>
     18      <MainTitle>profesori.mk</MainTitle> <Search />
    1819      <Outlet />
    1920    </MainWrapper>
  • reactapp/src/Components/Main.style.js

    r74b8c52 rd654c74  
    1717  text-decoration: underline 3px;
    1818  margin-bottom: 30px;
     19  width: fit-content;
     20  float: left;
    1921`;
  • reactapp/src/Components/ProfessorCard.style.js

    r74b8c52 rd654c74  
    66  padding: 10px;
    77  margin-bottom: 30px;
     8  margin-top: 140px;
    89`;
    910
  • reactapp/src/Components/Search.js

    r74b8c52 rd654c74  
     1import React, { useEffect, useState } from "react";
     2import JSOG from "jsog";
     3import { transliterate } from "../Util/transliterate";
     4import {
     5  SearchDropdownResultSmall,
     6  SearchDropdownTextSmall,
     7  SearchDropdownSmall,
     8  SearchDropdownResultLinkSmall,
     9  SearchSmall,
     10} from "./Search.style";
     11function Search() {
     12  const [query, setQuery] = useState("");
     13  const [professors, setProfessors] = useState([]);
     14
     15  useEffect(() => {
     16    const url = `http://192.168.0.17:8080/public/professors/nameContains/${transliterate(
     17      query
     18    )}`;
     19
     20    const fetchData = async () => {
     21      try {
     22        const response = await fetch(url);
     23        var cyclicGraph = await response.json();
     24        var jsogStructure = JSOG.encode(cyclicGraph); // has { '@ref': 'ID' } links instead of cycles
     25        cyclicGraph = JSOG.decode(jsogStructure);
     26        setProfessors(cyclicGraph);
     27        //setLoaded(true);
     28      } catch (error) {
     29        console.log("Error", error);
     30      }
     31    };
     32
     33    if (query.length > 2) fetchData();
     34  }, [query]);
     35
     36  return (
     37    <div
     38      style={{
     39        position: "relative",
     40        width: "fit-content",
     41        float: "right",
     42      }}
     43    >
     44      <SearchSmall
     45        placeholder="Пребарувај..."
     46        onChange={(e) => setQuery(e.target.value)}
     47      />
     48      <SearchDropdownSmall
     49        display={query.length > 2 && professors.length > 0 ? "block" : "none"}
     50      >
     51        {query.length > 2 &&
     52          professors.slice(0, 7).map((professor) => (
     53            <SearchDropdownResultSmall key={professor.professorId}>
     54              <SearchDropdownResultLinkSmall
     55                href={"/professor/" + professor.professorId}
     56              >
     57                <SearchDropdownTextSmall weight="bold" size="medium">
     58                  {professor.professorName}
     59                </SearchDropdownTextSmall>
     60                <SearchDropdownTextSmall weight="normal" size="smaller">
     61                  {professor.faculty.facultyName}
     62                </SearchDropdownTextSmall>
     63              </SearchDropdownResultLinkSmall>
     64            </SearchDropdownResultSmall>
     65          ))}
     66      </SearchDropdownSmall>
     67    </div>
     68  );
     69}
     70
     71export default Search;
  • reactapp/src/Pages/Professor.js

    r74b8c52 rd654c74  
    33import JSOG from "jsog";
    44import OpinionTree from "../Components/OpinionTree";
    5 import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
    6 import {
    7   solid,
    8   regular,
    9   brands,
    10 } from "@fortawesome/fontawesome-svg-core/import.macro";
    115
    126import {
     
    7064    return (
    7165      <div>
    72         <p>loading</p>
     66        <p style={{ marginTop: "140px" }}>се вчитува...</p>
    7367        <Outlet />
    7468      </div>
Note: See TracChangeset for help on using the changeset viewer.