This is the code for the project in Interface Programming with a User Perspective at Uppsala university. Our project is a game called PreGame2, which you can play together with your friends and family.
This outlines the dependencies and relationships between the files in the project.
- Purpose: Displays data as a series of vertical bars, typically used for visualizing poll results.
- Dependencies:
- Receives
labels
(array of labels for each bar) anddata
(an object mapping labels to values) as props.
- Receives
- Used In:
ResultView.vue
as a child component to display poll results graphically.
- Purpose: Displays a single question and its answer options as buttons.
- Dependencies:
- Accepts a
question
prop (object withq
for question text anda
for an array of answer options). - Emits an
answer
event when an answer is selected.
- Accepts a
- Used In:
PollView.vue
as a child component to display a poll question and handle user responses.
- Purpose: Allows users to reorder items (e.g., poll options) interactively using drag-and-drop.
- Dependencies:
- Contains its own local data (
question
andcurrentlyMoving
) but is generally standalone.
- Contains its own local data (
- Used In: Could be included in a view to handle special polls requiring reordering logic.
- Purpose: Implements a responsive navigation bar with dynamic content slots.
- Dependencies:
- Accepts
hideNav
as a prop to control its visibility. - Relies on slots for rendering navigation links or buttons dynamically.
- Accepts
- Used In:
StartView.vue
as part of the main navigation structure.
- Purpose: Displays poll results, including the current question and its answers.
- Dependencies:
- Uses
BarsComponent.vue
to visualize submitted answers. - Relies on props for
question
andsubmittedAnswers
to render the view.
- Uses
- Used In: Router view when the user navigates to the results page.
- Purpose: Acts as the entry point of the application, showing navigation options and allowing users to join or create polls.
- Dependencies:
- Uses
ResponsiveNav.vue
for navigation. - Communicates with the server to retrieve UI labels and poll details.
- Uses
- Used In: Router view for the application’s root route (
/
).
- Purpose: Defines the routes for the application and sets up Vue Router for navigation.
- Dependencies:
StartView.vue
: Mapped to the root route (/
).PollView.vue
: Lazy-loaded for viewing a poll.LobbyView.vue
: Lazy-loaded for accessing a lobby.CreateView.vue
: Lazy-loaded for creating a poll.ResultView.vue
: Lazy-loaded for displaying poll results.
- Key Features:
- Uses
createWebHistory
for HTML5 history mode, removing hash (#
) from URLs. - Lazy-loads components for improved performance.
- Uses
- Purpose: Manages all server-side data, including polls, questions, answers, and participants.
- Dependencies:
- Reads label files dynamically based on the requested language (
getUILabels
method). - Interacts with other server-side files (e.g.,
sockets.js
) to handle poll creation, question updates, and user submissions.
- Reads label files dynamically based on the requested language (
- Used In:
index.js
to provide centralized data management for WebSocket events.
- Purpose: Handles WebSocket events and interactions between clients and the server.
- Dependencies:
- Relies on the
Data.js
file for managing poll data and processing requests. - Uses the
io
andsocket
objects to manage WebSocket connections and broadcast updates.
- Relies on the
- Used In:
index.js
to define WebSocket event listeners.
- Purpose: Initializes the HTTP and WebSocket servers, handles cross-origin resource sharing (CORS), and connects the server-side functionality.
- Dependencies:
- Imports and initializes
Data.js
to manage server-side data. - Loads
sockets.js
to define WebSocket event listeners. - Uses
socket.io
for real-time communication andhttp
to create the server.
- Imports and initializes
- Used As: The main entry point for running the backend server.
-
Frontend:
- Vue Router: Used for routing between views (e.g.,
StartView.vue
,PollView.vue
,ResultView.vue
). - WebSocket: Used to communicate with the backend for real-time updates.
- CSS/SCSS: Used to style components (
main.css
and scoped styles in each component).
- Vue Router: Used for routing between views (e.g.,
-
Backend:
fs
Module: Used inData.js
to load language label files dynamically.- Socket.io: Used for WebSocket communication between the server and clients.
StartView.vue
: The user enters the application and can navigate to create or join a poll.PollView.vue
: Displays the current poll question usingQuestionComponent.vue
. Handles user responses.ResultView.vue
: Shows poll results usingBarsComponent.vue
for visualization.- Backend (
index.js
,Data.js
,sockets.js
): Manages the poll data, processes responses, and broadcasts updates to connected clients.
See Vite Configuration Reference.
npm install
npm run dev
Note that this command starts two servers – a Vite server and a simple data and socket communication server.
npm run build
Lint with ESLint
npm run lint