2 Commits

Author SHA1 Message Date
72e464268b Исправил отчет 2025-05-28 10:40:42 +04:00
3084820703 Lab_2 2025-05-24 12:16:40 +04:00
99 changed files with 1679 additions and 21170 deletions

View File

@@ -1,3 +0,0 @@
/gradlew text eol=lf
*.bat text eol=crlf
*.jar binary

View File

@@ -1,37 +0,0 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/

View File

@@ -1,37 +0,0 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.5.5'
id 'io.spring.dependency-management' version '1.1.7'
}
group = 'io.github.f1rstteam'
version = '0.0.1-SNAPSHOT'
description = 'Demo project for Spring Boot'
defaultTasks "bootRun"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.5'
implementation("com.fasterxml.jackson.core:jackson-databind")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'com.h2database:h2'
}
tasks.named('test') {
useJUnitPlatform()
}

Binary file not shown.

View File

@@ -1,7 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -1,251 +0,0 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

View File

@@ -1,94 +0,0 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -1 +0,0 @@
[{"id":10,"text":"324234","image":"","group":"Моя группа","likes":3,"comments":2,"shares":2,"createdAt":[2025,9,7,14,57,10,10870800]},{"id":11,"text":"53456453","image":"","group":"Моя группа","likes":0,"comments":0,"shares":0,"createdAt":[2025,9,7,14,57,11,853363900]},{"id":16,"text":"11111111111","image":"","group":"Моя группа","likes":0,"comments":0,"shares":0,"createdAt":[2025,9,11,12,32,41,210363800]},{"id":17,"text":"673453","image":"","group":"Моя группа","likes":0,"comments":0,"shares":0,"createdAt":[2025,9,11,12,36,36,393719200]}]

View File

@@ -1 +0,0 @@
rootProject.name = 'ip-backend-labs'

View File

@@ -1,37 +0,0 @@
package io.github.f1rstteam.ip_backend_labs.DTO.Mapping;
import java.time.LocalDateTime;
import org.springframework.stereotype.Component;
import io.github.f1rstteam.ip_backend_labs.DTO.PostRqDto;
import io.github.f1rstteam.ip_backend_labs.DTO.PostRsDto;
import io.github.f1rstteam.ip_backend_labs.model.Post;
@Component
public class PostMapper {
public static PostRsDto toDto(Post post) {
PostRsDto dto = new PostRsDto();
dto.setId(post.getId());
dto.setText(post.getText());
dto.setImage(post.getImage());
dto.setGroup(post.getGroup());
dto.setLikes(post.getLikes());
dto.setComments(post.getComments());
dto.setShares(post.getShares());
dto.setCreatedAt(post.getCreatedAt());
return dto;
}
public static Post toEntity(PostRqDto dto) {
Post post = new Post();
post.setText(dto.getText() != null ? dto.getText() : "");
post.setImage(dto.getImage() != null ? dto.getImage() : "");
post.setGroup(dto.getGroup() != null ? dto.getGroup() : "Моя группа");
post.setLikes(0);
post.setComments(0);
post.setShares(0);
post.setCreatedAt(LocalDateTime.now());
return post;
}
}

View File

@@ -1,24 +0,0 @@
package io.github.f1rstteam.ip_backend_labs.DTO;
public class PostRqDto {
private String text;
private String image;
private String group;
public PostRqDto() {}
public PostRqDto(String text, String image, String group) {
this.text = text;
this.image = image;
this.group = group;
}
public String getText() { return text; }
public void setText(String text) { this.text = text; }
public String getImage() { return image; }
public void setImage(String image) { this.image = image; }
public String getGroup() { return group; }
public void setGroup(String group) { this.group = group; }
}

View File

@@ -1,51 +0,0 @@
package io.github.f1rstteam.ip_backend_labs.DTO;
import java.time.LocalDateTime;
public class PostRsDto {
private Long id;
private String text;
private String image;
private String group;
private int likes;
private int comments;
private int shares;
private LocalDateTime createdAt;
public PostRsDto() {}
public PostRsDto(Long id, String text, String image, String group, int likes, int comments, int shares, LocalDateTime createdAt) {
this.id = id;
this.text = text;
this.image = image;
this.group = group;
this.likes = likes;
this.comments = comments;
this.shares = shares;
this.createdAt = createdAt;
}
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public String getText() { return text; }
public void setText(String text) { this.text = text; }
public String getImage() { return image; }
public void setImage(String image) { this.image = image; }
public String getGroup() { return group; }
public void setGroup(String group) { this.group = group; }
public int getLikes() { return likes; }
public void setLikes(int likes) { this.likes = likes; }
public int getComments() { return comments; }
public void setComments(int comments) { this.comments = comments; }
public int getShares() { return shares; }
public void setShares(int shares) { this.shares = shares; }
public LocalDateTime getCreatedAt() { return createdAt; }
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
}

View File

@@ -1,13 +0,0 @@
package io.github.f1rstteam.ip_backend_labs;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class InternetProgrammingBackendLabsApplication {
public static void main(String[] args) {
SpringApplication.run(InternetProgrammingBackendLabsApplication.class, args);
}
}

View File

@@ -1,11 +0,0 @@
package io.github.f1rstteam.ip_backend_labs.Repositories;
import java.util.List;
import java.util.Optional;
public interface CommonRepository<T, ID> {
T save(ID id, T entity);
Optional<T> findById(ID id);
List<T> findAll();
void deleteById(ID id);
}

View File

@@ -1,28 +0,0 @@
package io.github.f1rstteam.ip_backend_labs.Repositories;
import java.util.*;
public abstract class MapRepository<T, ID> implements CommonRepository<T, ID> {
protected final Map<ID, T> storage = new HashMap<>();
@Override
public T save(ID id, T entity) {
storage.put(id, entity);
return entity;
}
@Override
public Optional<T> findById(ID id) {
return Optional.ofNullable(storage.get(id));
}
@Override
public List<T> findAll() {
return new ArrayList<>(storage.values());
}
@Override
public void deleteById(ID id) {
storage.remove(id);
}
}

View File

@@ -1,9 +0,0 @@
package io.github.f1rstteam.ip_backend_labs.Repositories;
import org.springframework.stereotype.Repository;
import io.github.f1rstteam.ip_backend_labs.model.Post;
@Repository
public class PostRepository extends MapRepository<Post, Long> implements CommonRepository<Post, Long> {
}

View File

@@ -1,68 +0,0 @@
package io.github.f1rstteam.ip_backend_labs.Service;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;
import org.springframework.stereotype.Service;
import io.github.f1rstteam.ip_backend_labs.DTO.PostRqDto;
import io.github.f1rstteam.ip_backend_labs.DTO.PostRsDto;
import io.github.f1rstteam.ip_backend_labs.DTO.Mapping.PostMapper;
import io.github.f1rstteam.ip_backend_labs.Repositories.PostRepository;
import io.github.f1rstteam.ip_backend_labs.model.Post;
@Service
public class PostService {
private final PostRepository repository;
private final AtomicLong idGenerator = new AtomicLong(1);
public PostService(PostRepository repository) {
this.repository = repository;
}
// CREATE
public PostRsDto create(PostRqDto rqDto) {
Post post = PostMapper.toEntity(rqDto);
Long id = idGenerator.getAndIncrement();
post.setId(id);
repository.save(id, post);
return PostMapper.toDto(post);
}
// READ by ID
public PostRsDto getById(Long id) {
return repository.findById(id)
.map(PostMapper::toDto)
.orElseThrow(() -> new RuntimeException("Post not found with id " + id));
}
// READ all
public List<PostRsDto> getAll() {
return repository.findAll()
.stream()
.map(PostMapper::toDto)
.collect(Collectors.toList());
}
// UPDATE
public PostRsDto update(Long id, PostRqDto rqDto) {
Post existing = repository.findById(id)
.orElseThrow(() -> new RuntimeException("Post not found with id " + id));
existing.setText(rqDto.getText());
existing.setImage(rqDto.getImage());
existing.setGroup(rqDto.getGroup());
repository.save(id, existing);
return PostMapper.toDto(existing);
}
// DELETE
public void delete(Long id) {
if (repository.findById(id).isEmpty()) {
throw new RuntimeException("Post not found with id " + id);
}
repository.deleteById(id);
}
}

View File

@@ -1,23 +0,0 @@
package io.github.f1rstteam.ip_backend_labs.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig {
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/api/**") //запросы ко всем API endpoints
.allowedOrigins("http://localhost:3000") //React фронт
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.allowedHeaders("*")
.allowCredentials(true);
}
};
}
}

View File

@@ -1,66 +0,0 @@
package io.github.f1rstteam.ip_backend_labs.controllers;
import java.util.List;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.github.f1rstteam.ip_backend_labs.DTO.PostRqDto;
import io.github.f1rstteam.ip_backend_labs.DTO.PostRsDto;
import io.github.f1rstteam.ip_backend_labs.Service.PostService;
@RestController
@RequestMapping("/api/posts")
public class PostController {
private final PostService service;
public PostController(PostService service) {
this.service = service;
}
// CREATE
@PostMapping
public PostRsDto create(@RequestBody PostRqDto rqDto) {
validate(rqDto);
return service.create(rqDto);
}
// READ by ID
@GetMapping("/{id}")
public PostRsDto getById(@PathVariable Long id) {
return service.getById(id);
}
// READ all
@GetMapping
public List<PostRsDto> getAll() {
return service.getAll();
}
// UPDATE
@PutMapping("/{id}")
public PostRsDto update(@PathVariable Long id, @RequestBody PostRqDto rqDto) {
validate(rqDto);
return service.update(id, rqDto);
}
// DELETE
@DeleteMapping("/{id}")
public void delete(@PathVariable Long id) {
service.delete(id);
}
// Валидация
private void validate(PostRqDto dto) {
if (dto.getText() == null || dto.getText().isBlank()) {
throw new IllegalArgumentException("Post text cannot be empty");
}
}
}

View File

@@ -1,30 +0,0 @@
package io.github.f1rstteam.ip_backend_labs.model;
import java.time.LocalDateTime;
public abstract class BaseEntity {
protected Long id;
protected LocalDateTime createdAt;
public BaseEntity() {
}
public BaseEntity(Long id, LocalDateTime createdAt) {
this.id = id;
this.createdAt = createdAt;
}
public Long getId() {
return id;
}
public LocalDateTime getCreatedAt() {
return createdAt;
}
public void setId(Long id) {
this.id = id;
}
public void setCreatedAt(LocalDateTime createdAt){
this.createdAt = createdAt;
}
}

View File

@@ -1,44 +0,0 @@
package io.github.f1rstteam.ip_backend_labs.model;
import java.time.LocalDateTime;
public class Post extends BaseEntity {
private String text;
private String image;
private String group;
private int likes;
private int comments;
private int shares;
public Post() {}
public Post(Long id, String text, String image, String group, int likes, int comments, int shares, LocalDateTime createdAt) {
super(id, createdAt);
this.text = text;
this.image = image;
this.group = group;
this.likes = likes;
this.comments = comments;
this.shares = shares;
}
public String getText() { return text; }
public void setText(String text) { this.text = text; }
public String getImage() { return image; }
public void setImage(String image) { this.image = image; }
public String getGroup() { return group; }
public void setGroup(String group) { this.group = group; }
public int getLikes() { return likes; }
public void setLikes(int likes) { this.likes = likes; }
public int getComments() { return comments; }
public void setComments(int comments) { this.comments = comments; }
public int getShares() { return shares; }
public void setShares(int shares) { this.shares = shares; }
}

View File

@@ -1,15 +0,0 @@
spring.main.banner-mode=off
spring.application.name=Internet Programming Backend Labs
# Available levels: TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF
logging.level.ru.ulstu.is.server=DEBUG
spring.datasource.url=jdbc:h2:file:./data
spring.datasource.username=sa
spring.datasource.password=sa
spring.datasource.driver-class-name=org.h2.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=create
# spring.jpa.show-sql=true
# spring.jpa.properties.hibernate.format_sql=true
spring.h2.console.enabled=true

View File

@@ -1,13 +0,0 @@
package io.github.f1rstteam.ip_backend_labs;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class InternetProgrammingBackendLabsApplicationTests {
@Test
void contextLoads() {
}
}

View File

@@ -1,84 +0,0 @@
package io.github.f1rstteam.ip_backend_labs;
import org.junit.jupiter.api.BeforeEach;
import io.github.f1rstteam.ip_backend_labs.DTO.PostRqDto;
import io.github.f1rstteam.ip_backend_labs.DTO.PostRsDto;
import io.github.f1rstteam.ip_backend_labs.Repositories.PostRepository;
import io.github.f1rstteam.ip_backend_labs.Service.PostService;
import io.github.f1rstteam.ip_backend_labs.model.Post;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import java.time.LocalDateTime;
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.*;
class PostServiceTest {
private PostRepository postRepository;
private PostService postService;
@BeforeEach
void setUp() {
postRepository = mock(PostRepository.class);
postService = new PostService(postRepository);
}
@Test
void testCreate() {
PostRqDto rq = new PostRqDto("Hello", "image.png", "group1");
PostRsDto result = postService.create(rq);
assertNotNull(result);
assertEquals("Hello", result.getText());
ArgumentCaptor<Post> postCaptor = ArgumentCaptor.forClass(Post.class);
verify(postRepository).save(anyLong(), postCaptor.capture());
assertEquals("Hello", postCaptor.getValue().getText());
}
@Test
void testGetById_found() {
Post post = new Post(1L, "Test", "img.png", "group", 0, 0, 0, LocalDateTime.now());
when(postRepository.findById(1L)).thenReturn(Optional.of(post));
PostRsDto result = postService.getById(1L);
assertNotNull(result);
assertEquals("Test", result.getText());
}
@Test
void testGetById_notFound() {
when(postRepository.findById(99L)).thenReturn(Optional.empty());
assertThrows(RuntimeException.class, () -> postService.getById(99L));
}
@Test
void testUpdate() {
Post existing = new Post(1L, "Old", "old.png", "group", 0, 0, 0, LocalDateTime.now());
when(postRepository.findById(1L)).thenReturn(Optional.of(existing));
PostRqDto rq = new PostRqDto("New text", "new.png", "group");
PostRsDto result = postService.update(1L, rq);
assertEquals("New text", result.getText());
assertEquals("new.png", result.getImage());
}
@Test
void testDelete() {
Post post = new Post(1L, "Test", "img.png", "group", 0, 0, 0, LocalDateTime.now());
when(postRepository.findById(1L)).thenReturn(Optional.of(post));
postService.delete(1L);
verify(postRepository).deleteById(1L);
}
}

View File

@@ -1 +0,0 @@
[{"id":1,"title":"4534","description":"45","completed":false}]

188
ИП2/css/index-style.css Normal file
View File

@@ -0,0 +1,188 @@
body {
color: #c5c6c7;
background-color: #0b0c10;
margin: 0px;
}
/* Шапка */
.header {
display: flex;
justify-content: space-between;
border-bottom: 3px solid #BF1723;
border-bottom-right-radius: 25px;
border-bottom-left-radius: 25px;
}
.left-part{
display: flex;
margin-left: 30px;
}
.header > .left-part > img {
width: 50px;
}
.header > .left-part > div {
display: flex;
align-items: center;
}
.first-part {
color:#FCD116;
font-size: 1.4em;
margin-left: 20px;
}
.last-part {
color: #BF1723;
font-size: 1.5em;
}
.right-part{
margin-right: 30px;
}
.header > .right-part > nav > ul {
display: flex;
list-style: none;
}
.header > .right-part > nav > ul > li > a {
display: block;
margin-right: 10px;
padding: 10px;
border: 0.5px solid #FFF;
border-radius: 10px;
}
/* Блок регистрации */
.login-div {
display: flex;
justify-content: center;
align-items: center;
min-height: 75vh;
}
.login-page {
width: 19%;
background-color: #222222;
padding: 1%;
border-radius: 15%;
border: 0.5px solid #BF1723;
color: #FFF;
}
h1{
text-align: center;
}
.input-box {
margin: 10px 0;
}
.input-div {
display: flex;
flex-direction: column;
align-items: center;
}
.remember-forgot {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
padding: 0 10px;
}
.remember-forgot label input {
accent-color: #BF1723;
}
.login-page .btn {
width: 100%;
background-color: #BF1723;
border-radius: 10px;
color: #fff;
}
.register-link{
display: flex;
justify-content: space-between;
align-items: center;
}
/* Ссылки */
a {
outline: none;
text-decoration: none;
}
a:link{
color: #FCD116;
}
a:visited{
color: #FCD116;
}
a:hover{
color: #c5c6c7;
}
@media (max-width: 600px){
.header {
justify-content: center;
}
.header > .right-part {
display: none;
}
.header > .left-part {
margin: 0;
}
.login-page {
width: 77%;
}
.register-link {
justify-content: space-evenly;
}
}
@media (min-width: 601px) and (max-width: 800px){
.login-page {
width: 37%;
}
.register-link {
justify-content: space-evenly;
}
}
@media (min-width: 801px) and (max-width: 1024px){
.login-page {
width: 30%;
}
.register-link {
justify-content: space-evenly;
}
}
@media (min-width: 1025px) and (max-width: 1920px){
.login-page {
width: 22%;
}
.register-link {
justify-content: space-evenly;
}
}

280
ИП2/css/lenta-style.css Normal file
View File

@@ -0,0 +1,280 @@
body {
color: #c5c6c7;
background-color: #141414;
margin: 0px;
}
a:link {
color: white;
text-decoration: none;
}
a:visited {
color: white;
}
a:hover {
color: #BF1723;
background-color: #2a2a2a;
}
a:active {
color: #FCD116;
}
img {
width: 50px;
}
li {
list-style: none;
}
/* Шапка */
.header {
display: flex;
justify-content: space-between;
border-bottom: 3px solid #BF1723;
border-bottom-right-radius: 25px;
border-bottom-left-radius: 25px;
padding: 0.25% 33% 0% 33%;
}
.rightpart > img {
border-radius: 25px;
}
/* Основная страница */
.page {
display: flex;
justify-content: center;
margin-top: 15px;
}
.leftbar {
height: 100%;
width: 10%;
background-color: #222222;
border-radius: 15px;
margin: 5px;
display: flex;
flex-direction: column;
min-width: 120px;
}
.leftbar-content {
display: flex;
flex-direction: column;
margin: 10px 10px 5px 10px;
}
.leftbar-content > a {
margin-bottom: 5px;
padding: 3px;
border-radius: 5px;
}
.leftbar-settings {
display: flex;
flex-direction: column;
border-top: 1px solid rgba(128, 128, 128, 0.479);
margin: 10px 10px 0px 10px;
padding-top: 5px;
}
.leftbar-settings > a{
padding: 3px;
border-radius: 5px;
}
.footer {
position: relative;
border-top: 1px solid rgba(128, 128, 128, 0.479);
margin: 10px;
padding-top: 5px;
}
.footer > span {
z-index: 1;
position: relative;
cursor: pointer;
color: white;
}
span:hover {
color: #BF1723;
}
.footer:hover .footer-menu {
display: flex;
flex-direction: column;
top: 150%;
left: -8%;
width: 100%;
position: absolute;
background-color: #222222;
border-radius: 10px;
padding: 10px;
}
.footer-menu {
display: none;
}
.footer-menu > a {
margin-bottom: 5px;
padding: 3px;
border-radius: 5px;
}
.content {
height: 100%;
width: 25%;
background-color: #222222;
border-radius: 15px;
border: 0.1px solid #BF1723;
margin: 5px;
padding: 10px;
min-width: 250px;
}
.post {
margin-bottom: 15px;
}
.post-header {
margin-bottom: 10px;
color: #fff;
}
.image {
position: relative;
width: 98%;
padding: 3px;
margin-bottom: 10px;
}
.image .post-img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 2%;
}
.post-footer {
color: #fff;
border-bottom: 0.5px solid #BF1723;
padding: 5px;
}
.post-footer > i {
margin-right: 10px;
}
.rightbar {
height: 100%;
width: 10%;
background-color: #222222;
border-radius: 15px;
margin: 5px;
min-width: 150px;
}
.rightbar-content {
display: flex;
flex-direction: column;
margin: 10px;
}
.rightbar-content > a {
margin-bottom: 5px;
padding: 3px;
border-radius: 5px;
}
.bottombar{
display: flex;
position: fixed;
bottom: 0;
width: 100%;
justify-content: space-between;
border-top: 3px solid #BF1723;
border-top-right-radius: 25px;
border-top-left-radius: 25px;
padding: 5px 0px;
justify-content: space-evenly;
}
.bottombar {
display: none;
}
.bottombar > a > img {
width: 25px;
}
@media (max-width: 600px){
.header {
justify-content: center;
}
.header > .rightpart {
display: none;
}
.header > .leftpart {
margin: 0;
}
.leftbar {
display: none;
}
.rightbar{
display: none;
}
.bottombar {
display: flex;
background-color: #222222;
}
.content {
height: 100%;
}
.page {
margin-bottom: 45px;
}
}
/*Tablets*/
@media (min-width: 601px) and (max-width: 800px){
.header {
padding: 0.25% 25% 0% 20%;
}
}
@media (min-width: 801px) and (max-width: 1024px){
.header {
padding: 0.25% 31% 0% 28%;
}
}

267
ИП2/css/message-style.css Normal file
View File

@@ -0,0 +1,267 @@
body {
color: #c5c6c7;
background-color: #141414;
margin: 0px;
}
a:link {
color: white;
text-decoration: none;
}
a:visited {
color: white;
}
a:hover {
color: #BF1723;
background-color: #2a2a2a;
}
a:active {
color: #FCD116;
}
img {
width: 50px;
}
li {
list-style: none;
}
/* Шапка */
.header {
display: flex;
justify-content: space-between;
border-bottom: 3px solid #BF1723;
border-bottom-right-radius: 25px;
border-bottom-left-radius: 25px;
padding: 0.25% 33% 0% 33%;
}
.rightpart > img {
border-radius: 25px;
}
/* Основная страница */
.page {
display: flex;
justify-content: center;
margin-top: 15px;
}
.leftbar {
height: 100%;
width: 10%;
background-color: #222222;
border-radius: 15px;
margin: 5px;
display: flex;
flex-direction: column;
min-width: 120px;
}
.leftbar-content {
display: flex;
flex-direction: column;
margin: 10px 10px 5px 10px;
}
.leftbar-content > a {
margin-bottom: 5px;
padding: 3px;
border-radius: 5px;
}
.leftbar-settings {
display: flex;
flex-direction: column;
border-top: 1px solid rgba(128, 128, 128, 0.479);
margin: 10px 10px 0px 10px;
padding-top: 5px;
}
.leftbar-settings > a{
padding: 3px;
border-radius: 5px;
}
.footer {
position: relative;
border-top: 1px solid rgba(128, 128, 128, 0.479);
margin: 10px;
padding-top: 5px;
}
.footer > span {
z-index: 1;
position: relative;
cursor: pointer;
color: white;
}
span:hover {
color: #BF1723;
}
.footer:hover .footer-menu {
display: flex;
flex-direction: column;
top: 150%;
left: -8%;
width: 100%;
position: absolute;
background-color: #222222;
border-radius: 10px;
padding: 10px;
}
.footer-menu {
display: none;
}
.footer-menu > a {
margin-bottom: 5px;
padding: 3px;
border-radius: 5px;
}
.content {
height: 100%;
width: 25%;
background-color: #222222;
border-radius: 15px;
border: 0.1px solid #BF1723;
margin: 5px;
padding: 10px;
min-width: 250px;
}
.chat {
display: flex;
align-items: center;
margin-bottom: 10px;
padding-bottom: 10px;
border-bottom: 0.5px solid rgba(128, 128, 128, 0.479);
}
.chat > .avatar > img {
border-radius: 25px;
}
.chat-content {
margin-left: 10px;
}
.username {
margin: 0;
color: white;
}
.message {
margin: 0;
color: rgb(158, 158, 158);
}
.rightbar {
height: 100%;
width: 10%;
background-color: #222222;
border-radius: 15px;
margin: 5px;
min-width: 150px;
}
.rightbar-content {
display: flex;
flex-direction: column;
margin: 10px;
}
.rightbar-content > a {
margin-bottom: 5px;
padding: 3px;
border-radius: 5px;
}
.bottombar{
display: flex;
position: fixed;
bottom: 0;
width: 100%;
justify-content: space-between;
border-top: 3px solid #BF1723;
border-top-right-radius: 25px;
border-top-left-radius: 25px;
padding: 5px 0px;
justify-content: space-evenly;
}
.bottombar {
display: none;
}
.bottombar > a > img {
width: 25px;
}
@media (max-width: 600px){
.header {
justify-content: center;
}
.header > .rightpart {
display: none;
}
.header > .leftpart {
margin: 0;
}
.leftbar {
display: none;
}
.rightbar{
display: none;
}
.bottombar {
display: flex;
background-color: #222222;
}
.content {
height: 100%;
}
}
@media (min-width: 601px) and (max-width: 800px){
.header {
padding: 0.25% 25% 0% 20%;
}
}
@media (min-width: 801px) and (max-width: 1024px){
.header {
padding: 0.25% 31% 0% 28%;
}
}

285
ИП2/css/profile-style.css Normal file
View File

@@ -0,0 +1,285 @@
* {
box-sizing: border-box;
}
body {
color: #c5c6c7;
background-color: #141414;
margin: 0px;
}
a:link {
color: white;
text-decoration: none;
}
a:visited {
color: white;
}
a:hover {
color: #BF1723;
background-color: #2a2a2a;
}
a:active {
color: #FCD116;
}
img {
width: 50px;
}
li {
list-style: none;
}
/* Шапка */
.header {
display: flex;
justify-content: space-between;
border-bottom: 3px solid #BF1723;
border-bottom-right-radius: 25px;
border-bottom-left-radius: 25px;
padding: 0.25% 33% 0% 33%;
}
.rightpart > img {
border-radius: 25px;
}
/* Основная страница */
.page {
display: flex;
justify-content: center;
margin-top: 15px;
}
.leftbar {
height: 100%;
width: 10%;
background-color: #222222;
border-radius: 15px;
margin: 5px;
display: flex;
flex-direction: column;
min-width: 120px;
}
.leftbar-content {
display: flex;
flex-direction: column;
margin: 10px 10px 5px 10px;
}
.leftbar-content > a {
margin-bottom: 5px;
padding: 3px;
border-radius: 5px;
}
.leftbar-settings {
display: flex;
flex-direction: column;
border-top: 1px solid rgba(128, 128, 128, 0.479);
margin: 10px 10px 0px 10px;
padding-top: 5px;
}
.leftbar-settings > a{
padding: 3px;
border-radius: 5px;
}
.footer {
position: relative;
border-top: 1px solid rgba(128, 128, 128, 0.479);
margin: 10px;
padding-top: 5px;
}
.footer > span {
z-index: 1;
position: relative;
cursor: pointer;
color: white;
}
span:hover {
color: #BF1723;
}
.footer:hover .footer-menu {
display: flex;
flex-direction: column;
top: 150%;
left: -8%;
width: 115%;
position: absolute;
background-color: #222222;
border-radius: 10px;
padding: 10px;
}
.footer-menu {
display: none;
}
.footer-menu > a {
margin-bottom: 5px;
padding: 3px;
border-radius: 5px;
}
.profile-card {
display: flex;
flex-direction: column;
align-items: center;
max-width: 250px;
width: 100%;
background-color: #222222;
border-radius: 25px;
padding: 25px;
}
.image {
position: relative;
width: 150px;
height: 150px;
border-radius: 50%;
background-color: #FCD116;
padding: 3px;
margin-bottom: 10px;
}
.image .profile-img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 50%;
border: 3px solid #FFF;
}
.profile-card .text-data {
display: flex;
flex-direction: column;
align-items: center;
}
.text-data .name {
font-size: 22px;
font-weight: 500;
color: #fff;
}
.text-data .about {
font-size: 15px;
font-weight: 400;
color: #fff;
margin-bottom: 10px;
}
.profile-card .more-info {
width: 90%;
display: flex;
justify-content: space-between;
}
.rightbar {
height: 100%;
width: 10%;
background-color: #222222;
border-radius: 15px;
margin: 5px;
min-width: 150px;
}
.rightbar-content {
display: flex;
flex-direction: column;
margin: 10px;
}
.rightbar-content > a {
margin-bottom: 5px;
padding: 3px;
border-radius: 5px;
}
.bottombar{
display: flex;
position: fixed;
bottom: 0;
width: 100%;
justify-content: space-between;
border-top: 3px solid #BF1723;
border-top-right-radius: 25px;
border-top-left-radius: 25px;
padding: 5px 0px;
justify-content: space-evenly;
}
.bottombar {
display: none;
}
.bottombar > a > img {
width: 25px;
}
@media (max-width: 600px){
.header {
justify-content: center;
}
.header > .rightpart {
display: none;
}
.header > .leftpart {
margin: 0;
}
.leftbar {
display: none;
}
.rightbar{
display: none;
}
.bottombar {
display: flex;
}
.content {
height: 500px;
}
}
@media (min-width: 601px) and (max-width: 800px){
.header {
padding: 0.25% 25% 0% 20%;
}
}
@media (min-width: 801px) and (max-width: 1024px){
.header {
padding: 0.25% 31% 0% 28%;
}
}

181
ИП2/css/signup-style.css Normal file
View File

@@ -0,0 +1,181 @@
body {
color: #c5c6c7;
background-color: #0b0c10;
margin: 0px;
}
/* Шапка */
.header {
display: flex;
justify-content: space-between;
border-bottom: 3px solid #BF1723;
border-bottom-right-radius: 25px;
border-bottom-left-radius: 25px;
}
.left-part{
display: flex;
margin-left: 30px;
}
.header > .left-part > img {
width: 50px;
}
.header > .left-part > div {
display: flex;
align-items: center;
}
.first-part {
color:#FCD116;
font-size: 1.4em;
margin-left: 20px;
}
.last-part {
color: #BF1723;
font-size: 1.5em;
}
.right-part{
margin-right: 30px;
}
.header > .right-part > nav > ul {
display: flex;
list-style: none;
}
.header > .right-part > nav > ul > li > a {
display: block;
margin-right: 10px;
padding: 10px;
border: 0.5px solid #FFF;
border-radius: 10px;
}
/* Блок регистрации */
.login-div {
display: flex;
justify-content: center;
align-items: center;
min-height: 75vh;
}
.login-page {
width: 19%;
background-color: #222222;
padding: 1%;
border-radius: 15%;
border: 0.5px solid #BF1723;
color: #FFF;
}
h1{
text-align: center;
}
.input-box {
margin: 10px 0;
}
.input-div {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 5px;
}
.remember-forgot {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
padding: 0 10px;
}
.remember-forgot label input {
accent-color: #BF1723;
}
.login-page .btn {
width: 100%;
background-color: #BF1723;
border-radius: 10px;
color: #fff;
}
.register-link{
display: flex;
justify-content: space-between;
align-items: center;
}
.register-link > a {
margin-right: 50px;
}
/* Ссылки */
a {
outline: none;
text-decoration: none;
}
a:link{
color: #FCD116;
}
a:visited{
color: #FCD116;
}
a:hover{
color: #c5c6c7;
}
@media (max-width: 600px){
.header {
justify-content: center;
}
.header > .right-part {
display: none;
}
.header > .left-part {
margin: 0;
}
.login-page {
width: 77%;
}
.register-link {
justify-content: space-evenly;
}
}
@media (min-width: 601px) and (max-width: 800px){
.login-page {
width: 37%;
}
.register-link {
justify-content: space-evenly;
}
}
@media (min-width: 801px) and (max-width: 1024px){
.login-page {
width: 30%;
}
.register-link {
justify-content: space-evenly;
}
}

62
ИП2/index.html Normal file
View File

@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>СОЦИАЛьная сеть</title>
<link rel="stylesheet" href="css/index-style.css" />
<link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>
</head>
<body>
<div class="header">
<div class="left-part">
<img src="source/logo.svg" alt="">
<div>
<p class="first-part">СОЦИАЛ</p>
<p class="last-part">ьная сеть</p>
</div>
</div>
<div class="right-part">
<nav>
<ul>
<li><a href="messages.html">Войти</a></li>
<li><a href="signup.html">Зарегистрироваться</a></li>
</ul>
</nav>
</div>
</div>
<div class="login-div">
<div class="login-page">
<form action="">
<h1>Авторизация</h1>
<div class="input-div">
<div class="input-box">
<input type="text" placeholder="Логин">
<i class='bx bxs-user'></i>
</div>
<div class="input-box">
<input type="password" placeholder="Пароль">
<i class='bx bxs-lock-alt' ></i>
</div>
</div>
<div class="remember-forgot">
<label><input type="checkbox">Запомнить меня</label>
<a href="#">Забыли пароль?</a>
</div>
<button type="submit" class="btn">Войти</button>
<div class="register-link">
<p>У меня нет аккаунта</p>
<a href="signup.html">Зарегистрироваться</a>
</div>
</form>
</div>
</div>
</body>
</html>

136
ИП2/lenta.html Normal file
View File

@@ -0,0 +1,136 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Лента новостей</title>
<link rel="stylesheet" href="css/lenta-style.css" />
<link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>
</head>
<body>
<header class="header">
<span class="leftpart">
<img src="source/logo.svg" alt="" class="logo">
</span>
<span class="rightpart">
<img src="source/photo.jpg" alt="" class="account-image">
</span>
</header>
<div class="page">
<div class="leftbar">
<div class="leftbar-content">
<a href="profile.html">Профиль</a>
<a href="lenta.html">Лента</a>
<a href="messages.html">Сообщения</a>
</div>
<div class="leftbar-settings">
<a href="index.html">Настройки</a>
</div>
<div class="footer">
<span>Ещё &#9660;</span>
<div class="footer-menu">
<a href="#">Разработчикам</a>
<a href="#">О нас</a>
<a href="#">Правовая информация</a>
<a href="#">Помощь</a>
</div>
</div>
</div>
<div class="content">
<div class="post">
<div class="post-header">
<i class='bx bxs-group'></i>
<label>Какая-то группа 1</label>
</div>
<div class="image">
<img src="source/meme1.jpg" class="post-img"/>
</div>
<div class="post-footer">
<i class='bx bx-like' >8</i>
<i class='bx bx-message-square-dots' >2</i>
<i class='bx bx-reply' >1</i>
</div>
</div>
<div class="post">
<div class="post-header">
<i class='bx bxs-group'></i>
<label>Какая-то группа 2</label>
</div>
<div class="image">
<img src="source/meme2.jpg" class="post-img"/>
</div>
<div class="post-footer">
<i class='bx bx-like' >785</i>
<i class='bx bx-message-square-dots' >102</i>
<i class='bx bx-reply' >14</i>
</div>
</div>
<div class="post">
<div class="post-header">
<i class='bx bxs-group'></i>
<label>Какая-то группа 3</label>
</div>
<div class="image">
<img src="source/meme3.jpg" class="post-img"/>
</div>
<div class="post-footer">
<i class='bx bx-like' >156</i>
<i class='bx bx-message-square-dots' >10</i>
<i class='bx bx-reply' >0</i>
</div>
</div>
<div class="post">
<div class="post-header">
<i class='bx bxs-group'></i>
<label>Какая-то группа 4</label>
</div>
<div class="image">
<img src="source/meme4.jpg" class="post-img"/>
<label>Горшок для ФИСТа, в котором хранится прах студентов, которые не сдали сессию</label>
</div>
<div class="post-footer">
<i class='bx bx-like' >456</i>
<i class='bx bx-message-square-dots' >32</i>
<i class='bx bx-reply' >4</i>
</div>
</div>
<div class="post">
<div class="post-header">
<i class='bx bxs-group'></i>
<label>Какая-то группа 5</label>
</div>
<div class="image">
<img src="source/meme5.jpg" class="post-img"/>
</div>
<div class="post-footer">
<i class='bx bx-like' >1067</i>
<i class='bx bx-message-square-dots' >467</i>
<i class='bx bx-reply' >56</i>
</div>
</div>
</div>
<div class="rightbar">
<div class="rightbar-content">
<a href="#">Все</a>
<a href="#">Непрочитанные</a>
<a href="#">Архив</a>
</div>
</div>
</div>
<div class="bottombar">
<a href="lenta.html"><img src="source/home-icon.svg" alt=""></a>
<a href="messages.html"><img src="source/message-icon.svg" alt=""></a>
<a href="profile.html"><img src="source/profile-icon.svg" alt=""></a>
<a href="index.html"><img src="source/exit-icon.svg" alt=""></a>
</div>
</body>
</html>

132
ИП2/messages.html Normal file
View File

@@ -0,0 +1,132 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Сообщения</title>
<link rel="stylesheet" href="css/message-style.css">
</head>
<body>
<header class="header">
<span class="leftpart">
<img src="source/logo.svg" alt="" class="logo">
</span>
<span class="rightpart">
<img src="source/photo.jpg" alt="" class="account-image">
</span>
</header>
<div class="page">
<div class="leftbar">
<div class="leftbar-content">
<a href="profile.html">Профиль</a>
<a href="lenta.html">Лента</a>
<a href="messages.html">Сообщения</a>
</div>
<div class="leftbar-settings">
<a href="index.html">Настройки</a>
</div>
<div class="footer">
<span>Ещё &#9660;</span>
<div class="footer-menu">
<a href="#">Разработчикам</a>
<a href="#">О нас</a>
<a href="#">Правовая информация</a>
<a href="#">Помощь</a>
</div>
</div>
</div>
<div class="content">
<div class="chat">
<div class="avatar">
<img src="source/photo.jpg" alt="" class="avatar">
</div>
<div class="chat-content">
<h3 class="username">username</h3>
<p class="message">Сделал вторую лабу</p>
</div>
</div>
<div class="chat">
<div class="avatar">
<img src="source/photo.jpg" alt="" class="avatar">
</div>
<div class="chat-content">
<h3 class="username">username</h3>
<p class="message">Сделал вторую лабу</p>
</div>
</div>
<div class="chat">
<div class="avatar">
<img src="source/photo.jpg" alt="" class="avatar">
</div>
<div class="chat-content">
<h3 class="username">username</h3>
<p class="message">Сделал вторую лабу</p>
</div>
</div>
<div class="chat">
<div class="avatar">
<img src="source/photo.jpg" alt="" class="avatar">
</div>
<div class="chat-content">
<h3 class="username">username</h3>
<p class="message">Сделал вторую лабу</p>
</div>
</div>
<div class="chat">
<div class="avatar">
<img src="source/photo.jpg" alt="" class="avatar">
</div>
<div class="chat-content">
<h3 class="username">username</h3>
<p class="message">Сделал вторую лабу</p>
</div>
</div>
<div class="chat">
<div class="avatar">
<img src="source/photo.jpg" alt="" class="avatar">
</div>
<div class="chat-content">
<h3 class="username">username</h3>
<p class="message">Сделал вторую лабу</p>
</div>
</div>
</div>
<div class="rightbar">
<div class="rightbar-content">
<a href="#">Все</a>
<a href="#">Непрочитанные</a>
<a href="#">Архив</a>
</div>
</div>
</div>
<div class="bottombar">
<a href="lenta.html"><img src="source/home-icon.svg" alt=""></a>
<a href="messages.html"><img src="source/message-icon.svg" alt=""></a>
<a href="profile.html"><img src="source/profile-icon.svg" alt=""></a>
<a href="index.html"><img src="source/exit-icon.svg" alt=""></a>
</div>
</body>
</html>

84
ИП2/profile.html Normal file
View File

@@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ваш профиль</title>
<link rel="stylesheet" href="css/profile-style.css" />
<link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>
</head>
<body>
<header class="header">
<span class="leftpart">
<img src="source/logo.svg" alt="" class="logo">
</span>
<span class="rightpart">
<img src="source/photo.jpg" alt="" class="account-image">
</span>
</header>
<div class="page">
<div class="leftbar">
<div class="leftbar-content">
<a href="profile.html">Профиль</a>
<a href="lenta.html">Лента</a>
<a href="messages.html">Сообщения</a>
</div>
<div class="leftbar-settings">
<a href="index.html">Настройки</a>
</div>
<div class="footer">
<span>Ещё &#9660;</span>
<div class="footer-menu">
<a href="#">Разработчикам</a>
<a href="#">О нас</a>
<a href="#">Правовая информация</a>
<a href="#">Помощь</a>
</div>
</div>
</div>
<div class="profile-card">
<div class="image">
<img src="source/photo.jpg" alt="" class="profile-img">
</div>
<div class="text-data">
<span class="name">Павел Ладягин</span>
<span class="about">Краткая информация о себе</span>
</div>
<div class="more-info">
<div class="location">
<i class='bx bx-current-location'></i>
<label>Ульяновск</label>
</div>
<div class="education">
<i class='bx bxs-school'></i>
<label>УлГТУ</label>
</div>
</div>
</div>
<div class="rightbar">
<div class="rightbar-content">
<a href="#">Все</a>
<a href="#">Непрочитанные</a>
<a href="#">Архив</a>
</div>
</div>
</div>
<div class="bottombar">
<a href="lenta.html"><img src="source/home-icon.svg" alt=""></a>
<a href="messages.html"><img src="source/message-icon.svg" alt=""></a>
<a href="profile.html"><img src="source/profile-icon.svg" alt=""></a>
<a href="index.html"><img src="source/exit-icon.svg" alt=""></a>
</div>
</body>
</html>

64
ИП2/signup.html Normal file
View File

@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>СОЦИАЛьная сеть</title>
<link rel="stylesheet" href="css/signup-style.css" />
<link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>
</head>
<body>
<div class="header">
<div class="left-part">
<img src="source/logo.svg" alt="">
<div>
<p class="first-part">СОЦИАЛ</p>
<p class="last-part">ьная сеть</p>
</div>
</div>
<div class="right-part">
<nav>
<ul>
<li><a href="messages.html">Войти</a></li>
<li><a href="#">Зарегистрироваться</a></li>
</ul>
</nav>
</div>
</div>
<div class="login-div">
<div class="login-page">
<form action="">
<h1>Регистрация</h1>
<div class="input-div">
<div class="input-box">
<input type="text" placeholder="Логин">
<i class='bx bxs-user'></i>
</div>
<div class="input-box">
<input type="password" placeholder="Пароль">
<i class='bx bxs-lock-alt' ></i>
</div>
<div class="input-box">
<input type="password" placeholder="Подтвердите пароль">
<i class='bx bxs-lock-alt' ></i>
</div>
<div class="input-box">
<input type="text" placeholder="Почта">
<i class='bx bx-envelope'></i>
</div>
</div>
<button type="submit" class="btn">Зарегистрироваться</button>
<div class="register-link">
<p>У меня есть аккаунта</p>
<a href="index.html">Войти</a>
</div>
</form>
</div>
</div>
</body>
</html>

View File

Before

Width:  |  Height:  |  Size: 403 B

After

Width:  |  Height:  |  Size: 403 B

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

Before

Width:  |  Height:  |  Size: 158 KiB

After

Width:  |  Height:  |  Size: 158 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 356 KiB

After

Width:  |  Height:  |  Size: 356 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

BIN
ИП2/Отчет_2.docx Normal file

Binary file not shown.

23
ИП6/111/.gitignore vendored
View File

@@ -1,23 +0,0 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View File

@@ -1,70 +0,0 @@
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
The page will reload when you make changes.\
You may also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### Analyzing the Bundle Size
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
### Making a Progressive Web App
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
### Advanced Configuration
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
### Deployment
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
### `npm run build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

18203
ИП6/111/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,44 +0,0 @@
{
"name": "111",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.5.2",
"axios": "^1.6.0",
"bootstrap": "^5.3.6",
"bootstrap-icons": "^1.13.1",
"json-server": "^1.0.0-beta.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.8.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"server": "json-server --watch public/db.json --port 3001"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

View File

@@ -1,3 +0,0 @@
{
"posts": []
}

View File

@@ -1,43 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -1,25 +0,0 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View File

@@ -1,3 +0,0 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

View File

@@ -1,38 +0,0 @@
.App {
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

View File

@@ -1,27 +0,0 @@
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import FeedPage from './pages/FeedPage';
import MessagesPage from './pages/MessagesPage';
import ProfilePage from './pages/ProfilePage';
import LoginPage from './pages/LoginPage';
import SignupPage from './pages/SignupPage';
import NotFoundPage from './pages/NotFoundPage';
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap-icons/font/bootstrap-icons.css';
function App() {
return (
<Router>
<Routes>
<Route path="/" element={<LoginPage />} />
<Route path="/signup" element={<SignupPage />} />
<Route path="/feed" element={<FeedPage />} />
<Route path="/messages" element={<MessagesPage />} />
<Route path="/profile" element={<ProfilePage />} />
<Route path="*" element={<NotFoundPage />} />
</Routes>
</Router>
);
}
export default App;

View File

@@ -1,8 +0,0 @@
import { render, screen } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

View File

@@ -1,11 +0,0 @@
.bottombar{
bottom: 0;
border-top: 3px solid #BF1723;
border-top-right-radius: 25px;
border-top-left-radius: 25px;
background-color: #222222;
}
.bottombar > a > img {
width: 25px;
}

View File

@@ -1,13 +0,0 @@
import './Bottombar.css'
import { Link } from 'react-router-dom';
export default function Bottombar() {
return(
<div class="bottombar d-flex d-sm-none position-fixed w-100 justify-content-evenly py-2 px-0">
<Link to="/feed"><img src="../images/home-icon.svg" alt="" /></Link>
<Link to="/messages"><img src="../images/message-icon.svg" alt="" /></Link>
<Link to="/profile"><img src="../images/profile-icon.svg" alt="" /></Link>
<Link to="/"><img src="../images/exit-icon.svg" alt="" /></Link>
</div>
)
}

View File

@@ -1,15 +0,0 @@
.chat {
border-bottom: 0.5px solid rgba(128, 128, 128, 0.479);
}
.chat > .avatar > img {
border-radius: 25px;
}
.username {
color: white;
}
.message {
color: rgb(158, 158, 158);
}

View File

@@ -1,16 +0,0 @@
import './Chat.css'
export default function Chat({ username, message, avatarUrl }) {
return(
<div class="chat d-flex align-items-center mb-2 pb-2">
<div class="avatar">
<img src={avatarUrl} alt="" class="avatar" />
</div>
<div class="chat-content ms-2">
<h3 class="username m-0">{username}</h3>
<p class="message m-0">{message}</p>
</div>
</div>
)
}

View File

@@ -1,16 +0,0 @@
/* Шапка */
header .container-fluid {
display: flex;
justify-content: space-evenly;
border-bottom: 3px solid #BF1723;
border-bottom-right-radius: 25px;
border-bottom-left-radius: 25px;
}
.left-part{
display: flex;
}
.right-part > img {
border-radius: 25px;
}

View File

@@ -1,17 +0,0 @@
import './Header.css'
export default function Header() {
return(
<header>
<div class="container-fluid">
<div class="left-part">
<img src="../images/logo.svg" alt="Logo" width="50" />
</div>
<div class="right-part d-none d-sm-flex me-4 my-1">
<img src="../images/photo.jpg" alt="" class="account-image" />
</div>
</div>
</header>
)
}

View File

@@ -1,16 +0,0 @@
/* Шапка */
header .container-fluid {
border-bottom: 3px solid #BF1723;
border-bottom-right-radius: 25px;
border-bottom-left-radius: 25px;
}
.first-part {
color:#FCD116;
font-size: 1.4em;
}
.last-part {
color: #BF1723;
font-size: 1.5em;
}

View File

@@ -1,27 +0,0 @@
import './HeaderAuth.css'
import { Link } from 'react-router-dom';
export default function Header() {
return(
<header>
<div className="container-fluid d-flex justify-content-evenly">
<div className="left-part d-flex">
<img src="/images/logo.svg" alt="Logo" width="50" />
<div className="d-flex align-items-center pt-3">
<p className="first-part ms-3">СОЦИАЛ</p>
<p className="last-part">ьная сеть</p>
</div>
</div>
<div className="right-part d-none d-sm-flex me-4 pt-3">
<nav>
<ul className="d-flex list-unstyled p-0 m-0">
<li><Link className="d-block me-2 p-2" to="/feed">Войти</Link></li>
<li><Link className="d-block me-2 p-2" to="/signup">Зарегистрироваться</Link></li>
</ul>
</nav>
</div>
</div>
</header>
)
}

View File

@@ -1,76 +0,0 @@
.custom-link:link {
color: white;
text-decoration: none;
}
.custom-link:visited {
color: white;
}
.custom-link:hover {
color: #BF1723;
background-color: #2a2a2a;
}
.custom-link:active {
color: #FCD116;
}
.leftbar {
width: 10%;
background-color: #222222;
border-radius: 15px;
min-width: 120px;
}
.leftbar-content > .custom-link {
border-radius: 5px;
}
.leftbar-settings {
border-top: 1px solid rgba(128, 128, 128, 0.479);
}
.leftbar-settings > .custom-link{
border-radius: 5px;
}
.footer {
border-top: 1px solid rgba(128, 128, 128, 0.479);
}
.footer > span {
z-index: 1;
cursor: pointer;
color: white;
}
span:hover {
color: #BF1723;
}
.footer:hover .footer-menu {
display: flex;
flex-direction: column;
top: 150%;
left: -6%;
width: 110%;
position: absolute;
background-color: #222222;
border-radius: 10px;
padding: 10px;
min-width: 120px;
}
.footer-menu {
display: none;
}
.footer-menu > a {
border-radius: 5px;
}

View File

@@ -1,30 +0,0 @@
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap/dist/js/bootstrap.bundle.min';
import { Link } from 'react-router-dom';
import './Leftbar.css'
export default function Leftbar() {
return(
<div class="leftbar d-none h-100 m-1 d-sm-flex flex-column">
<div class="leftbar-content d-flex flex-column mt-2 mx-2 mb-1">
<Link className="custom-link mb-1 p-1" to="/profile">Профиль</Link>
<Link className="custom-link mb-1 p-1" to="/feed">Лента</Link>
<Link className="custom-link mb-1 p-1" to="/messages">Сообщения</Link>
</div>
<div class="leftbar-settings d-flex flex-column mt-2 mx-2 mb-0 pt-1">
<Link className="custom-link p-1" >Настройки</Link>
</div>
<div class="footer position-relative m-2 pt-1">
<span class="position-relative">Ещё &#9660;</span>
<div class="footer-menu">
<Link className="custom-link mb-1 p-1" href="#">Разработчикам</Link>
<Link className="custom-link mb-1 p-1" href="#">О нас</Link>
<Link className="custom-link mb-1 p-1" href="#">Правовая информация</Link>
<Link className="custom-link mb-1 p-1" href="#">Помощь</Link>
</div>
</div>
</div>
)
}

View File

@@ -1,62 +0,0 @@
export const Post = ({ post, onEdit, onDelete }) => {
const formatDate = (dateString) => {
const date = new Date(dateString);
const now = new Date();
const diffInHours = Math.floor((now - date) / (1000 * 60 * 60));
if (diffInHours < 24) {
return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
} else {
return date.toLocaleDateString([], { day: 'numeric', month: 'long' });
}
};
return (
<div className="post mb-3">
<div className="post-header mb-2 d-flex justify-content-between align-items-center">
<div>
<i className='bi bi-people'></i>
<label>{post.group}</label>
</div>
<div>
<button
className="btn btn-sm btn-outline-secondary me-1"
onClick={() => onEdit(post)}
>
<i className="bi bi-pencil"></i>
</button>
<button
className="btn btn-sm btn-outline-danger"
onClick={() => onDelete(post.id)}
>
<i className="bi bi-trash"></i>
</button>
</div>
</div>
{/* Блок с изображением */}
{post.image && (
<div className="image position-relative w-98 p-1 mb-2">
<img
src={post.image}
className="post-img w-100 h-100 object-fit-cover"
alt="Post content"
/>
</div>
)}
{/* Текст */}
{post.text && <div className="post-text mb-2 p-2">{post.text}</div>}
{/* Подвал */}
<div className="post-footer p-1">
<i className='bi bi-heart me-2'><span className="ms-1">{post.likes}</span></i>
<i className='bi bi-chat-left me-2'><span className="ms-1">{post.comments}</span></i>
<i className='bi bi-reply me-2'><span className="ms-1">{post.shares}</span></i>
</div>
<div className="mt-2">
{formatDate(post.createdAt)}
</div>
</div>
);
};

View File

@@ -1,106 +0,0 @@
import { useState, useRef } from 'react';
import 'bootstrap-icons/font/bootstrap-icons.css';
export const PostForm = ({ onSubmit, onCancel, initialData = {} }) => {
const [formData, setFormData] = useState({
text: initialData.text || '',
image: null,
imagePreview: initialData.image || ''
});
const fileInputRef = useRef(null);
const handleInputChange = (e) => {
setFormData({ ...formData, text: e.target.value });
};
const handleImageChange = (e) => {
const file = e.target.files[0];
if (file) {
const reader = new FileReader();
reader.onloadend = () => {
setFormData({
...formData,
image: file,
imagePreview: reader.result
});
};
reader.readAsDataURL(file);
}
};
const handleSubmit = (e) => {
e.preventDefault();
if (!formData.text && !formData.image) {
alert('Пост должен содержать текст или изображение');
return;
}
onSubmit(formData);
};
const triggerFileInput = () => {
fileInputRef.current.click();
};
return (
<div className="add-post-form mb-4 pb-3">
<h5>{initialData.id ? 'Редактировать пост' : 'Новый пост'}</h5>
<form onSubmit={handleSubmit}>
<div className="mb-3">
<textarea
className="form-control"
placeholder="Напишите что-нибудь..."
rows="3"
value={formData.text}
onChange={handleInputChange}
></textarea>
</div>
<div className="mb-3">
<button
type="button"
className="btn btn-outline-secondary"
onClick={triggerFileInput}
>
<i className="bi bi-image"></i> {formData.imagePreview ? 'Заменить изображение' : 'Выбрать изображение'}
</button>
<input
type="file"
ref={fileInputRef}
accept="image/*"
className="d-none"
onChange={handleImageChange}
/>
{formData.imagePreview && (
<div className="mt-2">
<img
src={formData.imagePreview}
className="img-thumbnail"
style={{ maxHeight: '200px' }}
alt="Превью"
/>
<button
type="button"
className="btn btn-sm btn-outline-danger ms-2"
onClick={() => setFormData({ ...formData, image: null, imagePreview: '' })}
>
<i className="bi bi-trash"></i>
</button>
</div>
)}
</div>
<div className="d-flex justify-content-between">
<button
type="button"
className="btn btn-outline-secondary"
onClick={onCancel}
>
Отмена
</button>
<button type="submit" className="btn btn-danger">
<i className="bi bi-send"></i> {initialData.id ? 'Обновить' : 'Опубликовать'}
</button>
</div>
</form>
</div>
);
};

View File

@@ -1,27 +0,0 @@
.custom-link:link {
color: white;
text-decoration: none;
}
.custom-link:visited {
color: white;
}
.custom-link:hover {
color: #BF1723;
background-color: #2a2a2a;
}
.custom-link:active {
color: #FCD116;
}
.rightbar {
height: 100%;
width: 10%;
background-color: #222222;
border-radius: 15px;
min-width: 150px;
}
.rightbar-content > a {
border-radius: 5px;
}

View File

@@ -1,16 +0,0 @@
import './Rightbar.css'
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap/dist/js/bootstrap.bundle.min';
import { Link } from 'react-router-dom';
export default function Rightbar() {
return(
<div class="rightbar d-none d-sm-flex m-1">
<div class="rightbar-content d-flex flex-column m-2">
<Link className="custom-link mb-1 p-1">Все</Link>
<Link className="custom-link mb-1 p-1">Непрочитанные</Link>
<Link className="custom-link mb-1 p-1">Архив</Link>
</div>
</div>
)
}

View File

@@ -1,209 +0,0 @@
.task-manager {
max-width: 800px;
margin: 0 auto;
padding: 20px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.loading {
text-align: center;
font-size: 18px;
color: #666;
margin: 50px 0;
}
.empty-state {
text-align: center;
padding: 40px;
color: #888;
font-size: 16px;
border: 2px dashed #ddd;
border-radius: 8px;
}
/* Формы */
.add-task-form {
background: #f8f9fa;
padding: 20px;
border-radius: 8px;
margin-bottom: 30px;
border: 1px solid #e9ecef;
}
.form-group {
margin-bottom: 15px;
}
.form-input, .form-textarea {
width: 100%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 14px;
}
.form-input:focus, .form-textarea:focus {
outline: none;
border-color: #007bff;
box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}
.form-textarea {
resize: vertical;
min-height: 60px;
}
/* Кнопки */
.btn {
padding: 8px 16px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
margin: 5px;
transition: all 0.2s;
}
.btn:hover {
transform: translateY(-1px);
}
.btn-primary {
background: #007bff;
color: white;
}
.btn-success {
background: #28a745;
color: white;
}
.btn-warning {
background: #ffc107;
color: black;
}
.btn-danger {
background: #dc3545;
color: white;
}
.btn-info {
background: #17a2b8;
color: white;
}
.btn-secondary {
background: #6c757d;
color: white;
}
/* Список задач */
.tasks-list {
margin-top: 30px;
}
.task-item {
background: white;
border: 1px solid #e9ecef;
border-radius: 8px;
padding: 20px;
margin-bottom: 15px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
transition: all 0.3s;
}
.task-item:hover {
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.task-item.completed {
background: #f8fff9;
border-color: #28a745;
}
.task-item.completed .task-title {
text-decoration: line-through;
color: #28a745;
}
.task-content {
margin-bottom: 15px;
}
.task-title {
margin: 0 0 10px 0;
color: #333;
font-size: 18px;
}
.task-description {
margin: 0 0 10px 0;
color: #666;
line-height: 1.5;
}
.task-status {
font-size: 14px;
color: #888;
}
.task-actions {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.edit-form {
display: flex;
flex-direction: column;
gap: 10px;
}
.edit-actions {
display: flex;
gap: 10px;
}
/* Статус подключения */
.connection-status {
position: fixed;
bottom: 20px;
right: 20px;
padding: 10px 15px;
background: white;
border-radius: 20px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
}
.status-indicator {
font-size: 16px;
}
.status-indicator.connected {
color: #28a745;
}
.status-indicator.disconnected {
color: #dc3545;
}
/* Адаптивность */
@media (max-width: 768px) {
.task-manager {
padding: 10px;
}
.task-actions {
flex-direction: column;
}
.btn {
width: 100%;
margin: 2px 0;
}
}

View File

@@ -1,206 +0,0 @@
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import './TaskManager.css';
const TaskManager = () => {
const [tasks, setTasks] = useState([]);
const [newTask, setNewTask] = useState({
title: '',
description: '',
completed: false
});
const [editingTask, setEditingTask] = useState(null);
const [loading, setLoading] = useState(true);
const API_BASE_URL = 'http://localhost:8080/api/tasks';
// Получить все задачи
const fetchTasks = async () => {
try {
setLoading(true);
const response = await axios.get(API_BASE_URL);
setTasks(response.data);
} catch (error) {
console.error('Ошибка при загрузке задач:', error);
alert('Не удалось загрузить задачи. Проверьте, запущен ли backend на порту 8080');
} finally {
setLoading(false);
}
};
// Создать новую задачу
const createTask = async () => {
if (!newTask.title.trim()) {
alert('Введите название задачи!');
return;
}
try {
const response = await axios.post(API_BASE_URL, newTask);
setTasks([...tasks, response.data]);
setNewTask({ title: '', description: '', completed: false });
} catch (error) {
console.error('Ошибка при создании задачи:', error);
}
};
// Обновить задачу
const updateTask = async (id, updatedData) => {
try {
const response = await axios.put(`${API_BASE_URL}/${id}`, updatedData);
setTasks(tasks.map(task => task.id === id ? response.data : task));
setEditingTask(null);
} catch (error) {
console.error('Ошибка при обновлении задачи:', error);
}
};
// Удалить задачу
const deleteTask = async (id) => {
if (!window.confirm('Удалить эту задачу?')) return;
try {
await axios.delete(`${API_BASE_URL}/${id}`);
setTasks(tasks.filter(task => task.id !== id));
} catch (error) {
console.error('Ошибка при удалении задачи:', error);
}
};
// Переключить статус выполнения
const toggleComplete = async (task) => {
await updateTask(task.id, {
...task,
completed: !task.completed
});
};
useEffect(() => {
fetchTasks();
}, []);
if (loading) {
return <div className="loading">Загрузка задач...</div>;
}
return (
<div className="task-manager">
<h1>🚀 Менеджер задач</h1>
<p>Лабораторная работа по Интернет программированию</p>
{/* Форма добавления новой задачи */}
<div className="add-task-form">
<h2>Добавить новую задачу</h2>
<div className="form-group">
<input
type="text"
placeholder="Название задачи *"
value={newTask.title}
onChange={(e) => setNewTask({...newTask, title: e.target.value})}
className="form-input"
/>
</div>
<div className="form-group">
<textarea
placeholder="Описание задачи"
value={newTask.description}
onChange={(e) => setNewTask({...newTask, description: e.target.value})}
className="form-textarea"
rows="3"
/>
</div>
<button onClick={createTask} className="btn btn-primary">
Добавить задачу
</button>
</div>
{/* Список задач */}
<div className="tasks-list">
<h2>Список задач ({tasks.length})</h2>
{tasks.length === 0 ? (
<div className="empty-state">
📝 Нет задач. Добавьте первую задачу!
</div>
) : (
tasks.map(task => (
<div key={task.id} className={`task-item ${task.completed ? 'completed' : ''}`}>
{editingTask === task.id ? (
// Режим редактирования
<div className="edit-form">
<input
type="text"
value={editingTask.title}
onChange={(e) => setEditingTask({...editingTask, title: e.target.value})}
className="form-input"
/>
<textarea
value={editingTask.description}
onChange={(e) => setEditingTask({...editingTask, description: e.target.value})}
className="form-textarea"
rows="2"
/>
<div className="edit-actions">
<button
onClick={() => updateTask(task.id, editingTask)}
className="btn btn-success"
>
💾 Сохранить
</button>
<button
onClick={() => setEditingTask(null)}
className="btn btn-secondary"
>
Отмена
</button>
</div>
</div>
) : (
// Режим просмотра
<>
<div className="task-content">
<h3 className="task-title">{task.title}</h3>
<p className="task-description">{task.description}</p>
<div className="task-status">
Статус: {task.completed ? '✅ Выполнено' : '⏳ В процессе'}
</div>
</div>
<div className="task-actions">
<button
onClick={() => toggleComplete(task)}
className={`btn ${task.completed ? 'btn-warning' : 'btn-success'}`}
>
{task.completed ? '↩️ Возобновить' : '✅ Завершить'}
</button>
<button
onClick={() => setEditingTask({...task})}
className="btn btn-info"
>
Редактировать
</button>
<button
onClick={() => deleteTask(task.id)}
className="btn btn-danger"
>
🗑 Удалить
</button>
</div>
</>
)}
</div>
))
)}
</div>
{/* Статус подключения */}
<div className="connection-status">
<div className={`status-indicator ${tasks.length > 0 ? 'connected' : 'disconnected'}`}>
</div>
Backend: {tasks.length > 0 ? 'Подключен' : 'Не подключен'}
</div>
</div>
);
};
export default TaskManager;

View File

@@ -1,75 +0,0 @@
import { useState, useEffect } from 'react';
import axios from 'axios';
const API_URL = 'http://localhost:8080/api/posts';
export default function usePosts() {
const [posts, setPosts] = useState([]);
const fetchPosts = async () => {
try {
const res = await axios.get(API_URL);
//сортируем по дате создания
const sortedPosts = res.data.sort((a, b) =>
new Date(b.createdAt) - new Date(a.createdAt)
);
setPosts(sortedPosts);
} catch (error) {
console.error('Ошибка при загрузке постов:', error);
}
};
const createPost = async (postData) => {
try {
const postToSend = {
text: postData.text,
image: postData.imagePreview || '',
group: 'Моя группа'
};
await axios.post(API_URL, postToSend);
await fetchPosts();
} catch (error) {
console.error('Ошибка при создании поста:', error);
throw error;
}
};
const updatePost = async (id, postData) => {
try {
const postToSend = {
text: postData.text,
image: postData.image,
group: postData.group,
};
await axios.put(`${API_URL}/${id}`, postToSend);
await fetchPosts();
} catch (error) {
console.error('Ошибка при обновлении поста:', error);
throw error;
}
};
const deletePost = async (id) => {
try {
await axios.delete(`${API_URL}/${id}`);
await fetchPosts();
} catch (error) {
console.error('Ошибка при удалении поста:', error);
throw error;
}
};
useEffect(() => {
fetchPosts();
}, []);
return {
posts,
createPost,
updatePost,
deletePost,
refetch: fetchPosts
};
}

View File

@@ -1,13 +0,0 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

View File

@@ -1,17 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -1,147 +0,0 @@
import React, { useState, useEffect } from 'react';
import { PostForm } from '../components/PostForm';
import { Post } from '../components/Post';
import Header from '../components/Header/Header';
import Leftbar from '../components/Leftbar/Leftbar';
import Rightbar from '../components/Rightbar/Rightbar';
import Bottombar from '../components/Bottombar/Bottombar';
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap-icons/font/bootstrap-icons.css';
import './css/FeedPage.css';
import usePosts from '../hooks/usePosts'; // Импортируем наш хук
const FeedPage = () => {
const { posts, createPost, updatePost, deletePost, likePost, loading } = usePosts();
const [showForm, setShowForm] = useState(false);
const [editingPost, setEditingPost] = useState(null);
const handleShowForm = () => {
setShowForm(true);
setEditingPost(null);
};
const handleSubmit = async (formData) => {
try {
if (editingPost) {
// Редактирование существующего поста
await updatePost(editingPost.id, {
text: formData.text,
image: formData.imagePreview || '',
group: 'Моя группа',
likes: editingPost.likes,
comments: editingPost.comments,
shares: editingPost.shares
});
} else {
// Создание нового поста
await createPost(formData);
}
setShowForm(false);
setEditingPost(null);
} catch (error) {
console.error('Ошибка при сохранении поста:', error);
alert('Не удалось сохранить пост');
}
};
const handleEdit = (post) => {
setEditingPost(post);
setShowForm(true);
};
const handleDelete = async (postId) => {
if (window.confirm('Вы уверены, что хотите удалить этот пост?')) {
try {
await deletePost(postId);
} catch (error) {
console.error('Ошибка при удалении поста:', error);
alert('Не удалось удалить пост');
}
}
};
const handleLike = async (postId) => {
try {
await likePost(postId);
} catch (error) {
console.error('Ошибка при лайке поста:', error);
}
};
if (loading) {
return (
<div>
<Header />
<div className="page d-flex justify-content-center mt-3">
<Leftbar />
<div className="content h-100 w-25 m-1 p-2 mb-5 d-flex flex-column justify-content-center align-items-center">
<div className="spinner-border text-danger" role="status">
<span className="visually-hidden">Загрузка...</span>
</div>
<p className="mt-2">Загрузка постов...</p>
</div>
<Rightbar />
</div>
<Bottombar />
</div>
);
}
return (
<div>
<header><Header /></header>
<main>
<section className='w-100'>
<div className="page d-flex justify-content-center mt-3">
<Leftbar />
<div className="content h-100 w-25 m-1 p-2 mb-5 d-flex flex-column justify-content-center">
<button
className="btn btn-danger add-post-btn m-3"
onClick={handleShowForm}
>
<i className="bi bi-plus-circle"></i> Добавить пост
</button>
{showForm && (
<PostForm
onSubmit={handleSubmit}
onCancel={() => {
setShowForm(false);
setEditingPost(null);
}}
initialData={editingPost || {}}
/>
)}
{posts.length === 0 ? (
<div className="text-center text-muted py-5">
<i className="bi bi-inbox" style={{ fontSize: '3rem' }}></i>
<p className="mt-3">Пока нет постов. Будьте первым!</p>
</div>
) : (
posts.map(post => (
<Post
key={post.id}
post={post}
onEdit={handleEdit}
onDelete={handleDelete}
onLike={handleLike}
/>
))
)}
</div>
<Rightbar />
</div>
<Bottombar />
</section>
</main>
</div>
);
};
export default FeedPage;

View File

@@ -1,58 +0,0 @@
import React from 'react';
import { Link, useNavigate } from 'react-router-dom';
import HeaderAuth from '../components/HeaderAuth/HeaderAuth';
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap-icons/font/bootstrap-icons.css';
import './css/LoginPage.css';
const LoginPage = () => {
return (
<div>
<header>
<HeaderAuth />
</header>
<section>
<div
className="container-fluid d-flex justify-content-center align-items-center"
style={{ height: 'calc(100vh - 200px)' }}
>
<div
className="login-page"
style={{ minWidth: 300, maxWidth: 400, width: '100%' }}
>
<form className="px-3">
<h1 className="text-center">Авторизация</h1>
<div className="input-div d-flex flex-column align-items-center mb-2">
<div className="input-box my-1">
<input type="text" placeholder="Логин" required />
<i className="bi bi-person"></i>
</div>
<div className="input-box my-1">
<input type="password" placeholder="Пароль" required />
<i className="bi bi-shield-lock"></i>
</div>
</div>
<div className="remember-forgot d-flex justify-content-evenly mb-2 px-2">
<label><input type="checkbox" /> Запомнить меня</label>
<a href="#">Забыли пароль?</a>
</div>
<button type="submit" className="btn w-100">Войти</button>
<div className="register-link d-flex justify-content-evenly align-items-center">
<p className="pt-3">У меня нет аккаунта</p>
<Link to="/signup">Зарегистрироваться</Link>
</div>
</form>
</div>
</div>
</section>
</div>
);
};
export default LoginPage;

View File

@@ -1,42 +0,0 @@
import React from 'react';
import Header from '../components/Header/Header';
import Leftbar from '../components/Leftbar/Leftbar';
import Rightbar from '../components/Rightbar/Rightbar';
import Bottombar from '../components/Bottombar/Bottombar';
import Chat from '../components/Chat/Chat';
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap-icons/font/bootstrap-icons.css';
import './css/MessagePage.css';
import chatData from './chatData.json';
const MessagesPage = () => {
return (
<div>
<header><Header /></header>
<section>
<div class="page d-flex justify-content-center mt-3">
<Leftbar />
<div class="content h-100 w-25 m-1 p-2">
{chatData.map((chat, index) => (
<Chat
key={index}
username={chat.username}
message={chat.message}
avatarUrl={chat.avatarUrl}
/>
))}
</div>
<Rightbar />
</div>
<Bottombar />
</section>
</div>
);
};
export default MessagesPage;

View File

@@ -1,12 +0,0 @@
const NotFoundPage = () => {
return (
<div>
<p>404</p>
<p>Страница не найдена</p>
<p>Something went wrong</p>
</div>
);
};
export default NotFoundPage;

View File

@@ -1,50 +0,0 @@
import React from 'react';
import Header from '../components/Header/Header';
import Leftbar from '../components/Leftbar/Leftbar';
import Rightbar from '../components/Rightbar/Rightbar';
import Bottombar from '../components/Bottombar/Bottombar';
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap-icons/font/bootstrap-icons.css';
import './css/ProfilePage.css';
const ProfilePage = () => {
return (
<div>
<header><Header /></header>
<section>
<div class="page d-flex justify-content-center mt-3">
<Leftbar />
<div class="profile-card d-flex flex-column align-items-center p-4">
<div class="imagep position-relative p-1 mb-2">
<img src="../images/photo.jpg" alt="" class="profile-img w-100 h-100 object-fit-cover" />
</div>
<div class="text-data d-flex flex-column align-items-center">
<span class="name">Павел Ладягин</span>
<span class="about">Краткая информация о себе</span>
</div>
<div class="more-info d-flex justify-content-between">
<div class="location">
<i class="bi bi-geo-alt"></i>
<label>Ульяновск</label>
</div>
<div class="education">
<i class="bi bi-buildings"></i>
<label>УлГТУ</label>
</div>
</div>
</div>
<Rightbar />
</div>
<Bottombar />
</section>
</div>
);
};
export default ProfilePage;

View File

@@ -1,59 +0,0 @@
import { Link, useNavigate } from 'react-router-dom';
import HeaderAuth from '../components/HeaderAuth/HeaderAuth';
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap-icons/font/bootstrap-icons.css';
import './css/SignupPage.css';
const SignupPage = () => {
return (
<div>
<header>
<HeaderAuth />
</header>
<section>
<div className="container-fluid d-flex justify-content-center align-items-center" style={{ height: 'calc(100vh - 200px)' }}>
<div className="login-page" style={{ minWidth: 300, maxWidth: 400, width: '100%' }}>
<form className="px-3">
<h1 className="text-center">Авторизация</h1>
<div className="input-div d-flex flex-column align-items-center mb-2">
<div className="input-box my-1">
<input type="text" placeholder="Логин" />
<i className="bi bi-person"></i>
</div>
<div className="input-box my-1">
<input type="password" placeholder="Пароль" />
<i className="bi bi-shield-lock"></i>
</div>
<div className="input-box my-1">
<input type="password" placeholder="Подтвердите пароль" />
<i className="bi bi-shield-lock"></i>
</div>
<div className="input-box my-1">
<input type="text" placeholder="Почта" />
<i className="bi bi-envelope"></i>
</div>
</div>
<div className="remember-forgot d-flex justify-content-evenly mb-2 px-2">
<label><input type="checkbox" /> Запомнить меня</label>
<a href="#">Забыли пароль?</a>
</div>
<button type="submit" className="btn w-100">Войти</button>
<div className="register-link d-flex justify-content-evenly align-items-center">
<p className="pt-3">У меня есть аккаунт</p>
<Link to="/">Войти</Link>
</div>
</form>
</div>
</div>
</section>
</div>
);
};
export default SignupPage;

View File

@@ -1,29 +0,0 @@
[
{
"username": "Иван Иванов",
"message": "Сделал вторую лабу",
"avatarUrl": "../images/photo.jpg"
},
{
"username": "Мария Петрова",
"message": "Привет, как дела?",
"avatarUrl": "../images/meme1.jpg"
},
{
"username": "Алексей Смирнов",
"message": "Готовлюсь к экзамену",
"avatarUrl": "../images/meme2.jpg"
},
{
"username": "Елена Васильева",
"message": "Жду feedback по проекту",
"avatarUrl": "../images/logo.svg"
},
{
"username": "Елена Васильева11111",
"message": "Жду feedback по проекту",
"avatarUrl": "../images/profile-icon.svg"
}
]

View File

@@ -1,90 +0,0 @@
body {
color: #c5c6c7;
background-color: #141414;
}
img {
width: 50px;
}
li {
list-style: none;
}
.content {
background-color: #222222;
border-radius: 15px;
border: 0.1px solid #BF1723;
min-width: 250px;
}
.post-header {
color: #fff;
border-top: 0.5px solid #BF1723;
padding-top: 3%;
}
.image .post-img {
border-radius: 2%;
}
.post-footer {
color: #fff;
}
/*Форма для добавления*/
.formContainer{
border: 1px solid #ccc;
border-radius: 5px;
background-color: #f9f9f9;
max-width: 300px;
}
/* Обновлённые стили для кнопок управления постом */
.post-header {
display: flex;
align-items: center;
gap: 8px;
}
.post-actions {
margin-left: auto;
display: flex;
gap: 5px;
}
.post-actions button {
font-size: 0.8rem;
padding: 0.1rem 0.4rem;
}
/* Стили для изображений */
.image-preview {
max-width: 100%;
max-height: 200px;
margin-top: 10px;
display: none;
border-radius: 8px;
}
.post-img {
border-radius: 8px;
object-fit: cover;
}
.like-btn {
cursor: pointer;
transition: color 0.2s;
}
.like-btn.text-danger {
color: #dc3545 !important;
}

View File

@@ -1,73 +0,0 @@
body {
color: #c5c6c7;
background-color: #0b0c10;
}
/* Шапка */
header .container-fluid {
border-bottom: 3px solid #BF1723;
border-bottom-right-radius: 25px;
border-bottom-left-radius: 25px;
}
.first-part {
color:#FCD116;
font-size: 1.4em;
}
.last-part {
color: #BF1723;
font-size: 1.5em;
}
.right-part > nav > ul > li > a {
border: 0.5px solid #FFF;
border-radius: 10px;
}
/* Блок регистрации */
.login-page {
background-color: #222222;
border-radius: 15%;
border: 0.5px solid #BF1723;
color: #FFF;
}
.remember-forgot label input {
accent-color: #BF1723;
}
.login-page .btn {
background-color: #BF1723;
border-radius: 10px;
color: #fff;
}
.input-box input {
border-radius: 4px;
}
.input-box input:focus {
border-color: #BF1723;
outline: none;
}
/* Ссылки */
a {
outline: none;
text-decoration: none;
}
a:link{
color: #FCD116;
}
a:visited{
color: #FCD116;
}
a:hover{
color: #c5c6c7;
}

View File

@@ -1,23 +0,0 @@
body {
color: #c5c6c7;
background-color: #141414;
}
img {
width: 50px;
}
li {
list-style: none;
}
.content {
background-color: #222222;
border-radius: 15px;
border: 0.1px solid #BF1723;
min-width: 250px;
}

View File

@@ -1,54 +0,0 @@
* {
box-sizing: border-box;
}
body {
color: #c5c6c7;
background-color: #141414;
margin: 0px;
}
img {
width: 50px;
}
li {
list-style: none;
}
.profile-card {
max-width: 250px;
width: 100%;
background-color: #222222;
border-radius: 25px;
}
.imagep {
width: 150px;
height: 150px;
border-radius: 50%;
background-color: #FCD116;
}
.imagep .profile-img {
border-radius: 50%;
border: 3px solid #FFF;
}
.text-data .name {
font-size: 22px;
font-weight: 500;
color: #fff;
}
.text-data .about {
font-size: 15px;
font-weight: 400;
color: #fff;
margin-bottom: 10px;
}
.profile-card .more-info {
width: 90%;
}

View File

@@ -1,73 +0,0 @@
body {
color: #c5c6c7;
background-color: #0b0c10;
}
/* Шапка */
header .container-fluid {
border-bottom: 3px solid #BF1723;
border-bottom-right-radius: 25px;
border-bottom-left-radius: 25px;
}
.first-part {
color:#FCD116;
font-size: 1.4em;
}
.last-part {
color: #BF1723;
font-size: 1.5em;
}
.right-part > nav > ul > li > a {
border: 0.5px solid #FFF;
border-radius: 10px;
}
/* Блок регистрации */
.login-page {
background-color: #222222;
border-radius: 15%;
border: 0.5px solid #BF1723;
color: #FFF;
}
.remember-forgot label input {
accent-color: #BF1723;
}
.login-page .btn {
background-color: #BF1723;
border-radius: 10px;
color: #fff;
}
.input-box input {
border-radius: 4px;
}
.input-box input:focus {
border-color: #BF1723;
outline: none;
}
/* Ссылки */
a {
outline: none;
text-decoration: none;
}
a:link{
color: #FCD116;
}
a:visited{
color: #FCD116;
}
a:hover{
color: #c5c6c7;
}

View File

@@ -1,13 +0,0 @@
const reportWebVitals = onPerfEntry => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;

View File

@@ -1,38 +0,0 @@
export class PostService {
static STORAGE_KEY = 'posts';
static getPosts() {
const savedPosts = localStorage.getItem(this.STORAGE_KEY);
return savedPosts ? JSON.parse(savedPosts) : null;
}
static savePosts(posts) {
localStorage.setItem(this.STORAGE_KEY, JSON.stringify(posts));
}
static getInitialPosts() {
const now = Date.now();
return [
{
id: 1,
text: '',
image: 'source/meme1.jpg',
group: 'Какая-то группа 1',
likes: 8,
comments: 2,
shares: 1,
createdAt: new Date(now - 86400000 * 2).toISOString()
},
{
id: 2,
text: '',
image: 'src/assets/meme2.jpg',
group: 'Какая-то группа 2',
likes: 785,
comments: 102,
shares: 14,
createdAt: new Date(now - 86400000 * 2).toISOString()
}
];
}
}

View File

@@ -1,5 +0,0 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';

Binary file not shown.

Binary file not shown.

Binary file not shown.